Hi,
Using an Orchestrator workflow, I can set an icon on a vRA catalog Service, or on a vRA Catalog Item.
However, I can't figure out how to set an icon on a vRA Resource Action using a vRO workflow...
Is this possible? Has anyone done this before?
Many thanks!
Ed
I have found out that I need to setup an item service first, something like for example:
itemsvc = vCACHost.createCatalogClient().getCatalogProviderResourceActionService();
Next, I need to find my resource action, that I want to assign an icon to. I can do this using something like for example:
var resOps = Server.findAllForType("vCACCAFE:catalogConsumerResourceService","My Resource Action");
// select my resource action into: myResOp
or
var resOps = itemsvc.findResourceActions();
// loop through and find "My Resource Action"
// select my resource action into: myResOp
Then, if I found my resource action (and after setting up my icon), I need to update my resource action with the new icon, with a call such as:
itemsvc.createOrUpdateResourceAction(myResOp);
Clearly, there are a lot of 'variables' in the above logic and I am not able to find the "winning combination"! :-{
Any feedback appreciated.
Thanks,
Ed
This is how i did it, hope this helps someone.
//Inputs:
//iconId: String - Unique Icon Id
//ResourceActionName: String - Resource Action Name
//find your resource action
var vCACCatalogResourceActions = Server.findAllForType("vCACCAFE:catalogResourceAction",ResourceActionName);
if (vCACCatalogResourceActions.length > 0)
{
//find host for tenant
var tenantId = vCACCatalogResourceActions[0].organization.getTenantRef();
var host = vCACCAFEHostManager.getDefaultHostForTenant(tenantId);
//create catalog client
var catalogClient = host.createCatalogClient();
//build put call json
var postData = {"iconId":iconId, "publishStatus":"PUBLISHED"};
//make put call to resource url
var response = catalogClient.put("/resourceOperations/"+vCACCatalogResourceActions[0].id,postData);
if (response.getStatus() != 200)
throw "Failed updating resource operation: "+response.getBodyAsString();
System.log("Resource operation updated successfully")
}
else
throw "Resource Action not found"+ResourceActionName;