VMware Cloud Community
manfriday
Enthusiast
Enthusiast
Jump to solution

Updating a "Cost" field in a webview

As stated in my other post, I am working on a self-service provisioning portal.

I want to be able to update a "cost" field on the webview as the user adds vCPU's, vRAM, and additional hard disks.

Is this possible with vOrchestrator?

Thanks!

Jason

Reply
0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

There are different way to address this:

- Do different steps in your workflow presentation : Fields are recalculated by steps.

- If I recall well if you use an action to update a field it will refresh if the first parameter of the action is updated in another field.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

Reply
0 Kudos
17 Replies
cdecanini_
VMware Employee
VMware Employee
Jump to solution

It is possible to call in an action in the presentation text that would use the other fields as input and return a string being the cost. I cannot get the syntax on top of my head, I need to find an example.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
thechaos
Enthusiast
Enthusiast
Jump to solution

Hi,

i think you need an Action which get the fileds a parameters. This action than can be called as a custom validation / predefined answer from the presentation. See attached picture as an example...

Thomas

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

OK found an example to call in an action within the presentation text:

${#exist=GetAction("com.vmware.lcm.presentation","existAvailableTemplate").call( #location , #organization , #serverEnvironment , #serviceLevel , #performance )? "This defines the type of server that is installed, if the server is started after being provisioned." :
"<font color=\"#FF0000\">Warning: there is no available server type for your criteria. Return to the previous step and change your criteria.</font>"}

This one is a bit complex and display text based on the boolean returned by the action. A much easier way is to add an input call cost, use presentation to calculate a default value from an action getting the other fields used to calculate the cost as input. Once you check this works you hide the field and in the presentation text you add a "This is going to cost you ${cost}".

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
manfriday
Enthusiast
Enthusiast
Jump to solution

Thanks!

That was very helpful. I got the logic to work, mostly.

However, the values selected in the drop down box only update when the form is submitted.

Any idea how I can get the values to update every time I change the drop down box?

Jason

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

There are different way to address this:

- Do different steps in your workflow presentation : Fields are recalculated by steps.

- If I recall well if you use an action to update a field it will refresh if the first parameter of the action is updated in another field.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
manfriday
Enthusiast
Enthusiast
Jump to solution

This seems to be working.

How do I hide the text field that I palced the default value in?

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

There is a hide parameter input property you can set in the presentation on this input.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
manfriday
Enthusiast
Enthusiast
Jump to solution

yeah I added the "Hide parameter input" property, and set the value to TRUE, but that hides the description as well..

Reply
0 Kudos
manfriday
Enthusiast
Enthusiast
Jump to solution

Oh. I think i misunderstood what you said when you mentioned "Presentation Text"

I can add the text to the description of the whole "Presentation" form , or the billing "Step", rather than the string field that I enter my default value on.

duh.

Smiley Happy

Thanks!

Jason

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Yep this is right. You use the field to calculate the value and test, then you hide it and reference it in the presentation text of a section. If not end user would be able to change the cost Smiley Wink

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
manfriday
Enthusiast
Enthusiast
Jump to solution

I am ressurecting this thread, as something seems to have broken in Orchestrator 4.2.

This code in the Description field previsouly worked:

VM Cost: $ ${#exist=GetAction("org.company.VirtualServices","vs_calcvmcost").call( #numCPU, #numMem, #SecondHardDisk,#vmCost)} per year.

This would call my custom action, and return the VM's cost.

Now all I get back is "NaN"

Not sure what changed in Orchstrator. My code did not change.

any ideas?

Thanks

Jason

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Hi Jason,

Is this with Windows 4.2 version or with the appliance ?

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
manfriday
Enthusiast
Enthusiast
Jump to solution

This is with the appliance.

Thanks!

Jason

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

The 4.2 appliance went through additional security tests than the 4.2 Windows version. As part of this security was enhanced and one of the effect is the one you are observing. ATM you should use the 4.2 Windows version until a new version of vCO. At this point the default behavior will be the most secure one and there will be an option settable at the server level that will allow compatibility with the 4.1 behavior.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
igorstoyanov
VMware Employee
VMware Employee
Jump to solution

Hi Jason,

Unfortunatelly, this feature was disabled in the appliance as well in the upcoming update 1 of vCO4.2 (not relevent but also in vCO4.1 Update2) based on recommendations from the security group.

The good news is that you can revert back the old behavior by setting two properties:

webview.raw.enabled=true

#If set to true, disables HTML escaping for the web views.  Default value is false

com.vmware.o11n.webview.htmlescaping.disabled=true

#If set to true disables HTML tags escaping in the workflow titles and descriptions, in the web views. Default value is false

This properties should be added to the file located in: ${vco_installation}/app-server/server/vmo/conf/vmo.properties (for the appliance the ${vco_installation}=/opt/vmo
The server will need to be restarted after that.
Thanks,
Igor.
Visit http://blogs.vmware.com/orchestrator for the latest in Cloud Orchestration.
Reply
0 Kudos
manfriday
Enthusiast
Enthusiast
Jump to solution

Is there a prefered "new" method of achieving the same result?

Reply
0 Kudos
igorstoyanov
VMware Employee
VMware Employee
Jump to solution

Unfortunately, no. The functionality to provide scripting execution in descriptions or titles is considered as a security vulnerability according to the security group. However, if the user accept the risk and enable those properties, the product will work in backward compatible mode.
Thanks.
Visit http://blogs.vmware.com/orchestrator for the latest in Cloud Orchestration.
Reply
0 Kudos