KBEC-00403 - Dynamically pass in user's email address

Summary

This article will describe how you can pass in a user's email by referencing it as a property.

Solution

If your system is set up with LDAP/AD to pass over the email information for your users or a local user with the email address field filled in, then you should be able to reference the user's email as follows $[/users/<username>/email] as shown in this example:

C:\Users\ecloud>ectool getUser test
<response requestId="1" nodeId="192.0.0.1">
    <user>
      <userId>0058d8d7-5af5-11e8-bfc7-525400100b82</userId>
      <userName>test</userName>
      <createTime>2018-05-18T23:41:35.368Z</createTime>
      <email>tester@electric-cloud.com</email>
      <fullUserName>tester</fullUserName>
      <lastModifiedBy>ecloud</lastModifiedBy>
      <modifyTime>2018-05-18T23:41:35.368Z</modifyTime>
      <mutable>1</mutable>
      <owner>ecloud</owner>
      <propertySheetId>0058ffe9-5af5-11e8-bfc7-525400100b82</propertySheetId>
      <providerName>Local</providerName>
      <registered>1</registered>
    </user>
  </response>

C:\Users\ecloud>ectool getProperty /users/test/email
tester@electric-cloud.com

You can dynamically reference the property so that the user who runs the job is the user whose email is passed in by using $[/users/$[/myJob/launchedByUser]/email].

Have more questions? Submit a request

Comments

Powered by Zendesk