Mandatory fields in Catalog Items

Snow-Man
Tera Contributor

Hi everyone, 

 

I have a requirement that I need some 5-10 fields that should be read only on RITM 

then Read only should be false for Task 100

and again Read only should be true for Task 200, 300, 400 etc.

 

How can It be achieved?

Thanks In advance! 

1 ACCEPTED SOLUTION

Steven Parker
Giga Sage

A UI Policy can achieve Read Only for RITM.  That one is simple.

As for Tasks, a UI Policy could do it, but it would be for all catalog tasks in that workflow. Unless you had 1 field on Task 100 that didn't exist on the other tasks...then you can use a UI Policy and key off that 1 field.  If that same field was on the RITM as well, you could have 1 UI Policy.

 

If all the tasks look the same, I believe you will need to write a client script to mark those fields as Read Only on Task 200, 300, 400, etc... based on that Tasks Short Description or some other indicator field on the task.

 

So an onLoad client script that applies to catalog tasks.  Then you could do something like this:

 

function onLoad() {
var desc = g_form.getValue('short_description');
if (desc != "Whatever your Task 100 Short Description is" ) {
	g_form.setReadOnly('your_field_name',true);
	g_form.setReadOnly('your_field_name',true);
  }
	
}

 

 

Essentially if the Short Description of the task doesn't match what's in the quotes, set the fields to Read Only.  I am sure there are other ways to do it, but that should be one way.  Just have to remember if that short description changes, this script would fail.  So if you want to use another field to identify whether to Read Only fields or not then you can do so.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

View solution in original post

2 REPLIES 2

Steven Parker
Giga Sage

A UI Policy can achieve Read Only for RITM.  That one is simple.

As for Tasks, a UI Policy could do it, but it would be for all catalog tasks in that workflow. Unless you had 1 field on Task 100 that didn't exist on the other tasks...then you can use a UI Policy and key off that 1 field.  If that same field was on the RITM as well, you could have 1 UI Policy.

 

If all the tasks look the same, I believe you will need to write a client script to mark those fields as Read Only on Task 200, 300, 400, etc... based on that Tasks Short Description or some other indicator field on the task.

 

So an onLoad client script that applies to catalog tasks.  Then you could do something like this:

 

function onLoad() {
var desc = g_form.getValue('short_description');
if (desc != "Whatever your Task 100 Short Description is" ) {
	g_form.setReadOnly('your_field_name',true);
	g_form.setReadOnly('your_field_name',true);
  }
	
}

 

 

Essentially if the Short Description of the task doesn't match what's in the quotes, set the fields to Read Only.  I am sure there are other ways to do it, but that should be one way.  Just have to remember if that short description changes, this script would fail.  So if you want to use another field to identify whether to Read Only fields or not then you can do so.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Thanks a lot, It is working 100%