- 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
02-25-2022 07:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2022 09:17 AM
Not an issue. Let us debug this becuase the script looks correct to me unless something else might be making it not to work:
Can you put some logs as shown below and let me know what is coming in these log statements:
var getDocument = current.document.number.toString(); // This will give you the Document Number as you need
gs.info(Document Number is '+ getDocument);
var gr = new GlideRecord('sysapproval_approver);
gr.addQuery('document_id',current.sys_id);
gr.query();
while(gr.next()){
gs.info(Approval Record are '+ gr.sys_id);
gr.u_managed_document = getDocument; // Replace "u_manage_document" with the field on Approval table where you need to update Document Number
gs.info(Managed Document number are '+ gr.u_managed_document);
gr.update();
}
gs.info(Updated Managed Document number are '+ gr.u_managed_document);
Please test with these 4 different log statement and tell me what you are getting in these 4 statements.
Please share screenshot as well for these 4 statement
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-28-2022 02:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 11:36 PM
Hi
There were other two info statement in the script above? Did you check what are we getting in the statements below:
gs.info(Approval Record are '+ gr.sys_id);
gs.info(Managed Document number are '+ gr.u_managed_document);
Let me know what you are getting in these log statements.
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 03:15 AM
Ya