VMware Cloud Community
msalajka
Enthusiast
Enthusiast

Workflow as a service, System Context in Input Forms

Hello,

i'm using VMware vRealize Orchestrator 8.8.1 and VMware Cloud Director 10.3.3.

I want to use a workflow as a service in Cloud Director's Service Library and I want to have dynamic Input Form elements based on system context (_vcd_orgId).

1) I've defined _vcd_orgId input (wf1.png, wf2.png) in workflow

2) I've registered workflow in Cloud Director (sl1.png)

3) I don't see _vcd_orgId during Input Form execution... (in Service Library) (sl2.png).

Can i use _vcd_orgId (and other parameters) in Input Forms?

Later, during workflow execution, it works... log1.png, log2.png)

thanks

m.

 

0 Kudos
7 Replies
imtrinity94
Enthusiast
Enthusiast

I am trying to understand the issue here. So, you created _vcd_orgId as an input and once you registered that WF, that input disappears from that WF input form yet it exists and even has a value which gets printed. 

So, now there can be 2 scenarios

One, you want the value of _vcd_orgId accessible to you on the input form itself. For that you can use the Bind Field feature and bind _vcd_orgId to another variable, here orgId. 

imtrinity94_0-1663918769754.png

Second probability, if you want to change the value of _vcd_orgId whenever you run the WF on the input form, you can reverse bind _vcd_orgId to a custom input variable orgId and whatever goes into orgId will automatically be passed to _vdc_orgId.

 

imtrinity94_2-1663918992705.png

 

Bottom line, _vcd_orgId can't be seen on the input form during WF run. However, it is there and we can use it anyway we want.

Mark it as accepted if it helps. Thanks.


Mayank Goyal
vRO Engineer
https://www.linkedin.com/in/mayankgoyal1994/
https://cloudblogger.co.in/
0 Kudos
msalajka
Enthusiast
Enthusiast

hello,

i want to know, on presentation level, which user in which tenant organisation has initiated the workflow.

based on this blog, it should be possible:

https://www.evoila.de/en/blog/2020/01/29/using-request-context-in-vcd-service-library-workflows/

but i have these parameters empty/null.

m.

DanMSleek
Contributor
Contributor

Has anyone been able to use any of the Cloud Director variables (including _vcd_orgid) in the presentation layer?

Looking at the API calls, there is no context at the presentation layer. The variables are only completed when the "Run" button is clicked.

This means in current versions of VCD (10.4.1) and VRO (8.10) we are unable to safely provide a tenant with a drop-down to select VCD Objects (e.g. VDCs, vApps, VMs, etc). 

 

A simple example use case: Workflow "Report an issue with a virtual machine"
Tenants should be able to select a virtual machine from their tenancy, we can't use the vcloud:VM because this allows a tenant to view all VMs even outside their scope.

I can see the form is collected with a GET request to https://<vcd-url>/cloudapi/workflows/forms/urn:vcloud:serviceItem:<guid> but there's no context passing the variables (e.g. _vcd_orgid)

0 Kudos
msalajka
Enthusiast
Enthusiast

workaround from cloud director release notes. it works.

  • If you use vRealize Orchestrator 8.x, hidden input parameters in workflows are not populated automatically in the VMware Cloud Director UI

    If you use vRealize Orchestrator 8.x, when you attempt to run a workflow through the VMware Cloud Director UI, hidden input parameters are not populated automatically in the VMware Cloud Director UI.

    Workaround:To access the values of the workflow input parameters, you must create a vRealize Orchestrator action that has the same input parameter values as the workflow that you want to run. 

    1. Log in to the vRealize Orchestrator Client and navigate to Library>Workflows.

    2. Select the Input Form tab and click Values on the right-hand side.

    3. From the Value options drop-down menu, select External source,enter the Action inputs, and click Save.

    4. Run the workflow in the VMware Cloud Director UI.

DanMSleek
Contributor
Contributor

I concur, I've tested this now by creating action which takes the input (in the example below _org_id) and binds that. This does then work in the UI. The wording of "hidden variables" made me think that any hidden field input wouldn't come through, but it works just as well for the VCD variables.

get_org_id

input: _org_id (string)

script: return _org_id;

 

0 Kudos
msalajka
Enthusiast
Enthusiast

hello,

using the exact names of variables is necessary for it to work... crazy 🙂

for example make action "returnOrgId"

inputs: _vcd_orgId string

outputs: string

and script: return _vcd_orgId;

and use it as external...
 
m.
0 Kudos
DanMSleek
Contributor
Contributor

I have an SR open with support, I've asked if they could both update the release notes to make it a bit clearer that this applied to these variables.

Also, hoping there's an actual bug/PR/etc so we won't have to apply this in future releases. For now though, I can push on.

Thanks for the hint! I've now written an action package for myself with each variable should I need them in the future.

0 Kudos