The CreatorCon Call for Content is officially open! Get started here.

Need to send a notification to the Catalog owner

vinuth v
Tera Expert

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

19 REPLIES 19

manjusha_
Kilo Sage

@vinuth v 

 

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

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

@vinuth v 

 

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

Karthiga S
Kilo Sage

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!