- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 11:51 PM
Dear experts,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 01:28 AM
Hi Shivalika, thanks for the reply but I managed to solve the issue using my approach as below:
So I have created two new button one is Save as Draft and one is Submit to Assigned and also a new flag field in the risk event form called u_submitted.
Save as Draft code and condition:
Condition:
current.state == 1 && !current.u_submitted
Script:
current.assigned_to = '';
current.update(); // Use update so record isn't considered "submitted"
action.setRedirectURL(current); // Stay on the same record after save
Submit to Assigned:
Condition:
(current.assigned_to != null || !gs.nil(current.assigned_to)) && current.state == 1 && !current.u_submitted
Script:
current.u_submitted = true;
if (current.isNewRecord()) {
current.insert();
} else {
current.update();
}
action.setRedirectURL(current);
And for the global Ui action I did not delete or remove but added in one condition which is to exclude the sn_risk_advanced_event table only which is this condition:
current.getTableName() != 'sn_risk_advanced_event'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:08 AM
So after assigning to a user or a owner for the risk event, then the two buttons which are the save as draft button and the submit button will dissapear and replace with the Update button which is in the global ui action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:30 AM
I don't think it's a valid business requirement to just have 1 button to clear the Assigned to field and save the form.
Please discuss this with your customer
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 12:47 AM
Hello @ChuanYanF
I just tried this refer below screenshots, but I don;t think we will be able to keep the "UNSAVED RECORD" I mean "where shall we redirect after clicking on - //save as draft// - this question is stumping me even when I am implementing it.
Refer below screenshots-
1)SAve as Draft appearing only in new records - - this is ok
Not in existing records -
2)UI Action
But after I click on the button it has no exact record to redirect to because nothing is saved. This is the technical stump. This is not feasible, hence. You may open a servicenow case to verify this.
Kindly accept this as solution if it helped you in anyway, so that my efforts can be recognized and also future readers with same query would no why its not possible.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 01:28 AM
Hi Shivalika, thanks for the reply but I managed to solve the issue using my approach as below:
So I have created two new button one is Save as Draft and one is Submit to Assigned and also a new flag field in the risk event form called u_submitted.
Save as Draft code and condition:
Condition:
current.state == 1 && !current.u_submitted
Script:
current.assigned_to = '';
current.update(); // Use update so record isn't considered "submitted"
action.setRedirectURL(current); // Stay on the same record after save
Submit to Assigned:
Condition:
(current.assigned_to != null || !gs.nil(current.assigned_to)) && current.state == 1 && !current.u_submitted
Script:
current.u_submitted = true;
if (current.isNewRecord()) {
current.insert();
} else {
current.update();
}
action.setRedirectURL(current);
And for the global Ui action I did not delete or remove but added in one condition which is to exclude the sn_risk_advanced_event table only which is this condition:
current.getTableName() != 'sn_risk_advanced_event'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 01:40 AM
Yesss @ChuanYanF Niceeee!! getTableName was the condition I also applied. But what is happening in redirect ? You didn't want to save right ?
Then when there is no saved record where is it going after redirect ?
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY