Can i delete a value in custom field via workflow script?

hi, I made a script so that when merging to a certain branch in a task, the custom field will change to another, but I want the old value to be deleted, I can do this with a script or I will have to delete manual every time

0
7 comments

Hello,

I'm Lena from the YouTrack Team. Could you please let me know the type of the field? The solution will depend on it. 

0

Hello,

Please try to set the value of the enum field to null:

ctx.issue.fields['Branch'] = null;
0

Hello,

this method replaces the current value with null but does not delete it, I need to replace one branch with another and completely remove the previous one from the possible values

0

Hi,

Let me clarify - do you wish to delete the value from a set of possible values, not just clean the field value in the particular ticket? 

0

Hi,

Thank you for your clarification. You can do it in the workflow using our REST API. So the idea is to send the DELETE request as described here: https://www.jetbrains.com/help/youtrack/devportal/operations-api-admin-customFieldSettings-bundles-enum-bundleID-values.html#delete-EnumBundleElement-method

In this workflow, you can see how to send external requests in general: https://www.jetbrains.com/help/youtrack/devportal/slack-notifications-workflow.html#modules.

Please let me know if you need any further assistance.

0

Please sign in to leave a comment.