Send mail to Delegates

subramani
Mega Contributor

Hi All,

Can anyone create an email notification to delegates when he is added as delegate.

The mail should only contain the fields which are checked(true).

Fields in delegate tables are:

Approval,

Assignment,

CC Notification,

Meeting Invitation.

Thanks,

Subramani

shloke04harishkumar

10 REPLIES 10

Alikutty A
Tera Sage

Email notifications are automatically send to the delegate once you have set them up, you dont need to create a new one.



Notifications will be send unless the delegates are excluded


find_real_file.png



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


AbdulAzeez
Mega Guru

Hello Subramani,



I request you to please go through below links which help me you in sorting your delegate email issue.



Approver delegate emails



Delegation - Approvals different types



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response



Abdul Azeez


oharel
Kilo Sage

I think what you need is this:


Create a new notification:


Table: delegate [sys_user_delegate]


When to send: Record inserted or updated: Inserted


Who will receive: Users/groups in fields: delegate


What it will contain:


In Message HTML:


Hi,


You are now a delegate of User: ${user}


You can now:


${mail_script:notify_delegate}


thanks...



Then create a Notification Email Script:


(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


                  /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


                  /* Optional GlideRecord */ event) {



                  // Add your code here


//this part will check if the items are checked and add them to the mail if they are


  if(current.approvals == true)


  template.print('Approvals: true' + '<br \>');


  if(current.assignments == true)


  template.print('Assignments: true' + '<br \>');


  if(current.notifications == true)


  template.print('Notifications: true' + '<br \>');


  if(current.invitations == true)


  template.print('Invitations: true' + '<br \>');


})(current, template, email, email_action, event);


You can add to the email itslef the start and end dates, for example...


harel


Please mark as correct or helpful based on impact


Priya72
Kilo Contributor

Hi I tried the above script but it doesnot seems to be working. Can you please suggest what wrong I am doing. 

 

Message HTML:

Hi ${delegate.first_name},

You have been set as a delegate of ${user}. Please find the details below.

Delegation starts: ${starts}

Delegation ends: ${ends}

Delegation for:

${mail_script: approval_delegate_cc}

 

Email Script:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {

//this part will check if the items are checked and add them to the mail if they are
if (current.approvals == true)
template.print('Approvals: true' + '<br \>');
if (current.assignments == true)
template.print('Assignments: true' + '<br \>');
if (current.notifications == true)
template.print('Notifications: true' + '<br \>');
if (current.invitations == true)
template.print('Invitations: true' + '<br \>');

})(current, template, email, email_action, event);