I want to Restrict Form Submission if the It-fun_org field is Empty

JVINAY
Tera Contributor

Hi Team

 

I'm working on a requirement where I need to prevent the submission of a CIR  if the field it_fun_org is empty. The challenge is that this field is read-only on the form. This field is Currently populated based on Business application

Field Name : it_fun_org ( reference type : Business_app)

 

I want to restrict form when the it_fun_org field is empty.

 

Please help me how can i achieve this.

 

 

 

1 ACCEPTED SOLUTION

@JVINAY 

try this

function onSubmit() {
    var itFunOrg = g_form.getValue('it_fun_org');
    if (itFunOrg == '' || itFunOrg == undefined) {
        g_form.showFieldMsg('it_fun_org', 'IT Functional Org must be populated before submission.', 'error');
        return false; // Prevent submission
    }
    return true;
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

it's Working ,

Thanks @Ankur Bawiskar  for your help.