Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Make the channel field read only

yardenKrispel
Tera Contributor

Hello, I have a task that I need to turn the channel field into a read only field, but only after the incident was created, like doing either save or sumbit, I did it right now and it doesn't work

yardenKrispel_0-1703414721279.png

yardenKrispel_1-1703414736052.png

 

 

5 REPLIES 5

Sohail Khilji
Kilo Patron

Dear @yardenKrispel ,

 

Simply use !g_form.isNewRecord() in your onload client scirpt.

 

something like this :

 

if (!g_form.isNewRecord()){

g_form.setReadOnly('contact_type', true);

}


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Saurabh Gupta
Kilo Patron

Hi,
Can you please do it as per below code in onLoad client script on incident table.

function onLoad() {
   if(g_form.isNewRecord()){
    g_form.setMandatory('contact_type',true);
g_form.setReadOnly('contact_type',false);
   }
else
{
   g_form.setMandatory('contact_type',false);
g_form.setReadOnly('contact_type',true);
}
}




Thanks and Regards,

Saurabh Gupta

Aniket Chavan
Tera Sage
Tera Sage

Hello @yardenKrispel 

Yes you can make it work by using client script and you can refer the below code:

onLoad Client Script:

if (g_form.isNewRecord) {

    g_form.setReadOnly('field_name', false);

} else {

    g_form.setReadOnly('field_name', true);

}

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,
Aniket


 

Tai Vu
Kilo Patron
Kilo Patron

Hi @yardenKrispel 

You can leverage this API isNewRecord(). Let's define an ACL Write for the specific Channel field in the table.

Sample below.

Timi_0-1703478707551.png

answer = current.isNewRecord();

Screenshot 2023-12-25 at 11.32.10.png

 

Cheers,

Tai Vu