Add Identity Attribute to Workflow SendEmail Step

It’s saying that there’s no identity variable in the place you’re doing script:identity.getAttribute("team"). Generally, only the name or id of SailPointObjects get passed around workflows, so this seems correct to me that it’d throw that error.

What you could do instead is pull that data inside of the email template like this using the identityName variable that’s already being passed in:

<EmailTemplate name="TestEmail">

  <Body>

#set($spctx=$spTools.class.forName("sailpoint.api.SailPointFactory").getMethod("getFactory", null).invoke(null, null).getCurrentContext())

 

#set($identity=$spctx.getObjectByName($spTools.class.forName("sailpoint.object.Identity"), $identityName))

 

Identity Name from context: ${identity.firstname} ${identity.lastname}

Identity Department from context: ${identity.department}

Users Team: $!{identity.team}

 

  </Body>

  <Description>Email Template</Description>

  <Subject>Test Email Template</Subject>

</EmailTemplate>

https://community.sailpoint.com/t5/Technical-White-Papers/Email-Template-Arguments/ta-p/73115#toc-hId--1482251534

Near the bottom of this page is where it warns against passing objects directly in workflows:

https://community.sailpoint.com/t5/Technical-White-Papers/BSDG-16-Workflow-Step-Bean-Shell-Best-Practices/ta-p/73229

1 Like