Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Sub Grid - Get Add New to create record or hide Lookup

Posted on by Microsoft Employee

Hi Everyone,

I wanted to have effectively a table with related records to parent and for the child records to only ever be visible to the parent.

I created an entity. Added a sub grid.

Trouble is.. Add New starts a lookup. If I click Mag Glass... I get records for other parents even though I only see the related records in the sub grid view.

Posts say make related field business required to make Add New do this. But it is business required in the child entity as I reused name field

And in Contact which it is related to... I have linked to the Contact entity not any particular field

a) Please suggest better way to achieve this.

b) Advise how to hide lookup

c) Make Add New go straight to new record and have NO lookup.

CRM 2016 On-Premise

Thanks everyone

R

*This post is locked for comments

  • MMK Profile Picture
    MMK 745 on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    Hi Scott Durow,

    Awesome that helped me a lot

    i was toooooooo frustrated why the its not working .. :)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    Hey All... trying to get Ribbon Workbench working so I can edit the command bar.

    But I just get the following error when I try to use a solution.. new one too and even on a virgin new Org as a test.

    Any help please peeps... Just did a regular on-premise install...

    Server stack trace:

      at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrImmutable()

      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

    Exception rethrown at [0]:

      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

      at System.ServiceModel.ICommunicationObject.Open()

      at Microsoft.Crm.Sandbox.SandboxClientBase`1.Open()

      at Microsoft.Crm.Sandbox.SandboxClientBase`1.get_Proxy()

      at Microsoft.Crm.Sandbox.SandboxCallbackService.ProcessException(Exception e, SandboxSdkClient client)

      at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)

      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)

      at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

    Exception rethrown at [1]:

      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

      at Microsoft.Crm.Sandbox.ISandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)

      at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request)

      at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.RetrieveMultipleInternal(QueryBase query)

      at RWB2016.Plugins.RibbonCustomisationsPlugin.GetSolutionRecord(LocalPluginContext localContext, String solutionUniqueName)

      at RWB2016.Plugins.RibbonCustomisationsPlugin.GetSolutionDetails(LocalPluginContext localContext, ITracingService trace, String inputData)

      at SparkleXrm.Plugins.Plugin.Execute(IServiceProvider serviceProvider)

    Stack Trace:

    Error:

      at Xrm_Sdk_OrganizationServiceProxy$endExecute (:5555/MyOrganisationName/%7B636242554040000079%7D/WebResources/rwb_/js/ClientUI.js:4673:13)

      at Anonymous function (:5555/MyOrganisationName/%7B636242554040000079%7D/WebResources/rwb_/js/ClientUI.js:19463:5)

      at delegate (:5555/MyOrganisationName/%7B636242554040000079%7D/WebResources/rwb_/js/ClientUI.js:2223:13)

      at xmlHttpRequest.onreadystatechange (:5555/MyOrganisationName/%7B636242554040000079%7D/WebResources/rwb_/js/ClientUI.js:4723:25)

    Trace:

    [RWB2016.Plugins: RWB2016.Plugins.RibbonCustomisationsPlugin]

    [ac49cdfa-aeef-e611-81d5-0800278d9765: Ribbon Workbench Action]

    Entered RWB2016.Plugins.RibbonCustomisationsPlugin.Execute(), Correlation Id: 3c465c94-a366-44ea-a659-74084d7275d1, Initiating User: 336f45d2-6ef0-e511-80c0-00155d00f300

    RWB2016.Plugins.RibbonCustomisationsPlugin is firing for Entity: none, Message: rwb_CustomiseRibbon, Correlation Id: 3c465c94-a366-44ea-a659-74084d7275d1, Initiating User: 336f45d2-6ef0-e511-80c0-00155d00f300

    Reading operation

    Running method

    Exception: System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.

    Server stack trace:

      at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrImmutable()

      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

    Exception rethrown at [0]:

      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

      at System.ServiceModel.ICommunicationObject.Open()

      at Microsoft.Crm.Sandbox.SandboxClientBase`1.Open()

      at Microsoft.Crm.Sandbox.SandboxClientBase`1.get_Proxy()

      at Microsoft.Crm.Sandbox.SandboxCallbackService.ProcessException(Exception e, SandboxSdkClient client)

      at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)

      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)

      at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

    Exception rethrown at [1]:

      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

      at Microsoft.Crm.Sandbox.ISandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)

      at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request)

      at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.RetrieveMultipleInternal(QueryBase query)

      at RWB2016.Plugins.RibbonCustomisationsPlugin.GetSolutionRecord(LocalPluginContext localContext, String solutionUniqueName)

      at RWB2016.Plugins.RibbonCustomisationsPlugin.GetSolutionDetails(LocalPluginContext localContext, ITracingService trace, String inputData)

      at SparkleXrm.Plugins.Plugin.Execute(IServiceProvider serviceProvider), Correlation Id: 3c465c94-a366-44ea-a659-74084d7275d1, Initiating User: 336f45d2-6ef0-e511-80c0-00155d00f300

    Exiting RWB2016.Plugins.RibbonCustomisationsPlugin.Execute(), Correlation Id: 3c465c94-a366-44ea-a659-74084d7275d1, Initiating User: 336f45d2-6ef0-e511-80c0-00155d00f300

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    I think Ribbon workbench is the best option.

    As I cannot do what other posts are suggesting.

    But unfortunately it errors when I try to use it... The software writer did send one message. But nothing more...

    So I am stuck again.

    R

  • Suggested answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    Hi

    What Nadeeja said is correct. N:N lookup only existing button will display if you still want then add custom code to open the entity record in the + button in the subgrid using ribbon work bench

    msdn.microsoft.com/.../jj602956.aspx

    or

    Create the button in the html webresource and open the entity

    msdn.microsoft.com/.../jj602956.aspx

  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    Hi Alagu,

    If you create a lookup it becomes a 1:N relationship.  You can create a N:N relationship directly. Please see below.

    technet.microsoft.com/.../dn531171.aspx

  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    Hi Romolo,

    The parent lookup in child entity mandatory rule doesn't apply for N:N relationships.

    community.dynamics.com/.../availability-of-add-new-and-add-existing-buttons-in-sub-grids

  • Suggested answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    without creating lookup how do you have many to many realtionship

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    Sorry everyone. I was replying by email but that does not seem to populate a response

    I do not have a 'Contact' field within the child entity.

    Renamed Name field on child entity and added a Date field

    Created Many to many relationship against Contact.
    Dropped a sub grid onto the Main Contact Form.
    I do not have a lookup field on the child entity to make mandatory.

    Can you guys be more specific as I might be doing 2+2 = 5 :)

    Thanks

    R

  • Suggested answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: Sub Grid - Get Add New to create record or hide Lookup

    Hi

    In  your child entity make parent entity lookup field as mandatory

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans