FAFR script to validate email address

FAFR script to validate email address

Script

var field = "WorkOrder_Fields_UDF_CHAR1";
var emailID = $CS.getValue(field);
if (!ValidateEmail(emailID)) {
    alert('Please enter a valid email address example@abc.com');
    $CS.stopFormSubmission();
}
/*A function which takes email and validate it*/
function ValidateEmail(mail) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) {
        return true;
    }
    return false;
}

Replace the highlighted field with the additional field name. You can obtain the name from Reports Tab >> New Query Reports >> Run the below query

select columnname,aliasname from columnaliases


                  New to ADSelfService Plus?

                    • Related Articles

                    • Custom Script to Trigger an Alert if there is no email address associated with Requester (using FAFR)

                      Working on Builds: 14500 too Scenario: Request should not be created if there is no email address associated with the requester. Instead it should prompt and alert stating there is no email address associated with the requester. The above requirement ...
                    • Script to Populate User Additional Field under Incident Template using FAFR

                      The script load the Requester Name under Incident Additional field ( As a pick list), by choosing the requester name under additional field the script populates the user additional field value. * Kindly create two additional fields under Admin -> ...
                    • Script to set fields from CSV using FAFR.

                      Works in 10604 Requirement: Load Data from CSV depending on the value selected in an additional field. Usecase: Assume there are 3 additional fields for a request template, namely, "Reference number", "Payment type and "Vendor". "Reference number" is ...
                    • Dynamic loading of field data from an external CSV file

                      Requirement: Load data to additional fields dynamically from an external CSV file based on another field value. Usecase: Assume, a request template includes three additional fields: 'Client Code,' 'Client Name,' and 'Client Address.' When a pick-list ...
                    • How to add a URL link to a Pop Up/Alert in FAFR ?

                      Please use the below script as mentioned. Replace the link with the desired link. alert ("please check below link"); window.open("https://www.manageengine.com/products/service-desk-msp/readme.html");  Refer below link for FAFR config if required, ...