Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Mass conditional lock / unlock fields;tabs;section

Posted on by 25

Dear All, 

Can anyone help me to lock/unlock tabs or section?

I want to enable conditional fields editable.

Is there any script or configuration? 

I am seeking your urgent support.

Thanks,

Hema 

*This post is locked for comments

  • Suggested answer
    necsa Profile Picture
    necsa 3,455 on at
    RE: Mass conditional lock / unlock fields;tabs;section

    Hi Hema,

    Is the field ("new_cafid") on the Tab or out of Tab on the Form. If the field on the Tab that is not good way to set the Tab unvisible because you never change the value. This field must be out of the Tab which you want to set depends of condition "setVisible()". Also you cannot use "TabStateChange" event for this reason. This event occurs when a tab is expanded or collapsed. Instead of Tab use your code on the Field OnChange event. Here in your case onChange event of "new_cafid".

    I tested your code and it is working. I name the webresource as nec_lockTab (you can use any name doesn't important. Function name is same as your  ( CIFApprovedChange)

    instead of your field name ('new_cafid') I use existed field ('websiteurl') the Display name is 'Website' You can match as you wish to your environment. Upload your code to webresource.

    Here some screenshot step by step

    Open customization entity form and select Form properties.

    property.png

    add your code to form properties from webresources and select Control : Form   Event: Onload and click on the Add button.

    form-property.png

    on the Handler Properties select Library: "your code name" Function: add your function name and finaly check Enabled.

    7026.Handler-Properties.png

    again return to Form Properties and select Control: "your field display name"  Event: OnChange and click on the Add button

    field-onchange.png

    on the Handler Properties select Library: "your code name" Function: add your function name and finaly check Enabled.

    field-handler.png

    click Ok and also OK on the Form Properties and on the Entity Form select Save and then click on "Publish"

    3007.publish.png

    return to your entity and tested it must work smootly.

  • Suggested answer
    Hema Mesta Profile Picture
    Hema Mesta 25 on at
    RE: Mass conditional lock / unlock fields;tabs;section

    Hi,

    On page load and tab click event I want to disable. I have added below code in web resources as Script JS.

    function CIFApprovedChange() {

    if(Xrm.Page.getAttribute('new_cafid').getValue() == null) {

    alert ("testing");      

    Xrm.Page.ui.tabs.get('Screening').setVisible(false);

      }

      else {

          Xrm.Page.ui.tabs.get('Screening').setVisible(true);

    alert ("testing1");

      }

    }

    This library I added to form property with on load event of the form plus on change event of the tab.

    However, I am getting the following error.

    Web resource method does not exist: CIFApprovedChange()

    I don't know where I am making mistake.

    Thanks for your support.

    Hema

  • Suggested answer
    necsa Profile Picture
    necsa 3,455 on at
    RE: Mass conditional lock / unlock fields;tabs;section

    Hi Hema,

    Can you give me more detail under which condition you want to lock/unlock tabs or section.

    What is the name of tab/section you want to lock/unlock and under which condition it must work?

  • Hema Mesta Profile Picture
    Hema Mesta 25 on at
    RE: Mass conditional lock / unlock fields;tabs;section

    Thanks, Necdet. I am new to CRM technical part. Could you please assist me on how to add this code. I added it but it's throwing me an error.  

    Error message: Web resource method does not exist: Ticker Change

    What function name I should mention while adding?

    Thank you once again for your support.

    Hema

  • necsa Profile Picture
    necsa 3,455 on at
    RE: Mass conditional lock / unlock fields;tabs;section

    If you have difficulty to match to Dynamics 365 here is another reference for the Dynamics 365:

    carldesouza.com/.../

  • Hema Mesta Profile Picture
    Hema Mesta 25 on at
    RE: Mass conditional lock / unlock fields;tabs;section

    Thanks for your  reply. Is it applicable for CRM 365 as well?

  • necsa Profile Picture
    necsa 3,455 on at
    RE: Mass conditional lock / unlock fields;tabs;section

    Hi,

    You can have following links as reference:

    community.dynamics.com/.../crm2011-disable-enable-fields-sections-tabs-and-the-whole-form

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans