Display (Read Only) Information from Other Records

jcanuel
Kilo Explorer

I have a form that needs to display information from another record. The problem is that if I use the "Personalize Form Layout" feature to add the associated field, it appears in the form with the original attributes (Mandatory, Editable). Is there a way to have this field Read Only ?

3 REPLIES 3

salemsap
Tera Expert

Hi,


Better write a client script or ui policy to make that field as readonly.


To make that field readonly.first u need to make the mandatory as false and then set it as readonly.


You can do it like,


g_form.setMandatory('reference_field_name.fieldname',false);


g_form.setReadOnly('reference_field_name.fieldname',true);


Thank you Alex,


It works fine with a UI Policy.


Is there a way to hide the lable for that associated field. I dont see any method to do that with the g_form object ?


Anurag Tripathi
Mega Patron
Mega Patron

Hi Jacques,



Since you are saying that you have to display the fields from a different record (i assume that this record will be associated from your record through a reference field)


So what you can do is pull these fields on your form by personalizing form layout . Now create a client script on your form and using the client script you can make all these fields read only.



g_form.serMandatory("incident.caller_id", false);


g_form.serReadOnly("incident.caller_id", true);     //assuming you cave pulled the caller id field from incident table



use the same for all the fields, n the same order.


-Anurag