Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Make assignment group field read only on the incident form after saving in SOW

suryaogeti1
Tera Contributor

Once we select the assignment group and after saving the record in the incident form, the field needs to become read only in the service operations workspace, we can't change the assignment group. the below code is not giving the expected output. please help with this

 

function onLoad() {

 

    if (g_form.isNewRecord()) {
        g_form.setReadOnly('assignment_group', false);
        return;
    }

 

   
    var assignmentGroup = g_form.getValue('assignment_group');

 

    if (assignmentGroup) {
        
        g_form.setReadOnly('assignment_group', true);
    } else {
        g_form.setReadOnly('assignment_group', false);
    }

 

 
    g_form.setReadOnly('assigned_to', false);
}
7 REPLIES 7

Sachin_Nasa
Tera Guru

Hi @suryaogeti1 ,

I think you may have missed some part of the explanation, as this approach actually works as per your expectation. Let me attach the screenshot for your reference.
Sachin_Nasa_0-1776688719159.pngSachin_Nasa_1-1776688732813.png

If you found this helpful, please mark it as Helpful and Accept as Solution so it can reach others too.

 

Thanks & Regards,
Sachin Narayanasamy

When we select the value, it is changing to read only, but after saving the record, the assignment group field is getting back to normal, have you tried saving the above record.

Sachin_Nasa
Tera Guru

@suryaogeti1 , Please let me know if you still face any issues

Thanks & Regards,
Sachin Narayanasamy