Bindings define how the simple workflow example's scriptable task elements process input parameters. You also bind the scriptable task elements to their JavaScript functions.
When defining bindings, Orchestrator presents parameters you have already defined in the workflow as candidates for binding. If you have not defined the required parameter in the workflow yet, the only parameter choice is NULL. Click Create parameter/attribute in workflow to create a new parameter.
The Start VM Failed scriptable task element handles any exceptions that the startVM action returns by setting the content of an email notification about the failure to start the virtual machine, and writing the event in the Orchestrator log.
The following table shows the input and output parameter bindings that the Start VM Failed scriptable task element requires.
The Start VM Failed scriptable task element performs the following scripted function.
body = "Unable to execute powerOnVM_Task() on VM '"+vm.name+"', exception found: "+errorCode; //Writes the following event in the vCO database Server.error("Unable to execute powerOnVM_Task() on VM '"+vm.name, "Exception found: "+errorCode);
The Timeout 1 scriptable task element handles any exceptions that the vim3WaitTaskEnd action returns by setting the content of an email notification about the failure of the task, and writing the event in the Orchestrator log.
The following table shows the input and output parameter bindings that the Timeout 1 scriptable task element requires.
The Timeout 1 scriptable task element requires the following scripted function.
body = "Error while waiting for poweredOnVM_Task() to complete on VM '"+vm.name+"', exception found: "+errorCode; //Writes the following event in the vCO database Server.error("Error while waiting for poweredOnVM_Task() to complete on VM '"+vm.name, "Exception found: "+errorCode);
The Timeout 2 scriptable task element handles any exceptions that the vim3WaitToolsStarted action returns by setting the content of an email notification about the failure of the task, and writing the event in the Orchestrator log.
The following table shows the input and output parameter bindings that the Timeout 2 scriptable task element requires.
The Timeout 2 scriptable task element requires the following scripted function.
body = "Error while waiting for VMware tools to be up on VM '"+vm.name+"', exception found: "+errorCode; //Writes the following event in the vCO database Server.error("Error while waiting for VMware tools to be up on VM '"+vm.name, "Exception found: "+errorCode);
The OK scriptable task element receives notice that the virtual machine has started successfully, sets the content of an email notification about the successful start of the virtual machine, and writes the event in the Orchestrator log.
The following table shows the input and output parameter bindings that the OK scriptable task element requires.
The OK scriptable task element requires the following scripted function.
body = "The VM '"+vm.name+"' has started successfully and is ready for use"; //Writes the following event in the vCO database Server.log(body);
The Send Email Failed scriptable task element receives notice that the sending of the email failed, and writes the event in the Orchestrator log.
The following table shows the input parameter bindings that the Send Email Failed scriptable task element requires.
|
|||||||||||
|
|||||||||||
|
The Send Email Failed scriptable task element requires the following scripted function.
//Writes the following event in the vCO database Server.error("Couldn't send result email to '"+toAddress+"' for VM '"+vm.name, "Exception found: "+emailErrorCode);
The purpose of the Start VM and Send Email workflow is to inform an administrator when it starts a virtual machine. To do so, you must define the scriptable task that sends an email. To send the email, the Send Email scriptable task element needs an SMTP server, addresses for the sender and recipient of the email, the email subject, and the email content.
The following table shows the input and output parameter bindings that the Send Email scriptable task element requires.
|
|||||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
|
The Send Email scriptable task element requires the following scripted function.
//Create an instance of EmailMessage var myEmailMessage = new EmailMessage() ; //Apply methods on this instance that populate the email message myEmailMessage.smtpHost = smtpHost; myEmailMessage.fromAddress = fromAddress; myEmailMessage.toAddress = toAddress; myEmailMessage.subject = subject; myEmailMessage.addMimePart(body , "text/html"); //Apply the method that sends the email message myEmailMessage.sendMessage(); System.log("Sent email to '"+toAddress+"'");