How to call flow for next step from UI action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 12:07 AM
Hi Team,
We have one catalog item in which we are creating task so after closed all task I don't want close RITM, I have to put in another stage likes "waiting request"and have to set awaiting requester and I have to create one UI action which will only visible for request manager once manger click on this UI action then I have to move RITM in next stage "Requested" and need to call flow and create new task
How can we call flow from UI action and have to create new task??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 12:45 AM
You can use the below code to trigger the flow from UI action:
Once all your task are completed you need to use set value activity to set the RITM stage to 'waiting request', The UI action must be visible on the condition if stage is 'waiting request'. One click of UI action your flow will be called and flow will be executed.
function triggerFlowFromUIAction() {
var flowName = 'Your_Flow_Name';
// Define the data input for the flow (if required)
var inputData = {
'key1': 'value1',
'key2': 'value2'
};
var flowAction = new GlideFlowAction(flowName);
flowAction.setInputData(inputData);
flowAction.startFlow(function(response) {
if (response.isSuccess()) {
gs.info('Flow executed successfully.');
} else {
gs.error('Flow execution failed: ' + response.getErrorMessage());
}
});
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....