UI Action to Convert RITM to INC "Randomly" Fails to Cancel RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 09:38 AM
We created a button (UI Action) on the RITM form to quickly convert a request to an INC
When we click the button, the stage is set to "Request Cancelled", the State is set to "Closed Incomplete" and the flow is cancelled.
This example closed/cancelled successfully.
The issue that we run into is when the flow doesn't stop right away and generates a bunch of open tasks before cancelling the flow. I've had this happen to the same person on the same ticket type where the button it works one time but not the other.
The only thing I can see that is consistent on tickets that generate tasks by mistake is the cancellation of the flow is run as Guest but I can't figure out why.
Here is the UI Action settings
and the Script below that:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 10:28 AM
Hi,
From initially looking at this, I would recommend that you consider cleaning up your code a little bit. There appears to be unused functions in this script that aren't called anywhere else, some of this could probably benefit from being in a function that gets called and I wouldn't recommend executing a current.update() until you truly need to (it's in there a couple of times -- unless that's on purpose). Also you have the button set to display on Insert of a brand new record too?
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 08:24 AM
Sorry, I am not the author of this script and am very new to writing/editing scripts. We had a managed service provider set this up for us, but we no longer have a contract with them to assist with these types of issues.
Maybe this should be the only time current.update() is used? Would this affect the flow unintentionally kicking off tasks after it has been cancelled?