
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 03:34 AM
More of a general question, but I was wondering what could be set with answer.push() in a Workflow approval script, beyond setting the approver.
For example if I wanted to push the approver and say comments or update the iteration field how would I go about that?
Example code below for reference:
answer =[];
var Approver = "";
var comments = "Hello World";
var grUser =new GlideRecord('sys_user');
grUser.addQuery('sys_id', '435453rr3454we544rrw'); //random text
grUser.addQuery('active',true);
grUser.query();
if(grUser.next()){
Approver = grUser.sys_id;
}
answer.push(Approver)
----------------------------------------------
So the above would push/ set the user as an approver, but how would I push / set the comments as well on the created approval record?
I've tried A GlideAjax on the sysapproval_approver table afterwards, but I get the feeling this isn't possible in the same Approval activity as (I'm guessing) its (the approval request) not been created yet.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 03:51 AM - edited 10-26-2022 03:55 AM
Hi @Markell ,
In Approval activity of workflow, 'answer' is a variable defined out of the box. You can user this variable in below two ways :
1. You can use answer as a string variable and populate it with comma separated user/group sys_id.
Example: answer = "8c2c91d7876a191052014087cebb35bc,0fe6bc82bf0221000ba9dc2ecf073987" //Here answer will be treated as string
OR
2. You can use answer as an array, stroring user/group sys_ids. Below the example:
answer = []; //Here answer will be treated as an array
answer.push('sysID');
.
.
.
answer.push('sysID');
So logically also it's not meaningful to store anything else.
I Hope this helps.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 03:51 AM - edited 10-26-2022 03:55 AM
Hi @Markell ,
In Approval activity of workflow, 'answer' is a variable defined out of the box. You can user this variable in below two ways :
1. You can use answer as a string variable and populate it with comma separated user/group sys_id.
Example: answer = "8c2c91d7876a191052014087cebb35bc,0fe6bc82bf0221000ba9dc2ecf073987" //Here answer will be treated as string
OR
2. You can use answer as an array, stroring user/group sys_ids. Below the example:
answer = []; //Here answer will be treated as an array
answer.push('sysID');
.
.
.
answer.push('sysID');
So logically also it's not meaningful to store anything else.
I Hope this helps.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 04:35 AM
Thanks Kamlesh
I will mark your response as accepted solution, but in your experience is there a way to set additional fields upon setting the new approval request? e.g updating the comments as mentioned?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 12:43 AM
Hi @Markell,
You can do such things using a BR on Approval table specifying proper condition like what will be source table and use Approving field to get relevant information from the related record, and set the additional fields:
I Hope this helps.
Please mark this helpful if this helps
Regards,
Kamlesh