VMware Cloud Community
ishaarora3
Enthusiast
Enthusiast

How to pass externalAction value in creating a property definition using createPropertyDefinition method?

Hi All,

I am trying to create a property definition using the method createPropertyDefinition(). The property definition will be populated by an external action and there is a parameter externalAction with type Action in the method.

Does anyone know the format it expects for the parameter externalAction

I tried giving it the way we see in my property definition, com.vratest.utils/getStorageList

It fails in reading externalAction.module.name from it. I am sure its a small mistake or a particular way it expects the input value to be passed

Appreciate your time and help.

Thanks!

Reply
0 Kudos
4 Replies
ishaarora3
Enthusiast
Enthusiast

This is what I understood. When I search for actions, I see the below list.

pastedImage_0.png

Here for all the items in the result the Type is Action but even though my action getStorageList exists. It doesn't have a Type coming on its own and that's why its not listed here.

There is no way we define the type while adding an action to the Folder\Module. We just click on add action and it asks to just enter the name.

Can someone please suggest.

Thanks!

Reply
0 Kudos
ishaarora3
Enthusiast
Enthusiast

I had to do this to pass the exact Action object. But this is very expensive as it will iterate over all the actions from all modules.

var externalAction = "";

var allActions = System.getModule("com.vmware.library.action").getAllActions();

for(var i=0; i<allActions .length; i++){

     if(allActions [i].name == "getStorageList "){

          externalAction = allActions [i];

          System.log(allActions [i].name);

          break;

     }

}

Reply
0 Kudos
nsajepi
Enthusiast
Enthusiast

ishaarora3​, would this help?

actionResult = System.getModule("com.vmware.library.action").getStorage();

Reply
0 Kudos
nsajepi
Enthusiast
Enthusiast

sorry typo in the previous reply

actionResult = System.getModule("com.vmware.library.action").getStorageList();

Reply
0 Kudos