Email notification should trigger when add comments changed

dmahendran
Tera Contributor

Hello Folks,

 

Good Day!
I was stucked with a requirement, when someone entered any value in the additional comments in catalog task i need send an email notification with the details what they have been entered.

Tried with Notifications and BR's can achieve this one..

I will desperately need someone to assist me in this issue..

Any assistance would be appreciated!!!

10 REPLIES 10

Rajesh Chopade1
Mega Sage

Hi @dmahendran 

 

Yes you can achieve this by using Business Rules (BRs) and Email Notifications. Could you please share what you have did with us so we can help you accordingly or you can refer bellow steps:

 

- You need to create a Business Rule that will be triggered when someone enters or modifies a value in the Additional Comments field.

- Table -> sc_task (or your specific catalog task table)

- After Insert & Update

- Condition -> current.comments.changes() && current.comments != ''

 

Scirpt :

// Check if a comment has been added
if (current.comments.changes()) {
    var gr = new GlideRecord('sys_email');
    gr.initialize();
    gr.type = 'send-ready';  // The email will be processed as a send-ready email
    gr.subject = 'New Comment on Catalog Task';
    gr.body = 'A new comment has been added: ' + current.comments;
    gr.recipients = current.requested_for.email;
    gr.insert();  // This will trigger the email to be sent
}

 

I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.

thank you

Rajesh

dmahendran
Tera Contributor

@Rajesh Chopade1    Thanks for your response.

Still the issue persists, i cant able to get the value which i have been entered in the catalog task additional comments. Have attached my snip below.

Anand Kumar P
Giga Patron
Giga Patron

Hi @dmahendran ,

 

 1)Create an Event in Event Registry.

Event Name: ctl.comments_sctask.notification

Table: sc_task

 

2)Create a Business Rule on table -sc_task

When: After insert

condition:

current.comments.changes() && current.comments != ''

  Script :     gs.eventQueue('ctl.comments_sctask.notification',current , current.comments);

    }

 

 

 

 

3)Create new Email notification

Table: sc_task

When to send: Select “Event is fired.”

Who will receive : requested for

Event Name: ctl.comments_sctask.notificatioN

 

A new comment has been added to your catalog task: ${number}

 

Comment:

${event.param1}

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

 

 

dmahendran
Tera Contributor

@Anand Kumar P  Ty for your kind response!!
Still I'm not able to see the additional comments, also there were no email triggers when i update the additional comments.