Need to send a notification to the Catalog owner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:14 AM - edited 08-31-2023 05:32 AM
Hi All,
I need to trigger the email notification to the catalog item owner, Currently I have written the code to trigger email notification like this and I am using the schedule job to trigger the notification.
var gr = new GlideRecord('sc_cat_item');
gr.addEncodedQuery('active=true^u_cat_item_owner.active=true^u_cat_item_ownerISNOTEMPTY');
gr.query();
while (gr.next()) {
var owner = gr.u_cat_item_owner;
if (owner) {
gs.eventQueue('Catalog.item.owner.notification', gr, gr.u_cat_item_owner, '');
}
}
It's working fine,
Current notification body,
Hi Scott Bennett,
You have received this email because you are the owner of the catalog item "Report an issue with Checkpoint Marketing".
Please review the form for any of the below points.
But if the catalog item owner having multiple catalog items then I need to send the single email notification to the catalog owner rather then multiple notification.
Thanks in advance
Vinuth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:22 AM
What is the trigger condition of your notification?when a catalog item owner should receive a notifcation?
Are you using business rule for above code?
Thanks,
Manjusha Bangale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:31 AM - edited 08-31-2023 05:36 AM
Hi @manjusha_
I am using schedule job for this one,
var gr = new GlideRecord('sc_cat_item');
gr.addEncodedQuery('active=true^u_cat_item_owner.active=true^u_cat_item_ownerISNOTEMPTY');
gr.query();
while (gr.next()) {
var owner = gr.u_cat_item_owner;
if (owner) {
gs.eventQueue('Catalog.item.owner.notification', gr, gr.u_cat_item_owner, '');
}
}
Thanks,
Vinuth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:37 AM - edited 08-31-2023 05:38 AM
Is there any condition when you want to trigger the notification eg.-catalog item owner is changed or description is changed
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact
Thanks,
Manjusha Bangale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:27 AM
Hi @vinuth v
Add the below query conditions to your script (before gr.Query() line)
gr.orderByDesc('sys_created_on');
gr.setLimit(1);
So, this will pick the latest record and trigger the event.
Please mark it Correct and Hit Like if you find this helpful!