web
You’re offline. This is a read only version of the page.
close
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

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

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

  • Community Member Profile Picture
    on at

     i use above code with ribbon workbench.

    i want to locks field when the button is clicked

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    IGNORE. WRONG ACCOUNT.

  • Verified answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

  • Community Member Profile Picture
    on at

    thank you very much

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans