How to make fields mandatory in service portal widget ??

vinod9
Tera Expert

Hello SN Team,

 

I have requirement when "substate != non" then "location" field should be mandatory or it should show some error message on location field "Location is Required ".

 

Please help me on this

 

@Mohith Devatte 

@Ankur Bawiskar 

4 REPLIES 4

Jozsef1
Tera Expert

Hi,

You need Client script or UI Policy.

If you use UI Policy than don't need any coding.

Br,

Jozsef

Yousaf
Giga Sage

Hi Vinod,


Please check if this could help.

1. If you have created a custom widget then use the below method.

<input type="text" required/>
//Client script

$scope.submit =  function(){

if(!$scope.state){
spUtil.addErrorMessage("Please fill the required fields.");
return;
}

}

 

2. But if you are using the OOB form widget then you just have to set the field as mandatory in the table.



Reference : How to make fields mandatory on a service portal widget

 

Mark Correct or Helpful if it helps.


***Mark Correct or Helpful if it helps.***

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can be done easily using UI policy

What did you start with and where are you stuck?

Regards
Ankur

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

Mohith Devatte
Tera Sage
Tera Sage

Hello vinod ,

you built a custom form using widgets?

of is it catalog item?

if its a custom form can you post the code so that i can suggest you ?