2 Replies Latest reply on Apr 24, 2019 2:07 AM by eoinbyrne

    How to get workflows linked to a specific configuration attribute

    jacquesperrin Novice

      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

        • 1. Re: How to get workflows linked to a specific configuration attribute
          iiliev Champion
          Community WarriorsVMware Employees

          Hi,

           

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

          • 2. Re: How to get workflows linked to a specific configuration attribute
            eoinbyrne Hot Shot

            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...)

             

             

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

             

             

            The content contains an array of WorkflowItem

             

            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.

             

            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