Field needs to mandatory in one view and non-mandatory in another view

suuriya
Tera Contributor

Hi,

 

Is it possible to make a particular field as mandatory in one view and non-mandatory in another view of the form.

Example: In incident form, for short description field I want that to be mandatory in default view /ITIL view and in workspace view short description field need to be non-mandatory.

 

Is it achievable? If so, please do let me know how we can do this

1 REPLY 1

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
This is achievable using onLoad client scripts.

Sample Code:

function onLoad() {  
	var objView = getView();  


	//Self-service view  
	if (objView == 'ess')  
	{  
		g_form.setMandatory('caller_id','true');
		g_form.setMandatory('assignment_group','true');
		g_form.setReadOnly('location','true');
		g_form.setReadOnly('category','true');
		g_form.setReadOnly('subcategory','true');
		g_form.setReadOnly('description','true');
		g_form.setReadOnly('short_description','true');
		g_form.setReadOnly('impact','true');
		g_form.setReadOnly('urgency','true');
		g_form.setReadOnly('state','true');
		g_form.setMandatory('assigned_to','true');
	}
}






Thanks and Regards,

Saurabh Gupta