VMware Cloud Community
jbweber2
Enthusiast
Enthusiast
Jump to solution

using javascript library

Is it possible to use an external javascript library inside of a scripting element?

As an example I'm implementing some logic from a vCAC workflow into a vCO workflow and it would be nice if I could access some of the tools in underscore.js to rewrite this logic. With the rhinojs console I can just run load(filename) to load tools into context, but I couldn't find a similar analog in the docs for vCO. Actions seem to kind of do what I want, but rather than single reusable operations I'd like to do something more analogous to importing a library in java and being able to use it in context.

Reply
0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

You could certainly hack something using fileReader / eval but this is not the vCO philosophy. You should build your action library so the content stay in the vCO DB which has several benefits such as  checkpointing, vCO nodes clustering, export all your code as a single package with versionable items and so on.

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

4 Replies
cdecanini_
VMware Employee
VMware Employee
Jump to solution

You could certainly hack something using fileReader / eval but this is not the vCO philosophy. You should build your action library so the content stay in the vCO DB which has several benefits such as  checkpointing, vCO nodes clustering, export all your code as a single package with versionable items and so on.

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
jbweber2
Enthusiast
Enthusiast
Jump to solution

Depending on the library I think I can just include the contents of the script / library inside of the action and return it as the return value. Not a string eval, but actually return the object from the action using the action of the container. Thanks!

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

This is what I typically do.

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
rsaturns1
Contributor
Contributor
Jump to solution

I recognize this is from years ago. But I'm wondering if anyone can elaborate on this. I'm trying to include the underscore.js library but I'm not quite sure how to do that.

Reply
0 Kudos