Use of notification email script to fetch variable

Geeta5
Giga Contributor

Hi Team,

I have  a requirement to trigger a notification.

The notification is created on 'Sysapproval_approver' table.

I have to send this notification to a email id which is present in the 'sc_req_item' form. Variable name in sc_req_item is : 'local_procurement'.

So my notification is getting fired based on condition, it is having the RITM number, how I can write email script to get the value of variable 'local_procurement' and pass this via email  script made calling  on sysapproval_approver table to trigger the notification to that email id(local_procurement).

Please suggest.

 

1 ACCEPTED SOLUTION

Hi Geeta,

in workflow you can use wait for timer activity for waiting and then sending email

You can include schedule as well for excluding weekends

If you are stuck inform the issue.

Please consider marking appropriate reply as Correct & 👍Helpful.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

19 REPLIES 19

Hi Geeta,

I don't think from email script you can set the target recipient

Using email script you can set "cc" and "bcc" for email but not the to"

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks for the reply. Yes my requirement is to sent the email in 'TO'.

My notification on 'sysapproval_approver' table is getting fired from flow_designer. In flow designer I can not take table: sc_req_item.

So notification is created on table : sysapproval_approver. From there I have to get the RITM number and then fetch field value 'local_procurement'. Then target notification to this 'local_procurement'(which is a email id).

 

Please suggest

 

 

 

 

Hi Geeta,

then in that case I think you will have to use the workflow approach or BR approach to trigger the email to set the recipient with the variable value

Or please check below link; how to trigger event from flow designer

Ensure you trigger email now based on event

https://community.servicenow.com/community?id=community_article&sys_id=3450a52fdbcf2740afc902d5ca961...

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I tried with flow designer(has i have to check 'wait for certain time period' and this was easy to do via flow) . But I think my requirement will not be possible via flow designer.

So the requirement is as below :

In 'sc_req_item' form for a catalog I have a variable 'local_procurement' which has email id(ex geeta.dhami@test.com).

Once the request is approved, the state is set to 'On-Hold' and Approval as 'Approved'.

I have to design a job/process, that checks if the state is 'On-Hold' for that request, then wait for 2 weekdays(excluding weekend)  and then send a reminder 1 email to 'Local_Procurement' id.

Then again wait for 2 more days(Weekdays) and then check if still the state is 'On-Hold' , then send reminder 2 email to 'Local_procurement' id.

Again wait for 2 more days(weekdays) and check is state is still 'On-Hold', then mark the state for the request as closed incomplete.

Please suggest.

Hi Geeta,

in workflow you can use wait for timer activity for waiting and then sending email

You can include schedule as well for excluding weekends

If you are stuck inform the issue.

Please consider marking appropriate reply as Correct & 👍Helpful.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader