- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2022 04:56 AM
Hi ,
We have a requirement of populating value from workflow to a given field on approval table for managed docs .
From the below workflow run script :
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 05:49 AM
By mistake I have put a quotes while setting the value. You need to remove that:
Modified script below:
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('document_id',current.sys_id);
gr.query();
while(gr.next()){
gr.FIELDNAME = current.number.toString(); // Replace "FIELDNAME " with the one where you want to set on Approver table
gr.update();
}
Try now should work.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 04:51 AM
This is really interesting, as it is working for me.
I would suggest you can connect with me on Linked In and I can look at your code and will assist you which will be quick as well.
Send me a request on below Linked in profile of me:
https://www.linkedin.com/in/shloke-srivastava-13a1b887/
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 06:12 AM
update as this
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval',current.sys_id);
gr.query();
while(gr.next()){
gr.u_managed_document = current.number.toString();
gr.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
02-23-2022 06:23 AM
Hi
Thanks for the response .I have tried this 1 also not working .Is there some other script to be added since that number field is on dms_document table and the wf run on dms_document _revision table .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 06:40 AM
Hi,
okay workflow is on dms_document_revision table
did you check it went inside
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('document_id',current.sys_id);
gr.query();
if(gr.next()){
gs.info("inside");
gr.u_managed_document = current.number.toString();
gr.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
02-23-2022 09:19 AM
Hi
No ,The message is not going inside .