Make the channel field read only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2023 02:45 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2023 03:23 AM - edited 12-24-2023 03:27 AM
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....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2023 03:26 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2023 05:38 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2023 08:32 PM
You can leverage this API isNewRecord(). Let's define an ACL Write for the specific Channel field in the table.
Sample below.
answer = current.isNewRecord();
Cheers,
Tai Vu