Get Responsibility ID
I am working on a workflow where I need to get the actual ID of a specific responsibility assignment to a specific asset. What is being returned in my groovy script is not what I am looking for - I need the actual ID of that responsibility assignment to the asset.
//This runs but does not return the id of the responsibility to asset
import com.collibra.dgc.core.api.model.instance.Responsibility
import com.collibra.dgc.core.api.dto.instance.responsibility.FindResponsibilitiesRequest
def assetUuid = item.getId()
def reviewers = (FindResponsibilitiesRequest.builder()
.resourceIds([assetUuid])
.roleIds([00000000-0000-0000-0000-000000005032])
.build()
).getRoleIds()
// ).getIds() <— No signature of method
loggerApi.info("Reviewers ----->>>>> "+reviewers)
Results:
Reviewers ----->>>>> [-2586] [authenticated_id=ed31a225-a037-4b8b-8f42-06dcd7d3a0b0, session_hash=11af31666c7aefecd8af48cb60dca83c, ehcache-txid=1866245, trace_id=d22095d1017bfd264018ce55d4994a1b, trace_flags=01, span_id=8f0eb1d91bc8775e]
From API Call Get Responsiblitites:
{
“total”: 1,
“offset”: 0,
“limit”: 1000,
“results”: [
{
“id”: “1451dbb1-f3a2-495c-9edf-daa876bee7a8”,
“createdBy”: “ed31a225-a037-4b8b-8f42-06dcd7d3a0b0”,
“createdOn”: 1633554283482,
“lastModifiedBy”: “ed31a225-a037-4b8b-8f42-06dcd7d3a0b0”,
“lastModifiedOn”: 1633554283483,
“system”: false,
“resourceType”: “Responsibility”,
“role”: {
“id”: “00000000-0000-0000-0000-000000005032”,
“resourceType”: “Role”,
“name”: “Reviewer”
},
“baseResource”: {
“id”: “af8b62c8-b36f-4a58-b399-312bffa78e23”,
“resourceType”: “Asset”
},
“owner”: {
“id”: “65c05982-db23-4af5-bf85-b23c3a10068a”,
“resourceType”: “User”
}
}
]
}
It is that “id”: “1451dbb1-f3a2-495c-9edf-daa876bee7a8”, that I am looking to return in my workflow script. The next step in the script will be to remove that role from the asset, and to do that I need the ID. Any suggestions?
arthurburkhardt
·4 years ago · EditedWhere responsibilitiesIds ==
["1451dbb1-f3a2-495c-9edf-daa876bee7a8"]jennifertemple
OP4 years ago · EditedUnfortunately that did not work either. It seems to be pulling that strange first item in the RoleIDs array from my first attempt. [-2586]
The error is:
arthurburkhardt
·4 years ago · EditedYes, your variable assetUuid contains the value « -2586 », which is not a valid UUID.
jennifertemple
OP4 years ago · EditedMy assetUuid is fine - that is not the issue. The issue is that for some reason the core API is returning that -2586 value as the id for the responsibility to asset relationship, but the Rest core API returns the correct id. I will keep digging. I appreciate your review of this.