VMware Cloud Community
jacquesperrin
Enthusiast
Enthusiast

How to get workflows linked to a specific configuration attribute

Hi all

I would like to build a workflow to find all workflows linked to a specific configuration attribute, I know that I can use the "Find elements that use this element" but it list all workflows using the configuration element (not a specific attribute).

I though that vRO show this information in the properties of the "workflow.attributes", but it's not the case, by REST API, I didn't see anything on the workflow attributes (only on input/output).

Does exists another trick to do get this information ?

Thanks

Reply
0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee

Hi,

No, this information is not exposed in the API (scripting or REST).

Reply
0 Kudos
eoinbyrne
Expert
Expert

Looking at the Swagger doc there MAY be a way to do this against the REST API. Given that the attribute is only referenced by name within the configuration element there might be a few legs to do this and then you might still NOT have any guarantee that you found all references. I say this as in my experience there are a few ways to access the content of a ConfigurationElement in vRO, e.g.,

Referenced as a Global attribute on the Workflow Attributes

Passed as an input to the workflow from another workflow/action

Scripted retrieval within a script block (i.e., using Server.getConfigurationElementWithPath())

This means that to do what you want here may not be 100% reliable for all cases

Anyway, if I was determined to try this I would do as follows....

1. You'd need the ID of the configuration element you want to check

2. The name of the attribute within the element that you're specifically looking for

First, you would  use the REST API to load the content of each workflow using this API call (brute forcing is the only way...)

pastedImage_2.png

Then, for each workflow ID use this call to the content

pastedImage_3.png

The content contains an array of WorkflowItem

pastedImage_4.png

Each WorkflowItem has a script member which will contain the JS code for the script. You would then need to Regex match on this for the name of the attribute you're looking for (or perhaps something like the expression "getAttributeWithKey(" + attribName + ")" )

You could also check within the Attrib member for the ID of the configuration element here if you wanted

You would probably then want to repeat the above but for the Action scripts BUT using the Action class built into vRO's default objects (Intrinsics classes) to get the script content.

pastedImage_6.png

Again, once you have the script you can run the Regex to check

Lastly, for completeness, you'd need to do a scan of all ConfigurationElements (excluding your target one) in case one of those references your chosen entry...

Like I said, long-winded but mostly doable....

HTH

Reply
0 Kudos