- 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 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 02:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 08:37 AM
Hi,
your action name field on UI action is empty
update it with SendforApproval
also update script as this
function SendforApproval() {
if (g_form.getValue('u_status').toString() == '2')
gsftSubmit(null, g_form.getFormElement(), 'SendforApproval');
else
return false;
}
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 08:36 PM
I already answered your question and it's just that you didn't mention action name in your UI action. I considered it must be there since you are using gsftSubmit.
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader