- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 02:38 AM
I want to create an Ui Action :
Send for approval
- This will be visible when status is draft and record is not new.
- After clicking on this button status changes to pending for approval and assignment group must be filled with "service desk" and an approval will be sent to "service desk" group. Once approval is approved status should be Work in progress.
I have written the following code :But the assignment group is not saving to when service desk is configured from this code.I dont know how to implement "an approval will be sent to "service desk" group".
function SendforApproval() {
if (g_form.getValue('u_status') == '2'); {
g_form.setValue('u_status', '4');
g_form.setValue('assignment_group', 'Service Desk');
g_form.update();
gsftSubmit(null, g_form.getFormElement(), 'SendforApproval');
}
}
if (typeof window == 'undefined')
serverResolve();
function serverResolve() {
current.incident_state = IncidentState.RESOLVED;
current.state = IncidentState.RESOLVED;
current.resolved_by = gs.getUserID();
current.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 02:43 AM
Hi,
update everything in server side since you are anyhow updating it in server function
function SendforApproval() {
if (g_form.getValue('u_status') == '2')
gsftSubmit(null, g_form.getFormElement(), 'SendforApproval');
}
if (typeof window == 'undefined')
serverResolve();
function serverResolve() {
current.setValue('u_status', '4');
current.setDisplayValue('assignment_group', 'Service Desk');
current.incident_state = IncidentState.RESOLVED;
current.state = IncidentState.RESOLVED;
current.resolved_by = gs.getUserID();
current.update();
}
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 03:43 AM
Hello Avinash,
I could see that [Action name] is blank in screenshot you attached. Please update the action name as SendforApproval in [Action name] field on your UI action record.
Please mark this helpful/correct, if it answer your question.
Thanks