web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Getting problem in while lock Entity Form Field

(0) ShareShare
ReportReport
Posted on by

I have a requirement when CRM user fill the specific field then it should lock/readonly. I have used both Business Rules and javascript for disable field and both rules are working. The problem which i am getting here that the lock field is not getting save and the entered data get remove on refreshing page. Please check the following picture hope i am able to understand my problem. Please suggest me the Solution.

181425.1.PNG6724.2.PNG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Danish,

    Please set the field property setsubmitmode= always.

    Xrm.Page.getAttribute("fieldname").setSubmitMode("always");

  • Verified answer
    Preeti Sharma Profile Picture
    2,678 on at

    Hi,

    You may need to set submit mode for field to save data forcefully on save of record.

    Please check below links for more info:

    community.dynamics.com/.../crm-2011-2013-what-does-setsubmitmode-do-and-how-does-it-work

    blogs.msdn.microsoft.com/.../microsoft-dynamics-crm-2011-force-submit-on-a-disabled-field-or-read-only-field

    Hope this helps:)

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Danish,

    Did you check by using setsubmitmode = always?

  • sardar ahmed Profile Picture
    520 on at

    Hi Danish,

    I have tried your requirement on trail. For me, business rule seems to be working fine.

    I think business rule is enough in this scenario, script is not required.

    See the below screen shot. Did it on fax field

    Screen-Shot-2018_2D00_02_2D00_19-at-1.45.00-PM.png

    Thanks and Regards

    Sardar Ahmed

  • Verified answer
    Community Member Profile Picture
    on at

    Can you tell me where I will use Submit mode in my JS

    function genericLock()

    {

        var fieldObj = Xrm.Page.getAttribute("acx_favoriteactor").getValue();

        if(fieldObj != null)

        {

                Xrm.Page.ui.controls.get("acx_favoriteactor").setDisabled (true);

        }

    }

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    You can set in form on load or on save.

  • Community Member Profile Picture
    on at

    Thank you for your Suggestion Sardar Ahmed.

    Yes business rule is working fine. Suppose i do not fill Data into Fax field and save the form. Again i open this form and edit the details along with fax field in this case Fax field data does not save .

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Please apply on your form load or on save event.

  • Verified answer
    Preeti Sharma Profile Picture
    2,678 on at

    Hi Danish,

    You can get it working as follows:

    function genericLock()

    {

       var fieldObj = Xrm.Page.getAttribute("acx_favoriteactor").getValue();

       if(fieldObj != null)

       {

               Xrm.Page.ui.controls.get("acx_favoriteactor").setDisabled (true);

    Xrm.Page.getAttribute("acx_favoriteactor").setSubmitMode("always");

       }

    }

    Thanks:)

  • Suggested answer
    Community Member Profile Picture
    on at

    Thank you Preeti Sharma. It's working fine :) :)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans