How to send approval email from workflow to list of email ids who are not part of table

Snehal13
Kilo Sage

How to send approval email from workflow to list of email ids who are not part of table

4 REPLIES 4

Tony Chatfield1
Kilo Patron

Hi, unfortunately your question\requirement is not clear.
If you want to send an approval to a user then the correc \appropriate process would be to add an approval record for the user and trigger an approval, otherwise the user is not part of the approval process and you are just sending a notification which will not result in 'approval'

Snehal13
Kilo Sage

Here is what I have to do - 

 

I have a list of email ids that are nor part of sys user table. I need to send approval email to these people and track their approvals to proceed with request ticket closure.

 

If I understand it correct, you are saying that I need to create an RITM record under the main request and then send email to that person email id who can approve that particular ritm ?

 

Please suggest the steps of how to sent email from workflow to email ids and track back their approvals on the record.

So you're basically trying to send an approval to a user that's not a user in your instance?
That doesn't really work since the approval record is dependent on the user record.
Could you just create a user record for the emails and then continue with the approval process?

If so, then its relatively easy if you have a workflow attached to your record (RITM's usually do).
Open up the workflow and add an "Approval - User" activity to where you want to request approvals at.
Now in the activity you have couple of options. Since these are users you can just add them to the "Users" field.

If however you're using somekind of dynamic list like a property that can be changed, then you would have to click advanced and write a script.

 

var answer = [];
var userList = gs.getPropert("yourpropertyname").split(","); //OR "123,1234,1425,25152".split(","); Just make sure it's a comma separated list of sys_ids with no spaces.
for(var i in userList){
answer.push(userList[i]);
}

 


You could also even create a unique group for these approvals and set the group in the "Groups" field so then you could manage the users by adding or removing them from that group.

If you want all the users to approve before moving forward you'll then just need to modify the "Wait for" field to "Everyone to approve". Otherwise it's usually left to "Anyone to approve" which means that first approval finishes the approval process.


IF you can't create a user record for them, then sure, you could create a custom solution for this, but it would be messy.

@Snehal13 ,

 

For sending the Emails:

you can add the event activity in the workflow and mention your external emails in the eventParams, once the event has triggered you need to catch that event via email notification and you can send the emails,

Please find the link - https://www.servicenow.com/community/developer-forum/email-notification-external-email/m-p/1650328 

 

Once the email has sent, how you will get the approvals as the users are not present in the ServiceNow, I believe in that case you need to handle the scenario with some inbound actions, Once the external user has sent the approval email from their end you need to catch it using inbound action and in the inbound action script you can change the state according to your requirements.

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.