Need to send a notification to the Catalog item owner

vinuth v
Tera Expert

Hi All,

 

Weekly once I need to send a email notification to the catalog item owner. 

For Every catalog item and Record producer, need to send email notification to the catalog item owner. 

 

vinuthv_0-1692614846109.png

 

 

Please any one suggest me how to procced this one,

 

Thanks in advance,

Vinuth

 

 

5 REPLIES 5

Sandeep Rajput
Tera Patron
Tera Patron

You can plan to create a scheduled job which will run every week, in schedule job script, you can query sc_cat_item table and apply a check owner!=NULL.

 

In the next step, create an event in the event registry.

 

In the third step create a notification which will be triggered via the event created in step 2.

 

Go back to scheduled job script defined in step 1 and add the following line.

gs.eventQueue('<event name>',gr,gr.owner.email+'','');

 

Here replace event name with the name of your event created in step 2. Also, replace gr with the glide record object using which you are querying the sc_cat_item table.

 

Hope this helps.

 

Karthiga S
Kilo Sage

Hi @vinuth v 


To send a weekly email notification to the catalog item owner for every catalog item and record producer, you can follow these steps:

1. Create a Scheduled Job:
- Navigate to System Definition > Scheduled Jobs.
- Click New to create a new scheduled job.
- Fill in the necessary fields such as Name, Description, Run, and Next action.
- In the Script field, you will write the script to fetch the catalog items and record producers and send the email.

 

2. Script to fetch Catalog Items and Record Producers:
- Use GlideRecord to query the sc_cat_item table which holds both catalog items and record producers.
- Loop through each record and fetch the owner.

 

3. Send Email Notification:
- Use the gs.eventQueue() method to send an email.
- The first parameter is the name of the email notification.
- The second parameter is the current record.
- The third parameter is the recipient (owner of the catalog item or record producer).
- The fourth parameter is additional comments or information.

var gr = new GlideRecord('sc_cat_item');
gr.query();
while (gr.next()) {
var owner = gr.owner; // Replace with owner field name
if (owner) {
gs.eventQueue('your.email.notification', gr, owner, 'Weekly notification for catalog item/record producer owner');
}
}


4. Set the Job Schedule:
- In the When to run section, set the job to run weekly.

 

Remember to replace 'your.email.notification' with the actual name of your email notification. Also, ensure that the email notification is properly configured to use the parameters passed from the script.

 

Please mark it Correct and Hit Like if you find this helpful!

 

Regards,

Karthiga

vinuth v
Tera Expert

Hi @Karthiga S 

1. First I have created the Event registration like 

vinuthv_0-1692619354803.png

 

2. I have created the Notification 

vinuthv_1-1692619453030.png

 

vinuthv_2-1692619493763.png

 

vinuthv_3-1692619525503.png

Note: This is the sample body I have created and need to update correct body here.

 

3. I have created the schedule job like this

vinuthv_4-1692619648223.png

vinuthv_5-1692619668864.png

 

 

I clicked on the "Execute Now" button and checked in the emails using subject (Please catalog item owner look into this item)

 

But it's not working as expected,

 

Please suggest me where I have done the mistake

 

Thanks,

Vinuth

 

Hi @vinuth v 

 

  1. Please make sure you have at least one catalog item owner.
  2. Also, check if the catalog item owner's email is enabled in his user profile.
  3. Check if the event is triggered and have the right params in the event logs.
  4. Add yourself in the loop to test the scenario.

Please mark it Correct and Hit Like if you find this helpful!

 

Regards,

Karthiga