- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 11:07 AM
Need help for below requirement..
i have configured the below workflow.
there are 4 levels of approvals
the approvals at any stage if approval rejected ... the requestor and the previous approvers need to get notification.
for this i created an event and add the activity and added Run script.
my notification itself is not working.
Please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 11:55 PM - edited 09-04-2023 11:59 PM
you can push multiple approvers by using answer.push like below. Suppose say you want to send the notification to requester's manager and requester manager's manager, you can use below.
answer = [];
answer.push(current.variables.requestor.manager);
answer.push(current.variables.requestor.manager.manager);
In this case, the notification will be sent to requester's manager and requester manager's manager.
Also, you can directly dot walk in the TO of the notification like below.
Highlighted are the two ways you can achieve this.
Mark this answer as correct and helpful if it solves your issue.
Regards,
Siva Jyothi M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 01:10 PM
Hi, unfortunately your post has no clear details of your configuration or code and this means the community cannot assess your issue. Perhaps you can update this thread with details of your scrip, in plain text - I would think an after update BR on sysapproval_approver table would be the most appropriate way to trigger? and also details of your notification configuration, so that these can be reviewed\evaluated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 08:02 PM - edited 09-04-2023 08:12 PM
the below is the script i added in my work flow activity Runscript and added workflow activity Create event. still the previous approvers are not adding . where did i am doing wrong???
var ans='';
var grApp=new GlideRecord('sysapproval_approver');
grApp.addEncodedQuery('sysapproval='+current.sys_id);
grApp.query();
while(grApp.next()){
ans=grApp.approver+',';
}
gs.eventQueue('x_dev0777_e.reject',current,ans);
i tried
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 08:29 PM - edited 09-04-2023 08:30 PM
Hi @Are Kaveri,
Directly you can use the notification activity in the workflow and in the advanced section of the notification write the below script and push the approver.
answer = [];
answer.push(current.variables.approver); //replace approver field with the correct field
And in the To of the notification, you can directly add the Requested for. You can fill the subject and message according to your requirement.
Mark this answer as correct and helpful if it solves your issue.
Regards,
Siva Jyothi M .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 10:35 PM
@Siva Jyothi M my problem is i have 4 levels of approvals.
level-1 Requestor
level-2 Requestor manager
level-3 Requestor manager manager
level-4 Requestor department head
so in level2 if the Requestor manager rejects the approval , then Requestor and Requestor manager should be notified
in level 3 if requestor manager manager rejects the approval , then Requestor, Requestor manager and Requestor manager manager should be notified.
thats why i went for Run script for copying previous approvers.
But my script was not working as expected throwing error