Is it possible to retrieve the email address of the workflow initiator from an SDK script? I thought maybe there would be something to do with the UserInfo class, but there's nothing to do with email within that class.
Question
Question
Replies
Depending on how your user records are set-up, you may be able to get it with standard Workflow activities.
Try the "Find User" activity, with the option to search for a user from a token. There are two standard tokens %(Initiator) and %(Initiator SID), which match to the "Find User" activity's Account Name and ID options respectively.
Hi Matthew,
Thanks for the quick response. The Find User activity does work for what I am trying to do (and in fact that's what I used instead of retrieving the email through the script.) I was just wondering if it's also retrievable through an SDK script out of curiosity.
Thanks,
For LF users, it's a user attribute, [Workflow]E-mail or [Forms]E-mail, depending on how it was set. Find User looks at both.
For AD users, you'd have to read the user properties from AD, so that would be out of scope for the LF SDK.
Thanks, Miruna. I'm not sure if it's ideal, but I was able to get it to work with this code:
SecurityIdentifier s = new SecurityIdentifier(GetTokenValue("Initiator SID").ToString()); var reference = new AccountReference(s,this.RASession); TrusteeAttributeCollection attributes = Trustee.GetAttributes(reference,this.RASession); string email; attributes.TryGetValue("[Workflow]E-mail",out email); SetTokenValue("Initiator Email",email);