how can I have different ui policies for different catalog tasks?

Kim Duffy
Kilo Contributor

I need to have a task with an editable field, the same field should be read only on the next task

3 REPLIES 3

Prateek kumar
Mega Sage

If there is any differentiating factor between these two tasks, make your UI policy configured on this field.

Please mark my response as correct answer and helpful if it helped solved your question.
-Best Regards
Prateek kumar


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Swapnil Soni1
Giga Guru

Hi Kim,

Select the check box to apply the UI policy on a Requested Item form. Available in the fulfiller view. See VEditor.

To support a catalog UI policy or a catalog client script on the VEditor for requested items and catalog tasks, select the Applies on Requested Items and Applies on Catalog Tasks check boxes for the catalog UI policy or the catalog client script.

 

And Please go through this link maybe this helps

https://docs.servicenow.com/bundle/madrid-it-service-management/page/product/service-catalog-managem...

 

Please hit helpful or correct.

Thanks

Swapnil

 

Brad Bowman
Kilo Patron
Kilo Patron

Hi Kim,

We have had a similar requirement, and what comes next is to make certain variables mandatory on certain tasks.  It can get out of hand, but we like to deliver what's asked for without going too far out of box.

You can create a catalog UI policy to make the variable read-only (or mandatory) on tasks - whatever will work for the majority of tasks.  Then you'll want to create an onLoad client script (not catalog) on the sc_task table to override this in certain cases.  In the below example I have 2 tasks, so no UI policy, but you can adapt it when you see what I'm getting at.  The client script will make the variable(s) read-only (or read-write, or mandatory, or not,...) based on the task, and you might as well specify the catalog item in case multiple catalog items wind up with the same task short description.  I'm setting the estimated completion date variable mandatory for one task on one catalog item, and the ip address variable read-only on a task in a different catalog item - which is finally getting down to what you asked about.  So we have this one script to control whenever anyone asks for certain tasks on whichever catalog item to have read-only or mandatory variables.

function onLoad(){
  if(g_form.getValue('request_item.cat_item') == '4f87518fdbec0f004a29df6b5e96195c'){ // catalog item build physical server
if(g_form.getValue('short_description') == 'Validate Build & Capacity'){ //task name
g_form.setMandatory('v_estimated_completion_date', true);
}
}

if (g_form.getValue('request_item.cat_item') == '1178218cdbd9cb0084b85d6e5e961965'){ // order network circuit
if(g_form.getValue('short_description') == 'Order Circuit'){
g_form.setReadOnly('v_ip_address', true);
}
}
}