Need to get the value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 02:26 AM
Hello Community,
I am getting the sys_id in the approval field, though it has referenced to sysapproval_approver table.
Could anybody help to get the value instead of sys_id.
Below is the script, I am using ; -
- 512 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 02:56 AM
USe this
(function executeRule(current, previous /*null when async*/ ) {
// check if the state is being set to reffered back
var count = current.u_rejected_count;
if (current.state == 'rejected' && previous.state != 'rejected') {
current.u_rejected_count = count + 1;
var gr = new GlideRecord('u_m2m');
gr.addQuery('u_approval', current.sys_id);
gr.query();
if (gr.next()) {
gr.u_refer_back_code=current.u_refer_back_code;
gr.u_reason_refer_back=current.u_refer_back_reason;
gr.u_refer_back_count = current.u_rejected_count;
gr.update();
} else {
var gr1 = new GlideRecord('u_m2m');
gr1.initialize();
gr1.u_approval = current.sysapproval.getDisplayValue();
gr1.u_approval_for = current.document_id.getDisplayValue();
gr1.u_refer_back_code=current.u_refer_back_code;
gr1.u_reason_refer_back=current.u_refer_back_reason;
gr1.u_refer_back_count = current.u_rejected_count;
gr1.insert();
}
}
current.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 03:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 03:10 AM - edited 07-10-2024 03:15 AM
Can you pls specify what do you want in u_approval field ( Approver name or Change Request number?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 03:14 AM
Hello @Sanjana8 ,
As per the attached screenshot, I have highlighted the value which I want to populate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 03:21 AM