Time worked field in servicenow

manju5
Tera Contributor

Hi,

 

I have added the Time Worked field in incident form. This field is OOTB field.

manju5_0-1701248766395.png

 

This field is mandatory for incident form I have done this but It wont work in portal end but it is working for portal end also How can I restrict from portal end. Please could help me anyone.

 

Thanks,

Manju

14 REPLIES 14

Hi ,

AnandKumarP_0-1701254714070.png

i have tried in my pdi with above script ui type as desktop i am able to submit incident from portal without error message it will only restrict incidents submitted in native ui.

Thanks,

Anand

 

Hi,

Yes, but one BR I have attached above right that BR is working from Portal end, Now how can we block that BR for portal?

 

I have screen screenshot below, Please check that client script and BR codes.

Client script:

manju5_0-1701256336463.png

BR:

manju5_1-1701256364550.png

 

Thanks,

Manju

manju5
Tera Contributor

See the Portal end error screenshot below

manju5_2-1701256523998.png

 

Try below script

function onSubmit() {
   //Type appropriate comment here, and begin script below
   var channel1=g_form.getValue('contact_type');
   var time=g_form.getValue('time_worked');
   if(time=='00:00:00' && channel1!='self-service'){
	g_form.addErrorMessage('please imput time worked');
	g_form.setMandatory('time_worked',true);
	return false;
   }
}

 

It's not working