Revert to New UI action is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 02:58 AM
Hi,
I have requirement like When I click on Revert to New menu it should ask for work notes to be mandatory and after filling the work notes and after saving it state remains the same and after again clicking the 2nd time revert to new menu and filling the work notes 2nd time and saving it then the state changing to New. How can I achieve it in the first click after filling the work notes and save it. Below is my script.
revertToNew(current);
action.setRedirectURL(current);
function revertTonew(changeReq) {
var change = new ChangeRequest(changeReq);
if (current.work_notes == '') {
gs.addErrorMessage('Worknotes Mandatory');
}
else if (!change.revertToNew())
gs.addErrorMessage(gs.getMessage('State Model for {0} changes does not allow reverting change from {1} state', [change.getValue('type'), change.getDisplayValue('state')]));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 03:00 AM
@Ankur Bawiskar Inputs please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 03:33 AM
how will you know user clicked 1st time and 2nd time?
Unless you store the click count on some custom integer field you cannot track it
1) create custom integer field and update it with 1 when 1st time it gets clicked
2) in UI action script check if the field value is 1 if yes it means it's clicked 2nd time and now set state to other value
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-28-2023 03:40 AM - edited 04-28-2023 03:50 AM
Hi @Ankur Bawiskar ,
Its not about the count when we click the Revert to New from menu and asking for worknotes to fill and after filling and save it needs to set to New state but its not happening from the above UI action can you please check whether I need any changes in it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2025 01:07 AM
Hope you are doing good.
Did my reply answer your question?
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