How to make a field mandatory which is extended from other table?

devina
Kilo Contributor

Hi All,

I am not able to make a field mandatory through UI Policy as the field is an extention of a field in another table. While using client script we are not able to make it mandatory using "setMandatory" function.

Is this possible by througing errors to stop the page? If yes can anybody tell me how to do so.

If not is there any other way possible?

Please help me with this.

Thanks And Regards

Devina Khare

18 REPLIES 18

devina
Kilo Contributor

Hi All,

 

The field we are trying to make mandatory is visible into the form only on when the the other two values are filled.

The code we used to make it mandatory is given below:

 var doc=g_form.getValue('u_task_ext.u_documented_workaround_in_kedb');
 var sol=g_form.getValue('u_task_ext.u_solved_with_available_workaround_kedb');

if(doc=='Yes' && sol =='Yes')
{

//g_form.clearValue('u_task_ext.u_known_error_article');

g_form.setMandatory('u_task_ext.u_known_error_article', true);


}

Hello,

 

Sorry, a better response from me:
You can't make the field mandatory per record when you are not on the record itself.

g_form.setMandatory only works on the current record. F.ex. g_form.setMandatory('requested_by',true);

 

The client script can't reach that through dot walking. You need to call, for example, a script include or use a Reference call.

Is this a reference field: u_task_ext ? Then you need to have a script that on the server side updates the record with the new value of u_known_error_article

 

With regards

Anton Vettefyr

 

felladin
Tera Guru

Hello,

 

If I understand you correctly, on your table is a field that has been added from a different table (we had this before where we presented sc_request.requested_for on sc_req_item).

 

You should in your script be able to just use:

g_form.setMandatory('u_known_error_article',true);

As that is what the field is known as on the form. This is how we did it, atleast.

If you need to get information from a referenced field, use:

g_form.getReference('fieldname');

But use this sparingly, as it doesn't always work in all clients and it calls a lot to the server from the client.

 

Many of the solutions above, such as Dictionary Override are meant for permant change of a field. These suggestion comes from some of us thinking you meant you wanted to change mandatory for a field on a child table. Example, say you want assignment_group as mandatory on Change, but not on Task and Incident, then you do a Dictionary Override for assignment_group that says that on table Change it should be mandatory.

 

With regards

Anton

ranjith5
Kilo Explorer

I think you can do this by dictionary override.give a right click on the field name and choose the option configure dictionary.then you can find the option to make the field mandatory.I hope this works for you