Email Responsibilities in correct domain once the term is moved
Hi.
I have a simple workflow that creates a business term and moves the term to the domain that it is supposed to go to. My issue currently is that once placed, I need the email to send out to the responsibilities of the domain where the term was placed. I have the cod set up send the email out i’m just not sure how to get the domain to find the responsibilities to send the emails to.Any input would be appreciated.See screenshots below for guidance.Code is below as well.
Thanks,
Jamar Johnson
`def usersIds =
users.getUserIds(“role(Requester)”);
if (usersIds.isEmpty()){
loggerApi.warn(“No users to send a mail to, no mail will be send”);
} else {
mail.sendMails(usersIds, “PBT001_requesterConfirmation”, null, execution);
}
`
Former User
Posted 5 years ago · Edited 1 year ago·Last reply 5 years ago
5 comments
georgecheung
·5 years ago · EditedIf the requester is the current user, the user who requested the asset, in order to get their user’s id for email, then you can use :
def usersIds = [userApi.getCurrentUser().get().getId()]mail.sendMails(usersIds, "PBT001_requesterConfirmation", null, execution);For the Data Governance Team notifications, you would need to find the individual user ids of the users who occupy that role or are in that group. If it is a role, then this can be done using the responsibilityApi and userGroupApi if it is a group. The other option is to convert this Data Governance Team to a candidate user expression and use the userbean with
users.getUserIds()to get the individual user ids.adityapawar
·5 years ago · EditedHi @jamar.johnson
You have to update user expression
def usersIds =users.getUserIds(“role(Requester)”);
in above line as mentioned by @arthur.burkhardt
role(; ; )
Your workflow is global so you need to provide additional details like from which domain you need to retrieve responsibilities
Former User
OP5 years ago · Edited@arthur.burkhardt @aditya.pawar Currently, we want the roles retrieved on the asset once it is created.I currently have a requester that is added onto the asset once created in the New Business Terms domain.It is not picking up the requester added with the regular code.Do we still have to specify the domain of the role on the newly created asset for the emails to send?Shouldn’t it just be able to pick up the role of requester on the asset level?I just want to confirm.
.
Former User
OP5 years ago · EditedQuestion. When an asset is moved or created in a workflow, if we are are trying to send emails to notify a role of an asset created in the domain it was created/added in, is it required that we specify the role with the community and domain to send the email to the correct role in the correct domain?
Currently, the emails are not resolving to a user with just the code I posted above earlier.
arthurburkhardt
·5 years ago · EditedWell, just use the same thing you’re doing for the requester: the responsibilities or automatically inherited from the community, domain.
If you want to be more restrictive and ONLY retrieve responsibilities from the domain, you can use the syntax
role(<roleName>; <communityName>; <vocabularyName>)https://developer.collibra.com/workflows/workflow-documentation/#Workflows/ExecutionLogic/co_candidate-user-expressions.htm
Also possible to use the responsibilityApi for that.