Script Form Step For External Forms
  • Updated on 19 Jun 2015
  • 3 minutes to read
  • Print
  • Dark
    Light

Script Form Step For External Forms

  • Print
  • Dark
    Light

Script Form Step was designed in Decisions 3.2 for doing additional work with javascript before processing External Form . This tutorial shows a simple example of how to configure and use this step in the Workflow .

Example:
In this example we will configure a Script Form step to show a simple pop-up alert that will display Current User Email Address . Next, we will call our Flow back to continue Flow execution.
We begin in the Designer Folder with clicking Create Flow button on the Folder Actions Panel.
createFlow7.png

Next, we Name our Flow and click Create to proceed to the Flow Designer.
nameFlow8.png

In the Flow Designer we add Script Form Step from the Flows, Rules, Forms and Reports > Forms [Interaction] category in the ToolBox .
addScriptForm.png

Script Form step configuration window pops up. First, we need to add at least one Outcome to our step. We click Add New link in the Service Outcomes section.
addServiceOutcome.png

In the resulting window, we name our outcome. If needed, we can Add Parameters that will be passed back from this step. Click Ok when finished.
defineOutcome.png

Next, we can configure if we need System to generate service for this step by checking/unchecking Generate Service checkbox.
generateServiceCheck.png

If we need to pass Data to this step we can Add Input Data in the*Expose Data On Service*** section.
exposeData-1.png

Finally, we have two options for the Script Source: Data (to pass script data to the step) , and NVelocity (to type script manually) . In this example we use NVelocity Script Source.
scriptSource.png

Next, in the Script Data [NVelocity] we type our javascript . In this example we simply use alert() method. Mention, in the message to display using alert() method we create a token for Email using NVelocity syntax. This makes our javascript message dynamic. We click Done to close Script Form Step configuration window.
writeScript.png

Next, we add a Show Popup step from the Favorite Steps category.
addShowPopUp.png

In the resulting window we configure Subject and Message for our pop-up. And, click Add .
configureShowPopUp.png

Then, we select Script Form step on the workspace and Step Information Layer pops up. We locate inputs for Email variable that we defined in our script, define its data Mapping Type as Select Value , and usingPath picker we select CurrentUserEmail from Flow Data category.
mapEmail.png

Note: Script Form step does not continue Flow execution automatically. It will wait on the External Form to finish its work and call back to Flow . To learn how can we call back to the Flow and continue execution on the desirable outcome from Script Form step, we click View Integration Details.
viewInegrationDetails.png

Integration Details page opens in a new window. We copy a javascript for Complete via Get. Then, we return back to our Script Form step configurations.
integrationDetails.png

We paste Complete via Get javascript underneath our javascript in Script Data [NVelocity] box. Close Script Form step configurations.
editedScript.png

Next, we connect steps in our Flow as following and click Debug Flow link on the top panel of the Flow Designer to test our Flow .
Note that in Decisions version 3.5 and above, you'll need to click Test Flow to access the Debugger.

3.5-Test-Flow-Shot4.png

debugFlow8.png

After we launch Debugger , new Tab in our browser opens. Defined javascript is being executed on this Default Script Form page. We can see that Alert message pops up with Current User Email. We click OK . This triggers the rest of our javascript to be executed.
alertPoppedUp.png

We return to the Debugger and observe our Show Popup step in action. Notification pops up and Flow is being terminated.
notificationPoppedUp.png

If we switch to the Diagram Tab in the Debugger , we can confirm that our Flow ran to theEnd Step with no errors.
flowCompleted1.png

Note: This will not work on in crossdomain environment. For example if Portal Base URL in format [machine name]/decisions/Primary/ - this will not work because Default Script Form tries to call localhost/decisions/Primary

Was this article helpful?