The ‘Field & Form Rules’ is a great new feature for Request templates in ManageEngine ServiceDesk Plus. The feature allows for the creation of dynamic forms that change in response to selection of field values and content.
Whilst there are standard actions that can be defined for a Field and Form Rule, such as Enable / Show / Hide / Mandate fields, there is also an ‘Action’ option to ‘Execute Script’ which allows for even further customisation.
Now Zoho have a couple of sample scripts, one of which a number of customers have wanted to use, namely the ‘Dependency Example’. However, the example given involves three related fields and is not immediately clear regarding its operation even with the details provided in the on-line help. Generally we’re looking to define two related fields rather than three so I thought I’d add a few notes to assist anyone looking to use this feature.
To test a dependency script create a new test Incident template create a couple of ‘Pick List’ custom fields on this template, e.g. First Pick List with options Option 1, Option 2 and Option 3 and Second Pick List with options Option A, Option B and Option C :
Next create a new Field and Form Rule for an ‘On Form Load’ action with an ‘Action’ of ‘Execute Script’ and click the option to ‘Write Script’ (no condition is necessary on the rule). In the pop-up editor paste the following script code and save.
var dependencyObj= {
    “FIELDS” :[“First Pick List”,”Second Pick List”],
        “Option 1”:[“Option A”,”Option B”,”Option C”],
        “Option 2”:[“Option A”,”Option B”],
        “Option 3”:[“Option C”]
Next enter a request using this test Incident Template and check your dependency fields, you should see that the values of the ‘Second Pick List’ field will change dependent on the value of the ‘First Pick List’ field, in the example choosing ‘Option 1’ gives the two selections ‘Option A & Option B’ rather than all three:
Cool huh? 
Few things to note:
  • In the script use the unique alias name or label you used to define the field (ServiceDesk Plus has it’s own internal naming convention for these fields).
  • Make sure you define all the options needed in the dependent field(s), in our example the ‘Second Pick List’ field.
  • It should be noted that these are scripts saved in the rule itself. They are not external scripts such as PowerShell or Python. The script should be valid JavaScript code in order to execute. 
  • Need three related fields? Try the format of the extended script below using a third dependent pick list (don’t forget to create the custom field and add it to your test Incident template):


var dependencyObj= {
    “FIELDS” :[“First Pick List”,”Second Pick List”,”Third Pick List”],
        “Option 1”:{
             “Option A”:[“Option i”,”Option iv”],
             “Option B”:[“Option iii”],
             “Option C”:[“Option i”]
        “Option 2”:{
             “Option A”:[“Option ii”,”Option iii”],
             “Option B”:[“Option i”]
        “Option 3”: {}       /* no sub selections
This article is relevant to:
Service Desk

You may be interested in these other recent articles

Get to building your business apps with the new AppCreator

9 June 2022

ManageEngine’s new low-code application development tool Creating an application, building one and deploying it can be expensive and time consuming as you have to make…

Read more

Endpoint Central’s Endpoint Security

31 May 2022

Endpoint Central (formerly Desktop Central) not only got a name change but has also introduced Endpoint Security to help organisations keep their endpoints secured. According…

Read more

Automation in ManageEngine ServiceDesk Plus

20 December 2021

Increasingly customers are looking to automate repetitive and mundane tasks in ServiceDesk Plus. Since the introduction of Deluge, Zoho’s online scripting language, as part of…

Read more

Update on the recent Apache Log4j2 vulnerability – Impact on ManageEngine on-premise and Zoho cloud products

14 December 2021

A high severity vulnerability (CVE-2021-44228) impacting multiple versions of the Apache Log4j2 utility was disclosed publicly on December 9, 2021. The vulnerability impacts Apache Log4j2…

Read more

Who do I contact for technical support for my ManageEngine product?

10 September 2021

When purchasing a ManageEngine product it will either have been supplied on a subscription basis or it would have included an initial Annual Maintenance and…

Read more