I’m at wit’s end here. I need to update a custom field, but the script keeps failing whenever it tries to run tasksApiInstance.updateTask(). The script can successfully run getTask(), getTasksForProjects(), and other API calls, but for some reason not updateTask().
Here’s the code I’m using in the rule’s Run script action:
Blockquote
let taskBody = {‘data’: {‘custom_fields’: {“1234” : “2012-12-12”}}};
Welcome to the forum, @Marcellus_Stewart! Could you post a code snippet? You can fix your specific error by not stringifying taskBody in your update call. Beyond that, from your example, if you’re trying to update a date, I think you’ll need to wrap a date field in another object with a property "date".
Thanks soooo much! Adding {date: …} and removing JSON.stringify() did the trick! I can’t thank you enough!!! I’ve got a big deadline coming up, so thank you, thank you!
For anyone struggling with using a variable’s value for an object’s key, please refer to JavaScript’s object literal notation. For my issue above, I needed to use a variable to plug-in the custom field’s id: