Error when trying to Assign Responsibility to An Asset via Workflow
We are working on a workflow to create an asset with associated characteristics and responsibilities. The user fills out a form which collects all the information about the new asset. A business steward approves or rejects the information and then a script task is used to create the asset and the associated characteristics and responsibilities. The workflow is able to create the asset, and any attributes and relations provided. However, when it attempts to assign the responsibility, we are getting the following error:
“The specified member has no resource specified and the given role is not global”. What is the remedy in this case? We are trying to assign existing users to the “Business Steward” role. Even if we tried to hard code the IDs, we are getting the same error. See below for an example:
responsibilityApi.addResponsibility(AddResponsibilityRequest.builder()
.resourceId(asset.getId())
.roleId(string2Uuid("00000000-0000-0000-0000-000000005016"))
.ownerId(string2Uuid("d717dba5-93bf-433e-98ec-ba2915f881ff"))
.build()
);
prasanthiramaswamy
·2 years ago · EditedHi, may I please check, how did you define the resource type? Is it something like this:
.resourceType(‘Asset’)
How do I find the asset type?
ravi
·2 years ago · EditedHi @prasanthi.r.ramaswamy.pwc.com,
You can use this : .resourceType(item.getType())
Regards,
Ravi Saraswat
prasanthiramaswamy
·2 years ago · EditedThis works, Thank you so much @ravi_collibra!
huongtran_thu
·2 years agoHi @ravi, I got the same error. After adding resourceType(), It's still error. Could you help to check my script task as below:
import com.collibra.dgc.core.api.dto.instance.responsibility.AddResponsibilityRequest
import com.collibra.dgc.core.api.dto.user.FindUsersRequest
//Add N-1 as Stake holder role
STAKEHOLDER_ROLE_ID = string2Uuid("00000000-0000-0000-0000-000000005018")
def stakeholder = execution.getVariable("yourN1HeadOfDepartment");
responsibilityApi.addResponsibility(AddResponsibilityRequest.builder()
.ownerId(string2Uuid(stakeholder))
.resourceId(item.id)
.roleId(STAKEHOLDER_ROLE_ID)
.resourceType(item.getType())
.build())
Andrea Nicole Manalo
·1 year ago@prasanthiramaswamy Hi! Mine is not working I also use .resourceType(item.getType()) responsibilityApi.addResponsibility(AddResponsibilityRequest.builder()
.resourceId(assetUuid)
.roleId(techSMEUuid)
.ownerId(techSME)
.resourceType(item.getType())
.build())
Can you help me, what's missing/wrong with my script? Thank you!
Sadad Talhouni
OP3 years ago · EditedThank you @stefan.busch this resolved the issue!
stefan_busch
·3 years ago · EditedHi,
I think you need to also give the resource type (asset, domain, community) to the ResponsibilityRequest (you can do this with .resourceType(resourceType)). Consult the documentation for the right value that you need.