Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

save form

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

hi all

i set disable a field on form with codes :

Xrm.Page.data.entity.attributes.get("new_field").setDisable(true);

Xrm.Page.data.save();

it works and locks field but when i refresh the page it get back to its first state  and not locked.

how can i save form after lock it??

please help me

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: save form

    thank you very much

  • Verified answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: save form

    OK. In that case you will need to call the disableFields function on the click of a button, as well as on the form load event.

    You should add a new field to your form called lockFields, and when the button is clicked set the value of that field to true. When you load the form, check if the value of the new field you created is true. If it is, call the disableFields function.

    Hope this helps.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: save form

    IGNORE. WRONG ACCOUNT.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: save form

     i use above code with ribbon workbench.

    i want to locks field when the button is clicked

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: save form

    You need to set the same logic in your form load event.

    After the form is saved, the form is basically reloaded.

    What is your logic for locking the fields?

    If you are locking them in the new form, then you need to add code to your formLoad event:

    function formLoad()

    {

      var formType = Xrm.Page.ui.getFormType();

      if (formType != 1)

         disableFields();

    }

    Hope this helps.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,387 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans