Flow Designer comes with built-in steps for Jira Cloud and Jira Server. These steps let you create, update, and add comments to issues at any point in your flow.
The built-in steps are convenient, but they might not always do exactly what you want. For example, what if you want to add a label to the existing ones, but when you set the Label input in the Update Issue step, the labels on the issue are replaced? Well, you can do that too, and we'll walk you through how to copy the step as a custom step and tweak its settings to make it happen.
Create a copy of the step
- Open a flow in Flow Designer. Any old flow will do, but let's open the one where you want to use the step so you have one less step later.
- Click on the Apps tab in the palette, and find the step you need to copy: the Update Issue step in either the Jira Cloud section or the Jira Server section, depending on which tool you're using.
- Click the gear icon beside the step and select Copy as Custom. This opens up the New Custom Step dialog box.
- Give the new step a name, let's say Jira Cloud - Update Issue (labels). This lets you find it in the Custom tab of the palette.
- You can also update the description to let your teammates know this version of the step adds to the list of labels rather than replacing them.
Update the script
- Click on the Script tab.
- Find and replace the lines of code outlined in the sections below for Jira Cloud and Jira Server.
- Click Save.
Your custom step is now ready to use — you can find it on the Custom tab in the palette. Add it to a flow and check to see that it's adding labels to any existing ones.
Updates to the Jira Cloud step script
Replace lines 11-28 — starting at var payload = { — with:
var payload = {
fields: {
description: withContext(description),
environment: withContext(environment),
summary: input['Summary']
},
update: {
labels: labelsArray
}
};
var payload = {
fields: {
description: withContext(description),
environment: withContext(environment),
summary: input['Summary']
},
update: {
labels: labelsArray
}
};
Here's the existing code for reference:
Updates to the Jira Server step script
Replace lines 11 to 32 — starting at var payload = { — with:
var labels = input['Labels'];
var labelsArray;
if (labels) {
labelsArray = labels.split(',').map(function(element) {
return { add: element.trim() };
});
}
var assignee = input['Assignee Key'];
var priority = input['Priority'];
var reporter = input['Reporter Key'];
var payload = {
fields: {
assignee: assignee ? { name: assignee } : undefined,
description: input['Description'],
environment: input['Environment'],
priority: priority ? { name: priority } : undefined,
reporter: reporter ? { name: reporter } : undefined,
summary: input['Summary']
},
update: {
labels: labelsArray
}
};
Here's the existing code for reference:
Comments
0 commentsPlease sign in to leave a comment.