- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2019 11:51 PM
Hi All,
I have requirement, where I need to implement the "Reopen" button on the request form.
I have the below UI Action :
Form Button : True
Action name: reopen_request
Client : True
Show Update : True
Show Insert : True
Onclick : reopenRequest()
function reopenRequest(){
//Set the 'Incident state' and 'State' values to 'Resolved', and display mandatory fields
g_form.setValue('request_state', in_process);
g_form.setValue('state',1);
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(),'reopen_request'); //MUST call the 'Action name' set in this UI Action
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
serverResolve();
function serverResolve(){
current.request_state = 'in_process';
current.state = '1';
current.update();
}
Please anyone can help on this !!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2019 12:04 AM
Hi,
you can have it as server side code and don't require client side for this; remove the client checkbox and function name
serverResolve();
function serverResolve(){
// get all RITMs for this request and update them to open then mark request state as open
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', current.sys_id);
ritm.query();
while(ritm.next()){
ritm.state = '1';
ritm.update();
}
current.request_state = 'in_process';
current.state = '1';
current.update();
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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
09-09-2019 03:11 AM
Hi,
Action name would be used only when you want use the UI action both client + server
but here only keeping server side code is helping you achieve your requirement
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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
09-09-2019 03:24 AM
I am using the same code with your comments, but still no luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2019 04:41 AM
Hi,
So is RITM getting opened?
Is request getting opened?
What is not happening?
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
09-09-2019 02:54 AM
Hi there,
Besides of the technical aspect, a lot of input is given in this thread already, what about the functional side? I mean, you could reopen a Request, Requested Item. Though, maybe already approvals have been given, tasks have been executed, the workflow already finished.
What about these?
Or should the workflow also be started again, from the start? Or somewhere in the middle?
Technically reopening the Request or Requested Item is a piece of cake. But functionally???
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field