Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to Disable and Enable Fields of Quick Create Form According to Different Grid of Same Entity(Contact)

(0) ShareShare
ReportReport
Posted on by 351

Hello

 i have one requirement that i want to disable and enable some of the fields on quick create form according to grid of same entity.

like we have two grid on Account

1.Contact grid

2.Contact SRImage

Btoh have relation with Contact entity.

here are the screenshots of both grid's properties:

1.Contact grid

4353.grid1.PNG

2.Contact xyzz

grid-2.PNG

so would i do this using through JS or any other way?????

Thanks & Reagrds

Yash

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at
    RE: How to Disable and Enable Fields of Quick Create Form According to Different Grid of Same Entity(Contact)

    Hi partner,

    As I mentioned before, there are two parts.

    1.Get the current sub grid control name when you click on ribbon.

    You could pass a CRM parameter "selectedControl" in your ribbon command.

    And in your ribbon JS function, get this parameter. 

    For example, below code is my JS function in ribbon.

    function openQuickContact(selectedControl){
        var controlName=selectedControl._controlname;
    }
    And you could get the subgrid name by "selectedControl._controlName".
    2.After you get the subgrid name successfully, you should pass it to quick create form, so you need to use "Xrm.Utility.openQuickCreate(entityLogicalName,createFromEntity,parameters)" function to pass parameters and open contact quick create form, and then add the same parameter name in contact create form properties. 
    After that, you will be able to get the subgrid name in contact create form onload event like 
    function OnloadCreateForm(subName_1){
      var controlName=subName_1;
    }
    Regards,
    Leo
  • Yash Trivedi CRM Profile Picture
    351 on at
    RE: How to Disable and Enable Fields of Quick Create Form According to Different Grid of Same Entity(Contact)

    Hi Leo,

    i want to access that "control" value on my "Quick Create" from using script can you tell me how should i do it?

    and i have done still here from above you mention:

    "2.How to get parameter in quick create form?

    Go to form editor->form properties->parameters. For example I passed a parameter named "subName_1"."

    and i am also able to open Quick Create from onclick of custom button.

    Thanks & Regards,

    Yash

  • LeoAlt Profile Picture
    16,331 Moderator on at
    RE: How to Disable and Enable Fields of Quick Create Form According to Different Grid of Same Entity(Contact)

    Hi partner,

    First of all, if you add a ribbon on contact sub grid tab in Ribbon Workbench, this ribbon will only show in contact sub grids. And there will always be some cache in D365 which may cause the new ribbon doesn't show correctly.

    So I recommend you to clear the cache and cookie and try again.

    Regards,

    Leo

  • Yash Trivedi CRM Profile Picture
    351 on at
    RE: How to Disable and Enable Fields of Quick Create Form According to Different Grid of Same Entity(Contact)

    First Thank you for your replay,

    here i have account parent entity and on that i have six different sub grid like(Contact,ContactSRImage,Opportunity, and so on) so that custom button i want to add only ContactSRImage subgrid and i have created one custom button on grid in ribbon but it will not display on that grid so can you tell me how should i do this?

    Regards,

    Yash

  • Verified answer
    LeoAlt Profile Picture
    16,331 Moderator on at
    RE: How to Disable and Enable Fields of Quick Create Form According to Different Grid of Same Entity(Contact)

    Hi partner,

    You could do this by JS code, but it is really a big work to overwrite the default creating function in add button in sub grid.

    I suggest that you could create a new Add ribbon in sub grid and use "Xrm.Utility.openQuickCreate(entityLogicalName,createFromEntity,parameters).then(successCallback, errorCallback)" to open the contact quick create form and pass the name of the subgrid which your are using currently and then get the parameter in contact quick create form to confirm which field should be locked.

    Here are the details.

    1.How to get current subgrid information in ribbon.

    Add a CRM Parameter "selectedControl" in command.

    pastedimage1587002612225v2.png

    pastedimage1587003358632v4.png

    We could get the sub grid name in "selectedControl._controlName".

    2.How to get parameter in quick create form?

    Go to form editor->form properties->parameters. For example I passed a parameter named "subName_1".

    pastedimage1587002677932v3.png

    Hope it helps.

    Best Regards,

    Leo

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 61

Overall leaderboard

Product updates

Dynamics 365 release plans