Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Making fields inactive

(0) ShareShare
ReportReport
Posted on by 30

Hello community,

we have the following process: If some guy create an order in CRM he needs to start the worklow. Then some other needs to approve or decline this order. Once approved a mail is sent with this information.

I want now to add now a step that after the approval the order form fields cannot be changed any longer. Can somebody please explain to me with which step i can achieve this?

Thanks

*This post is locked for comments

  • SteffenH Profile Picture
    SteffenH 30 on at
    RE: Making fields inactive

    Thanks a lot for this answer.

    unfortunately i have no idea how and where to use the JS code. So can you please describe a bit more detailed how to process with your option number 2?

    In the approval process (which is defined as dialog field) is a step: "if approval has been given yes, then". After this clause i need to add something i guess. But which step in detail?

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    Kalpavruksh D365 CoE 2,545 on at
    RE: Making fields inactive
    Hi,
    There are 3 ways to achieve this:
    1. Javascript to disable all fields
    2. Add Step within the same workflow to deactivate the record
    3. Write Business rule (but business rule have some limitation refer URL: community.dynamics.com/.../business-rules-and-read-only-forms)
     
    However, the best options are 1 and 2.
    Code for option 1:
    add script on load of form
     

    function disableFormFields()
    {
        //check if the record field value is set to approved if yes then add below code
        
           Xrm.Page.ui.controls.forEach(function (control, index) {
               var controlType = control.getControlType();
               if (controlType != “iframe” && controlType != “webresource” && controlType != “subgrid”)
               {
                   control.setDisabled(true);
               }
           });
    }
  • SteffenH Profile Picture
    SteffenH 30 on at
    RE: Making fields inactive

    Thanks Jarrod,

    what do you mean with "You could also set up a rule that based on the state or status field certain fields are marked as read only in progression. "?

    Do you mean a business process?

  • Suggested answer
    Jarrod Williams Profile Picture
    Jarrod Williams 1,747 on at
    RE: Making fields inactive

    Assuming that the fields don't map into groups yes.  You could use a single rule or piece of JS code to set fields to read-only based on the value of another field.  For example you could have one field that says state and that could control 2 fields and another that says state 2 that controls a different field.  You could also set up a rule that based on the state or status field certain fields are marked as read only in progression. 

  • SteffenH Profile Picture
    SteffenH 30 on at
    RE: Making fields inactive

    Okay, but this would mean i need to add one Component (activate/deactivate) for each field i want to make read-only right?

  • Ahtesham Profile Picture
    Ahtesham 111 on at
    RE: Making fields inactive

    You Can Simply write Business Rule to make field read only on update of order status.

  • Suggested answer
    Saad Kabarousse Profile Picture
    Saad Kabarousse 732 on at
    RE: Making fields inactive

    Hello,

    If you want to disable the whole form fields once it is approved, you can add a workflow step, a workflow that changes the statecode of the quote to actif. i think this may help you.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans