Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

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

Posted on by 335

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
    LeoAlt 16,329 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
    Yash Trivedi CRM 335 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
    LeoAlt 16,329 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
    Yash Trivedi CRM 335 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
    LeoAlt 16,329 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

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