VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso

vCAC 6.0 advanced service designer. Set a default value to the requesting users user name or email address.

It is not obvious to me how we set the default value of a field to something like the requesting users username or the email address or some other attribute.  In my scenario I am adding a custom action to act upon a IaaS vSphere virtual machine.  As part of this action an email will be generated and I want the toAddress to be defaulted to the person logged in making the request.  I can see other cases where I might want to default a field based upon various properties of the item I am interacting with.  Is there an easy way to do such a thing.  I have been looking through the documentation and I don't see any sort of programatic options with setting defaults or loading the pick lists.  I believe I have cobbled together an action that will populate the default value for me based on the owner of the virtual machine but that took some jumping through hoops to accomplish.  It would be nice to have some of this functionality in the advanced designer though.

Reply
0 Kudos
3 Replies
jddias
VMware Employee
VMware Employee

Hi qc4vmware, I was researching your question and found someone internally had gotten this answer - I believe this will work for the use case you describe.

The following data is passed as global parameters to any workflow executed through ASD:

__asd_tenantRef : Tenant of the user requesting it

__asd_subtenantRef: Business group of the user

__asd_catalogRequestId: the request Id from catalog for this execution

__asd_requestedFor: if the request was made "on behalf" of some user then, this is target owner of the request, otherwise it's it current user.

__asd_requestedBy: the user who is doing request

From a workflow scripting you can access this values using :

  System.getContext().getParameter(<<name>>);

Visit my blog for vCloud Management tips and tricks - http://www.storagegumbo.com
qc4vmware
Virtuoso
Virtuoso

I created an action and placed it in the default value of the workflow presentation but at that point it is returning null.  If I put that in a scriptable task within the workflow then the values show up.  I am gonna assume there is no execution context in the advanced service when it is presenting the form.  It must just look at the workflow and create the form in the vCAC UI which appears to include running the action specified but I don't think the workflow run with the additional parameters exists yet.

Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso

For anyone reading this thread that might be interested in the exact steps I took to accomplish getting the email address of the owner I created:

1. created an action that looks up the vCACVm by comparing the vCenterVm.config.uuid to the vCACVm.vmUniqueID

2. grabbed the user name from the property labeled "__Legacy.Workflow.User"

3. did a lookup in AD and grabbed the users email address

4. Put the previous 3 items into an action that returns the email address and made this action the default value for the form

This doesn't accomplish what I had originally set out to do but it at least gives me a reasonable default value as most of the time it would be the owner electing to do this.  At some point hopefully some of these user context type things will be something we can specify as a default.  username, email address, office location, pretty much anything about the user logged in we know would be nice to be able to specify as a default or get OGNL expressions working from the vCO workflows and we can just take care of it there.

Reply
0 Kudos