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

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

I have an existing notification and script include. For my story I am just adding additional functionalities.

I created a new system property(dropOff) and applied the email in the value.

Next I add my script :

 

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

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

    email.addAddress('cc', dropOff);

    email.addAddress('cc', current.EMAIL OF THE USER WHO CREATED REQUEST.email);

}

This should trigger the cc'd when the dropOff value is 1.

Currently I am getting the dropOff cc'd when i check the email logs in the backend.

 

I am not able to figure out how to dynamically cc'd the person who triggers the request.

 

So far ive tried:

current.caller_id.email

current.sys_created_by.email

current.user_name.email

None of the above has work and many has returned 'undefined'

current.requested_for.email

current.send_self.email (after going to the notification table to find out what element was 'send to create')

Can you tell me the table name where the notification is configured for this email script?


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

sysevent_email_action

No. The notification or email is running on which table?

Could you please send a screenshot of the notification where you are calling the email script 


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

I am unable to access the community on that computer. But the table us u_dropoff_request table and where you showed me I could bring over (requested for +)

On my end I am seeing (dropoff +) so I brought that over and created by.

I even tried dot walking by doing email.addAddress('cc', current.dropoff.created_by.email); or email.addAddress('cc', current.dropoff.email); and its not reading.