locked
Field Level Security - Allow updating of fields left blank when record is created. RRS feed

  • Question

  • Hey,

    I am trying to implement some field level security on a clients CRM 2011. I set up some field security profiles, but they are not doing exactly what they want.

    On the account entity, they have a field that basically links a user to that account, kind of like an owner of the account. They want a few people to have full access to this field, which I have set up in the field security profiles.

    The problem is, they also want regular users to be able to write to this field, but only if there is not already data in it. So I set a field security profile for regular users to be able to read, and update only. What happened, is that crm treats the field as being 'created' when the record is created, regardless if there is any data in it. So unless the regular user is creating the record, they cannot write to the field at all.

    I am wondering if there is some javascript, or some workaround I can use that can accomplish what I'm looking to do.

    Thanks for any help!


    • Edited by SloneM Friday, March 8, 2013 7:09 PM
    Friday, March 8, 2013 7:08 PM

Answers

  • Hi,

    You could use javascript to writeprotect the field if the current user has any other roles than the one(s) you decide and the field has data, that's relatively simple code.

    Something along the lines of

    if(Xrm.Page.getAttribute("fieldname").getValue() != null||Xrm.Page.getAttribute("fieldname") != "")
    {   
        if(!userHasRole("thisrole")
        {   
           Xrm.Page.getAttribute("fieldname").setDisabled(true);
        }
    }

    That along with the userHasRole from This Blog should do the trick.

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Friday, March 8, 2013 9:09 PM