Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
VMware vRealize Orchestrator Essentials

You're reading from   VMware vRealize Orchestrator Essentials Get hands-on experience with vRealize Orchestrator and automate your VMware environment

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781785884245
Length 184 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Daniel Langenhan Daniel Langenhan
Author Profile Icon Daniel Langenhan
Daniel Langenhan
Arrow right icon
View More author details
Toc

Creating an action


Actions are what programmers call functions. It is a piece of code that you intend to reuse often in different programs.

There are multiple differences between a workflow and an action. The main difference is that an action can return only one variable, whereas a workflow can return multiple variables. Another difference is that actions are purely JavaScript-based and do not contain any visual programming.

In an action, the in-parameters are defined the same way as in a workflow. However, the return type is a bit different. The return code is always one variable and its value is assigned by using the JavaScript return command. If you don't want or need any return code, define the return code as void.

A good naming convention for actions is to start the name of the action with a verb, such as get, set, create, delete, and so forth. Then, describe what the action is doing. A good way to make the name more readable is to capitalize each word (except the first word). Examples...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image