- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2022 02:26 AM
What is the purpose of "Post insert script" in Record Producer ? Can I use it to generate events that can be called from Notification?
Solved! Go to Solution.
- Labels:
-
Instance Configuration

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 08:08 AM
Yes, You can trigger an event based on the field value in the newly created record as well as the variables from the record producer. And all the record producer variables will be saved in the targeted table so you can directly use them from the newly created record itself.
Please find the examples below.
let's assume you have a variable called comments in the record producer if you want to access that Producer variable you will have to simply write as below to access its value
producer.comments
now as you mentioned lets assume in the newly created record if the priority is high and description contains "urgent" you need to trigger an event. for this, you can simply use the current object which is the GlideRecord object of the newly created record. please refer to the below script
if(current.priority == "2" && String(current.description).indexOf('urgent') >-1 ){
gs.eventQueue('your.event.name',current,gs.getUserID().current.number)
// in above line last 2 parameters send as per your need
}
Please mark it as Correct/Helpful If my answer is helpful in any way,
Best regards,
Thameem

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2022 03:21 AM
Hi josephjoechellasundar,
Q1: As its name suggests "Post insert script" is a Script that operates on the submitted record, after the record is inserted in the associated table. Post insert script overrides the target record values and record producer template values.
Q2: Yes, You can use it to generate events to trigger notifications.
Please find the below Screenshot for your reference:
Here I Did 3 things:
Line 1: I generated a info message to show the sys_id of the newly created record.
Line 2: I generated a event to trigger a notification of my choice.
line 3: I have updated the description field.
NOTE.: Here I used current.update to update the value. because its not a business rule. here the current object is just the GlideRecord Object of the inserted record.
Please mark it as helpful/correct If my answer is helpful in any way,
Best regards,
Thameem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2022 08:47 PM
Thanks a lot Thameem for your response. Would I be able to trigger the event based on the attribute value in the created record and also the variable in the record producer ? For an example if the incident priority is high and description field in the case contains "Urgent"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 08:08 AM
Yes, You can trigger an event based on the field value in the newly created record as well as the variables from the record producer. And all the record producer variables will be saved in the targeted table so you can directly use them from the newly created record itself.
Please find the examples below.
let's assume you have a variable called comments in the record producer if you want to access that Producer variable you will have to simply write as below to access its value
producer.comments
now as you mentioned lets assume in the newly created record if the priority is high and description contains "urgent" you need to trigger an event. for this, you can simply use the current object which is the GlideRecord object of the newly created record. please refer to the below script
if(current.priority == "2" && String(current.description).indexOf('urgent') >-1 ){
gs.eventQueue('your.event.name',current,gs.getUserID().current.number)
// in above line last 2 parameters send as per your need
}
Please mark it as Correct/Helpful If my answer is helpful in any way,
Best regards,
Thameem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 04:04 PM