To make particular field mandatory in catalogue task

Vamsi Krishna
Tera Contributor

Hi All,

 

I got a requirement that There is a variable "add mobile number", It should not visible on the form and It should visible only on the fulfilment catalogue task. As soon as the request submit , three task will be generation , one is investigation and another two is fulfilment task. But I do not want that variable on the investigation task , from fulfilment task onwards that particular variable should visible and should be madantory .can anyone help me with this.

VamsiKrishna_0-1694173513184.png

 

1 ACCEPTED SOLUTION

@ Vamsi Krishna  

then you can use onLoad client script and check the type and then make variable mandatory

something like this

function onLoad(){

	if(g_form.getValue('type') == 'fulfillment'){ // give correct choice value here
		g_form.setMandatory('variables.variableName', true); // give correct variable name here
	}

}

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

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@ Vamsi Krishna  

how are you determining the task type i.e. investigation etc

Are you using some short description etc?

If yes then you can use normal onLoad client script on sc_task table and check the short description and based on that show and make the variable mandatory

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

@Ankur Bawiskar 

Based on the type classification , we can define which type of task it is

VamsiKrishna_0-1694179158402.png

can you provide me the script for this.

@Ankur Bawiskar 

Based on the task classification type we can define which type of task it is.Please find the screen shot.

VamsiKrishna_0-1694179305013.png

can you provide me the script for this.

 

Thanks 
Vamsi B

@ Vamsi Krishna  

then you can use onLoad client script and check the type and then make variable mandatory

something like this

function onLoad(){

	if(g_form.getValue('type') == 'fulfillment'){ // give correct choice value here
		g_form.setMandatory('variables.variableName', true); // give correct variable name here
	}

}

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