email.addAddress of current user

asher14
Tera Contributor

I am writing a script include.

I am trying to add the Address of the user who created the request.  How do I add the sys_created_by or sys_id email of the person who created the request?

 

if(current.getValue('u_drop_off') == '1' {

    var dropOff = gs.getProperty('Location');

    email.addAddress(dropOff);

    email.addAddress(EMAIL OF THE USER WHO CREATED REQUEST);

}

1 ACCEPTED SOLUTION

If you want to send email to the requester, in the User/Group in fields, you can select the field which holds the user value.

SanjivMeher_0-1671744795848.png

If you want to send email with user in CC, you can use script 

if(current.getValue('u_drop_off') == '1' {

    var dropOff = gs.getProperty('Location');

    email.addAddress('cc',dropOff);

    email.addAddress('cc',current.requested_for.email);

}

 

Can you also confirm, your notification is on sc_request table?


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

18 REPLIES 18

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
Email can be added as below

 

email.addAddress("to", EmailAdress, EmailAdressDisplayValue);
email.addAddress("cc", EmailAdress, EmailAdressDisplayValue);
email.addAddress("bcc", EmailAdress, EmailAdressDisplayValue);

 

 


Thanks and Regards,

Saurabh Gupta

SanjivMeher
Kilo Patron
Kilo Patron

If you are talking about request, you can use current.requested_for.email. You can only add cc,bcc but not in to.

If you want the user to be in to, you can set it from the notification.

 

//email.addAddress(type, address, displayname);
    email.addAddress("cc","john.copy@example.com","John Roberts");
    email.addAddress("bcc","john.secret@example.com","John Roberts");

 

if(current.getValue('u_drop_off') == '1' {

    var dropOff = gs.getProperty('Location');

    email.addAddress('cc',dropOff);

    email.addAddress('cc',current.requested_for.email);

}

 

 


Please mark this response as correct or helpful if it assisted you with your question.

I went to the notification to find the field label "Send to event creator" and it is 'send_self'

 

would it still be email.addAddress('cc',current.requested_for.email);

or email.addAddress('cc',current.send_self.email);

If you want to send email to the requester, in the User/Group in fields, you can select the field which holds the user value.

SanjivMeher_0-1671744795848.png

If you want to send email with user in CC, you can use script 

if(current.getValue('u_drop_off') == '1' {

    var dropOff = gs.getProperty('Location');

    email.addAddress('cc',dropOff);

    email.addAddress('cc',current.requested_for.email);

}

 

Can you also confirm, your notification is on sc_request table?


Please mark this response as correct or helpful if it assisted you with your question.