Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Emai Templates - supported methods to pull user info using variables

Miha
New Contributor III
New Contributor III

Hello,

We want to send an email notification to admin team which contains the new joiner information.

We are storing in User's customproperty56 the HRBP id (for all users).

The HRBP id is the username of a different user in the Users table.

In the email template, we want to include the firstname and lastname of the HRBP user.

We tried adding this method in the email template to pull the firstname of the HRBP (which is stored in customproperty56):

HRBP: ${com.saviynt.ecm.identitywarehouse.domain.Users.get(user?.customproperty56)?.firstname}

but the result is null. The firstname of our HRBP test user exists, is not null, however, in the email notification it says null.

Miha_0-1719834827301.png

Any ideas how we can achieve this?

Thank you,

16 REPLIES 16

rushikeshvartak
All-Star
All-Star
  • Where is email template attached ?
  • email is triggered on which action ?
  • Please validate supported variables.

    Purpose :

    To get what variables are present to use in the email template.

    Email Template steps :

    keep Advanced HTML CSS flag is checked

    Keep your email Address in TO

    TO /CC/BCC & Subject - Don't use any dynamic variables

    Add only below code in Email Body
    ${this.binding.variables.each {k,v -> println "$k = $v" + "" + "br" + ">"}}

    Output : using the below expression. By putting it in the email body, it will print all variable names with values, and then accordingly, you can use it:


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Miha
New Contributor III
New Contributor III

Hello,

The email template will be attached in the endpoint:

  • Task type=new account
  • Email Actions=Task Complete

However, right now, this is not relevant, since we are currently testing it, we trigger the email notification through a user update rule (when a customproperty is updated, then send this email notification).

The Advanced HTML/CSS flag i checked:

Miha_0-1719841010115.png

In the TO we have dynamic attributes.

We just want to know if it is possible to pull the firstname and lastname of a user, based on the username that is stored in a customproperty of another user.

Example:

  • User A
    • Firstname=AA1
    • Lastname=AA2
    • Customproperty56=B
  • User B
    • Firstname=BB1
    • Lastname=BB2

I want to pull the firstname of user B in the email template, based on user A's customproperty56. Is this supported? If yes, could you provide an example of code that would work?

Below is the code that we used. The email notification is sent successfully, but the HRBP firstname is null in the email. In reality, in Saviynt, the firstname of the HRBP is not null.

HRBP: ${com.saviynt.ecm.identitywarehouse.domain.Users.get(user?.customproperty56)?.firstname}

Thank you,

Mihaela

Email template attached on UUR vs Endpoint level will behave differently.

did you tried hardcoding cp56


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Miha
New Contributor III
New Contributor III

I tried hardcoding the cp56 in the email template, but in the email notification the firstname is still null.

HRBP: ${com.saviynt.ecm.identitywarehouse.domain.Users.get(10001234)?.firstname}

 

Miha_0-1719844192597.png

 

I also tried replacing customproperty56 with manger in my line of code. And it works fine, so there is clearly an issue with that customproperty56 😞 

HRBP: ${com.saviynt.ecm.identitywarehouse.domain.Users.get(user?.manager)?.firstname}

Miha_1-1719844222003.png

It is not supported to retrieve an attribute value such as firstname directly in the email template, based on a username stored in a customproperty?

 

if its string then it should be quoted 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Miha
New Contributor III
New Contributor III

I tried again and quoted the username. I tried both single and double quotes. I still got null value in the email:

HRBP: ${com.saviynt.ecm.identitywarehouse.domain.Users.get('10001234')?.firstname}

 

Miha_0-1719846408772.png

 

Miha
New Contributor III
New Contributor III

Hello,

Any updates on this?

Can I please get a confirmation whether the operation of pulling user data based on another user's customproperty is supported in the email templates as per the scenarion described below? If not supported, we need to find a workaround but would help a lot to have a confirmation.

Example:

  • User A
    • Firstname=AA1
    • Lastname=AA2
    • Customproperty56=B
  • User B
    • Firstname=BB1
    • Lastname=BB2

I want to pull the firstname of user B in the email template, based on user A's customproperty56.

Thank you,

NM
Valued Contributor
Valued Contributor

Hi @Miha , where you hard-coded the username to get first name and last name try hardcoding userkey once.

${com.saviynt.ecm.identitywarehouse.domain.Users.get(userkey of B user)?.firstname

Miha
New Contributor III
New Contributor III

Hey @NM ,

Thanks for the suggestion! Hardcoded userkey works 🙂 (line of code: ${com.saviynt.ecm.identitywarehouse.domain.Users.get("11")?.firstname} 

But is there any way to retrieve the userkey dynamically?

Would something like below line work?

${com.saviynt.ecm.identitywarehouse.domain.Users.get(user?.userkey)?.firstname}

Thank you!

NM
Valued Contributor
Valued Contributor

@Miha Try user?.customproperty?.userkey

rushikeshvartak_0-1719933366110.png

${com.saviynt.ecm.identitywarehouse.domain.Users.get(users?.owner)?.firstname}

 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Miha
New Contributor III
New Contributor III

@NM @rushikeshvartak  Yes, unfortunately, user?.customproperty?.userkey does not work 😞

@rushikeshvartak  I cannot use owner not manager because the username specified in my user's customproperty56 is not the owner, not the manager. Is something else, the HR BP.

NM
Valued Contributor
Valued Contributor

@Miha , did you mention the customproperty number??

user?.customproperty(number of customproperty)?.userkey

rushikeshvartak_0-1719940974938.png

${com.saviynt.ecm.identitywarehouse.domain.Users.get(user?.customproperty65?.userkey)?.firstname}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Miha
New Contributor III
New Contributor III

Yep, I mentioned the CP number (customproperty56), but unfortunately it is not working 😞

NM
Valued Contributor
Valued Contributor

@Miha What I can think of store userkey in custom property using inline preprocessor