Add worknote of sysapproval_approver record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 06:19 AM - edited 02-29-2024 06:46 AM
Hi, I have a workflow where approval group activity was setup.
I need to put short description of group approval record[sysapproval_group] into approval record[sysapproval_approver] comments.
Tried with before insert Business Rule with the below code
(function executeRule(current, previous /*null when async*/ ) {
var grpRec = current.group;
current.comments = "test1 " + grpRec + " end1";
current.comments = "test2 " + grpRec.short_description + " end2";
current.comments = "test3 " + current.state + " end3";
current.update();
})(current, previous);
Output:
I can get the sys_id of the group record[sysapproval_group] but its not fetching thats short_description.
Note: group field is reference
Any guidance please!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 08:14 AM - edited 02-29-2024 08:15 AM
Hi @Aruna Sree Yela
Can you try the below code, I hope this might work for you.
var grpRec = current.group;
current.comments = "test1 " + grpRec + " end1";
current.comments = "test2 " + current.group.short_description + " end2";
current.comments = "test3 " + current.state + " end3";
current.update();
Or if not working just glide to the sysapproval_group table, get the short description value, and use it.
var sd='';
var grpRec = current.group;
current.comments = "test1 " + grpRec + " end1";
var grpApp = new GlideRecord('sysapproval_group');
if(grpApp.get(grpRec)){
sd = grpApp.getValue('short_description');
}
current.comments = "test2 " + sd + " end2";
current.comments = "test3 " + current.state + " end3";
current.update();
Please mark this as helpful and accept it as a solution if this works for you.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 08:23 AM
No luck @_Gaurav
Tried both, but short description was getting blank.
In the below code, I added one comment inside if, but I dint get that on worknote. Maybe its not entering inside that.
var sd = '';
var grpRec = current.group;
current.comments = "test1 " + grpRec + " end1";
var grpApp = new GlideRecord('sysapproval_group');
if (grpApp.get(grpRec)) {
current.comments = "inside if";
sd = grpApp.getValue('short_description');
}
current.comments = "test2 " + sd + " end2";
current.comments = "test3 " + current.state + " end3";
current.update();
Output:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 12:56 AM
@Aruna Sree Yela
Your group is referring to which table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 01:26 AM
Group field referring to - [sysapproval_group] table
Table [sysapproval_approver] is having group field referring to [sysapproval_group].
And both the tables are OOTB