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>
Near the bottom of this page is where it warns against passing objects directly in workflows: