Last time out we were adding some data verification checks to a template form in ManageEngine ServiceDesk Plus to check on the length, and hence value, of a numerical data input field for employee ID numbers. As mentioned this client also had a requirement to check on a date entry field for the delivery of a service and advise the user if the requested delivery date was realistic.   Using Field and Form Rules on a Service Request template this is quite easy to achieve. In this example the client had created a custom field on their service template, represented by the internal field name of ServiceReq_601_UDF_DATE1 (see note below). Now all we needed to create was a logic rule to test for date validity when a user entered any data into this date field. An example of the script code used is given below and is was designed to present the user with a pop-up alert message in the event that the requested date for delivery was less than 7 days from today’s date:

var req_start_date=$CS.getValue("ServiceReq_601_UDF_DATE1");
var min_del_date = new Date();


/* Calculate minimum delivery date (Today plus 7 days) */
min_del_date.setDate(min_del_date.getDate() + 7);


if(req_start_date < min_del_date)
{
    alert("Please note that New User Requests can take up to 7 days to complete. Please contact support directly to facilitate this request or select an alternative start date greater than 7 days from today.");
    $CS.stopFormSubmission();   /*stop form submission*/
} 

These articles have only scratched the surface of what is potentially possible using Field & Form Rules. We suggest you start experimenting and please feel free to share your ideas.

Enjoy!

Note: If you’re unsure of the internal field name of a custom field simply go to the ‘Field & Form’ tab of the relevant template and create a logic rule. If you select an ‘Action’ of ‘Execute Script’ in the pop-up editor you can look for the Template Field label name you used to create the field. The editor will then indicate the internal label it is using for this custom field and the default operations you can perform on this field. Check out Part 1 for a screenshot .. ;0)  

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