VMware Cloud Community
rsilar
Contributor
Contributor
Jump to solution

Find action references with a workflow

I am trying to find action references with a workflow, but have no success in linking action ID with anything else.

I want to get a similar output as right clicking an action and selecting 'References->Find elements that use this element'.

So is there a way to list all actions used in a workflow or just plain listing all the elements that use a specific action?

I've searched through Action and Workflow objects with no success.

Thanks in advance,

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Actions are not referenced by their IDs when used eg. in workflows, but by action's module name and action name. For example, here is how the invocation of vim3WaitTaskEnd action from workflow Create simple virtual machine looks like:

actionResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task,progress,pollRate) ;

So if you want to search for usages of an action in other elements, you have two options:

1) Use some kind of Javascript parser to parse the code where you want to look, build an AST, and locate the nodes representing the action call, or

2) Use a simple string/pattern matching

Both approaches has their pros and cons (mostly cons, unfortunately).

View solution in original post

3 Replies
rsilar
Contributor
Contributor
Jump to solution

My use case is - our environment has a few 100 actions in which a lot of them have become deprecated.

Finding them by hand and deleting them is a very time-consuming task and we want to automate it.

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Actions are not referenced by their IDs when used eg. in workflows, but by action's module name and action name. For example, here is how the invocation of vim3WaitTaskEnd action from workflow Create simple virtual machine looks like:

actionResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task,progress,pollRate) ;

So if you want to search for usages of an action in other elements, you have two options:

1) Use some kind of Javascript parser to parse the code where you want to look, build an AST, and locate the nodes representing the action call, or

2) Use a simple string/pattern matching

Both approaches has their pros and cons (mostly cons, unfortunately).

rsilar
Contributor
Contributor
Jump to solution

Thanks, resorted to string matching in package, expanded to folder.
0 Kudos