- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:47 AM - edited 08-31-2023 05:49 AM
I am trying to create a UI Action for an incident to be created when a contract substate is aborted.
I am very new to script and UI action is not covered in the SNAF course. It will be much appreciated if anyone could help out.
I have tried to create a UI Action below but it does not work.
Show insert YES
Show update YES
Application GLOBAL
Form context menu YES
Condition: (substate=='Aborted') && gs.hasRole("contract_manager")
Script:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 12:03 AM
Hi Dlam, you need to include current. before substate.
Also, make sure you're checking for the value of the substate, not the label. The value is probably 'aborted' in lower case (I don't have 'Aborted' as an option in my list, so I assume it's either part of something I don't have installed, or a customisation, either way, I can't check it to be sure.)
That would mean your condition should be:
current.substate == 'aborted' && gs.hasRole("contract_manager")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 09:24 PM - edited 08-31-2023 09:27 PM
Yes, with the original script, the new incident form does have the mandatory fields populated, which are the caller and short description.
Will you be able to help with the condition for the UI Action? The button also appears when the substate is not Aborted:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 12:03 AM
Hi Dlam, you need to include current. before substate.
Also, make sure you're checking for the value of the substate, not the label. The value is probably 'aborted' in lower case (I don't have 'Aborted' as an option in my list, so I assume it's either part of something I don't have installed, or a customisation, either way, I can't check it to be sure.)
That would mean your condition should be:
current.substate == 'aborted' && gs.hasRole("contract_manager")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 07:07 PM
Agreed with Berin.
Also, your UI action is a Form Context menu, which will be shown when someone right click the header in a form within that ast_contract table and manually choose your UI action.
A business rule (server side script) would be the best choice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 07:29 PM
Thanks all for your help.
The workaround for now is to use my initial script to create a form button. I also created a Template of incident form so the user can click on the button on the form and choose the template to create an incident.
I will be exploring how to set a business rule to automate the incident to be created once the substate == aborted. Any suggestion will be appreciated as always.
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 01:31 AM
Thanks you Berin. It worked!
I did test adding "current." before substate earlier, while the form button did not appear so I thought it was the wrong value but did not realise the choice is 'aborted' instead of 'Aborted'.
Have a great weekend.