Crow Canyon NITRO Forms Actions
Topics
  • Execute Script Action Sample Code
  • Execute Submit Action Sample Code
  • Custom JavaScript code on Form Load
    • Link
    • Eval
  • Custom CSS
  • Reference for functions available in formContext for Script and Submit actions
  • Using Script and Submit actions to create a wizard based request submission Form
Execute Script Action Sample Code
Overview: Script action is placed as a button on the form and can be used in various scenarios. In this example it is used to set value of a column on the Form based on values of other columns. Script action processing should finish within 30 seconds otherwise the Forms code continues with the processing without waiting for script action result.At the end of processing, script action must call 'functionCallback' to return control back to the NITRO Forms. There are three ways to call this function:
  1. Success and no message to be shown to user: functionCallback();
  2. Success and show a message to user: functionCallback(false, 'success message text');
  3. Failure and show a message to user: functionCallback(true, 'failure message text');
Scenario: Update value of "Risk Level" column based on value of columns "Impact" and "Probability of Failure"
Execute Submit Action Sample Code
Overview: Submit action is placed as a button on the form and has two parts - Script and Crow Canyon Custom Action. At least of one of this has to be specified for the Submit action. Script code is similar in functionality to Script action with additional feature of setting column values that are not shown on the Form.If script is specified then at the end of processing, it must call.
  1. Success: functionCallback();
  2. Success with item column values to update: functionCallback(false, listColumnValueobj); // refer example below
  3. Failure and show a message to user: functionCallback(true, 'failure message text');
On clicking of Submit action, processing happens in following steps:
  1. Execute the script. If it times out or returns an error as part of functionCallback then further processing is stopped. Script processing should finish within 30 seconds otherwise the Forms code continues with the processing without waiting for result of script execution
  2. Call the Form Save functionality. This will in-turn call the validations configured in the form and if validations fail then processing will stop with validation errors highlighted on the Form
  3. If Save is successful, then call the custom action specified in the Submit action
Note: If #2 fails, then user will fix the validation errors and click the submit action button again. This means, the script (if configured) will execute again. Due to this, script code should first check the state before modifying it. For example, if you are creating a SharePoint list item, then first check if it is already created before creating another one. For the example below, check is not required as it is just for setting a column value based on other column values
Scenario: Update value of "Risk Level" column based on value of columns "Impact" and "Probability of Failure". Subsequently item Save will be invoked and if any custom action is specified in the Submit action then that will be executed
Scenario: Update Approver based on Department from Approver list. Subsequently item Save will be invoked and if any custom action is specified in the Submit action then that will be executed
Custom JavaScript code on Form Load
You can add custom JavaScript that is loaded at the time of form load. This can be done in two ways. You can put the script in a file and include the link to the file in the form settings. Or you can directly specify the script in the form settings. In case of link, the script is available on the form after the form is loaded and can be called any time, for e.g. the script may handle column value change event and will be invoked when that happens. On the other hand, directly specified script runs only once after the form load.
To specify the custom script, go to NITRO/Portal Form settings, in the left pane expand "Advanced" section and click "Custom JavaScript". In the dialog select the appropriate option
Custom JavaScript Eval Sample Code
Example code below is used to check the status of a lookup item and based on that disallows creating/editing the item.
Scenario: In this case, creation of a new line item is disallowed for a purchase request if the request is already approved. So script is added to the line item form which has a lookup to purchase request.
Custom CSS Sample Code
Overview: Custom CSS is used to change the look and feel of the NITRO Forms. You can use this if form themes are not sufficient for your branding needs
In below example of custom CSS, following changes are demonstrated:
  1. Use a graident color for form background
  2. Tab border style changes
  3. Showing an icon in tabs
To specify the custom CSS, go to NITRO/Portal Form settings, in the left pane expand "Advanced" section and click "Custom CSS".
Custom CSS used for above changes:
Reference for functions available in formContext for Script and Submit actions
Fetching value from Form only if column exist on the Form
Setting value back to Form only if column exist on the Form
Fetching value from item in EditForm
Checking is Display Form and executing code
Checking is Edit Form and executing code
Checking is New Form and executing code
For Submit action setting the value for a column that is not displayed on the Form
Using Script and Submit actions to create a wizard based request submission Form
Overview: In wizard mode, user is presented a series of pages in a sequence to enter the data and on last page there is a form to submit the request. User can click previous/back buttons on intermediate pages to navigate to different pages. Using Crow Canyon NITRO Forms, this experience can be easily configured.
  1. Create a NITRO Form and add various pages as Tabs on the Form in the required sequence
  2. On first Tab, add one script action (to go to next tab)
  3. On intermediate Tabs, add two script actions (for previous and next)
  4. On last Tab, add one script action for going back to previous Tab and one Submit action to save the request
Script Configurations:
In Forms designer, go to 'Miscellaneous' panel on left side then --> click on button "Custom JavaScript" and then select "Custom Script As" Eval and then use below script
For Script actions to go to next Tab, configure below script for the action
For Script actions to go to previous Tab, configure below script for the action
For Submit action, if you want to update any hidden column value, then use below script:
Just enter the call to return control to NITRO Forms
CSS Configurations:
In Forms designer, go to 'Miscellaneous' panel on left side then --> click on button "Custom CSS" and then use below css.
Privacy Statement
 Contact Us
Developed by
Copyright © 2018 Crow Canyon Systems, Inc. All Rights Reserved.