Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Set Lookup field to Read-Only

Posted on by 70

Hi,

I don't manage to set my Lookup entity field to Read-Only mode on my form... Even if I clicked on "Field is read-only", then "Save" and then "Publish". How can I do that please ?

Regards,

Camille

2018_2D00_05_2D00_30-14_5F00_07_5F00_58_2D00_Form_5F00_-Product.png

*This post is locked for comments

  • Faisal Hussona Profile Picture
    Faisal Hussona 5 on at
    RE: Set Lookup field to Read-Only

    $('#can_reportedbycontact').attr("readonly","readonly");//lookup field
    $('#can_reportedbycontact').parent().find('.input-group-btn').hide();

  • Camille Pantin Profile Picture
    Camille Pantin 70 on at
    RE: Set Lookup field to Read-Only

    Hi,

    Indeed, this error is due to custom code.

    I think this is this code that block me from making this field read only.

    Thank you all for your help

    Regards

    Camille

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Set Lookup field to Read-Only

    Hi ,

    The  error is coming from different function called Disableddivision.  Please check in the function some control is getting  null. So you need to do null check and then getValue from control.

  • Camille Pantin Profile Picture
    Camille Pantin 70 on at
    RE: Set Lookup field to Read-Only

    Hi Goutam,

    I tried this javascript but I get this error, even after removing it, after clearing cache and even after removing the fiel from my form :2018_2D00_05_2D00_30-16_5F00_32_5F00_13_2D00_Product_5F00_-ATLANS-Post_2D00_Processing-Software.png
    Could you help me removing it please ?

    Thank you & regards,

    Camille

  • Verified answer
    Justinjose Profile Picture
    Justinjose 2,707 on at
    RE: Set Lookup field to Read-Only

    Hi Camille,

    It should work. Can you give a try publishing all solutions and try in Private or Incognito  mode in the browser. Just to make sure caching is not causing the issue. Also try on a different lookup field for a test.

    Thanks

    Justin Jose

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Lookup field to Read-Only

    Hi Camille,

    Silly question, but might be worth asking, did you refresh your main page browser AFTER you published the changes?

    Publishing any changes on any entity does not show up on an entity page until it is either refreshed or reopened.

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Set Lookup field to Read-Only

    Hi Camillie,

    Ideally its should work , not sure I am assuming some other customization making the field unlock.  Try to create one business rules or may be use javascript in the onload method see how its behave.

           function FieldDisable() {
                
                    Xrm.Page.getControl("lookupFieldName").setDisabled(true);
                    Xrm.Page.getAttribute("LookupFieldName").setSubmitMode("always");
               
           }


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,232 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans