A

Friday, February 24th, 2023 2:10 PM

SetAssetRelationsRequest workflow error while adding mutiple values

I am creating a “Propose Business Term” workflow where I want to use the list of the multiple asset names that I have received from the form to create relations across the business term and those assets.

	assetApi.setAssetRelations(SetAssetRelationsRequest.builder()
	.assetId(assetUuid)
    .relatedAssetIds(reportAttributes)
	.relationDirection(RelationDirection.TO_TARGET)
	.typeId(string2Uuid(reportAttributesRelationTypeUuid))
 	.build()); 

Here “reportAttributes” is the list of the UUIDs for the assets which I need to link with the business term. I am using the workflow designer “Asset” data entry to get this list.


However, this is giving me an error.

    Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.UUID (java.lang.String and java.util.UUID are in module java.base of loader 'bootstrap')

I tried to analyze the situation and found that the format should be something similar to this :

    .relatedAssetIds([string2Uuid("531d2801-e572-43a4-8ea1-7df3fc2a12ec"),string2Uuid("48f8484b-3637-44a2-b9dd-8fba5a6e6f19")]) 

I am not sure on how to convert the “Asset” data entry list to something in this format.


13 Messages

2 years ago

Hi,

You can convert with iterator:
reportAttributes.collect{ string2Uuid(it) }

That worked… Thanks for the reply

Loading...