VMware Cloud Community
Czernobog
Expert
Expert
Jump to solution

vRO 8 / vRA 8 - passing on metadata to a custom form input field - vRO workflow in vRA catalog

I have created a new vRO Workflow, which I want to place in the Catalog for users to launch. 

A custom form field of the workflow needs some metadata to work, similar to how event-triggered workflows can use the inputProperties to extract information. 

With a event-triggered workflow, I could just create an "inputProperties" variable of type Properties and parse it. What would be the way to achieve this with a custom form?

Creating an "inputProperties" input in the vRO workflow does not work, the field is not filled with content (nothing is passed by vRA to vRO), I guess this is because inputProperties are only generated with a subscription? I have tried creating a new input of type Properties, and used "external value" to bind it with a vRO action, which taken "inputProperties" as an input, but nothing is passed on here; similar, if the field in the custom form in bound to an action, that extracts metadata System.getContext().getParameter("__metadata_someparameter"), I get a null value error.

For reference, in vRA 7, I could just create a "__asd_subtenantRef" or "_asd_requestedBy" input property in the workflow and those values would be automatically filled with relevant metadata in the custom form.

 

Edit:

For better understanding, here's what I want to achieve:

Czernobog_0-1660726216288.png

 

 

0 Kudos
1 Solution

Accepted Solutions
xian_
Expert
Expert
Jump to solution

You can bind some metadata fields as inputs:

xian__0-1660762523762.png

Project is for "subtenantRef". The others quite self-explanatory. 

View solution in original post

0 Kudos
16 Replies
xian_
Expert
Expert
Jump to solution

You can bind some metadata fields as inputs:

xian__0-1660762523762.png

Project is for "subtenantRef". The others quite self-explanatory. 

0 Kudos
Czernobog
Expert
Expert
Jump to solution

Thanks for pointing me in the right direction, I forgot about the bindings.

The data provided here is however very scarce, I wonder if really only those few values are passed to the form, or if there is an object with more useful metadata. The "Requested By" binding only delivers the username without the domain name, which is surprising for a product that can be bound to a multi-domain environment.

The vRO Workflow Custom Form in a catalog provides a few more fields: __username and __userdisplayname, the values are the same though and both reference the service account used to launch the workflow and not the user that requests the service:

Czernobog_0-1660814212086.png

I do not know what to make of "props". I wanted to pass "props" as an object to vRO, but a field where you fill the value by "external source" does not allow binding with any values from "Request info fields". You can bind "Key" or "Value" to a single input field of type "string", but not both "Key" and "Value" to columns of a Data Grid element.

 

Overall, compared to vRA7, this is pretty disappointing. I don't understand why vmware has taken a step back here and does provide such a limited amount of request metadata information in the input form. 

edit: sadly the list of request info properties will not be expanded with 8.9: Using and Managing vRealize Automation Service Broker - vRealize Automation 8.9 (vmware.com)

0 Kudos
Czernobog
Expert
Expert
Jump to solution

I had to rip out configured Directories in vIDM and re-add them usinf UserPrincipalName instead of samaccountname and now all users are correctly identified by their upn (Requested By = upn), which makes life much easier.

Sasidhar4321
Contributor
Contributor
Jump to solution

Hi,

I have similar requirement for a XaaS catalog to pass __metadata_userName and __metadata_requestId as input parameters similar to __asd_requestedBy and __asd_catalogRequestId in vRA 7.x. 

I see requestedBy can be used through Bindings for Username. May I know which one to select for __metadata_requestId ?

Regards,

Sasidhar

0 Kudos
xian_
Expert
Expert
Jump to solution

You do not have requestId on the request form yet. You can get in in your workflow later:

System.getContext().getParameter('__metadata_requestId');

0 Kudos
Sasidhar4321
Contributor
Contributor
Jump to solution

Sasidhar4321_2-1677685532345.png

 

Sasidhar4321_1-1677685181952.png

 

Am getting NULL values for the Metadata while workflow execution, however, the event is triggered and I could see the values navigating to Subscriptions --> Workflow Runs.

0 Kudos
xian_
Expert
Expert
Jump to solution

It's failing because InputProperties was missing, not because context was incomplete. Do you run this workflow as EBS?

Also, you are trying to set input variables in your workflow: you should remove them as inputs.

0 Kudos
Sasidhar4321
Contributor
Contributor
Jump to solution

Am using EBS for passing the inputProperties,using the condition 

event.data.blueprintId == 'XXXX35fa-13c9-3c5d-bc3XXXXXXXXXX'

The blueprintId value is XaaS CatalogId.

Please note, this is for a XaaS catalog which am trying to capture Metadata as inputs

Sasidhar4321_0-1677687071614.png

 

0 Kudos
Sasidhar4321
Contributor
Contributor
Jump to solution

I have removed them as input variables, still getting the same error

TypeError: Cannot read property "customProperties" from null (Workflow:Request FPT Storage Wrapper / Get MetaData (item3)#10200)

Sasidhar4321_1-1677688689089.png

 

0 Kudos
xian_
Expert
Expert
Jump to solution

I am still confused what you are doing here. You say you have an XaaS but you created an EBS for Compute Allocation? XaaS workflows do not trigger this event.

0 Kudos
Sasidhar4321
Contributor
Contributor
Jump to solution

I am trying to pass Metadata as input parameters to my XaaS workflow using a wrapper workflow.

I used to pass XaaS payload( __asd_catalogRequestId and __asd_requestedBy) as input parameters in vRA 7.x. As part of migrating it vRA 8.x, one option is to bind the values(Request ID is not available) in Custom form, other option is to trigger an event and extract metadata ( __metadata_userName and __metadata_requestId) from the properties and pass it as input parameters. Please correct me if am wrong.

Tried the XaaS event, still same issue. Please help me with full steps on how I can use Metadata as input parameters in vRA 8.x for XaaS catalog.

Sasidhar4321_0-1677706576800.png

 

0 Kudos
xian_
Expert
Expert
Jump to solution

You cannot use inputProperties and CustomProperties with XaaS. However, if you want to grab the username and request ID in a wrapper workflow, here is what you could do:

xian__0-1677781697441.png

userName and requestId are local variables of the wrapper workflow.

These then passed to the subflow as input (input1 is the input of the wrapper wf):

xian__1-1677781799897.png

Here are the logs:

xian__2-1677781847550.png

 

HTH

Sasidhar4321
Contributor
Contributor
Jump to solution

It worked like a charm..thanks a lot for your help 🙂 

 

 

0 Kudos
NWolford51
Contributor
Contributor
Jump to solution

I am struggling with the same issue.  I have tried the scriptable task with output of "userName" with no luck.  I have also tried to just call it in the script that we are setting all necessary fields for our Rest API call.  

userName = System.getContext().getParameter("_metadata_userName");

var jsonCI={
"name": vmName,
"engineer":userName,

}
var requestContent=JSON.stringify(jsonCI)
 
What am I missing?
 
0 Kudos
Sasidhar4321
Contributor
Contributor
Jump to solution

We get the username output from getContext().getParameter("__metadata_userName") without any additional scripting. PFA screenshot.

 

Sasidhar4321_0-1679698936976.png

 

0 Kudos
citizen95
Contributor
Contributor
Jump to solution

looks like a "_" is missing before _metadata. it should be "_ _metadata_userName"  without the space