locked
Contact 'Add Existing' showing Existing Account in CRM 2011? RRS feed

  • Question

  • Hello,

    I was having one customization of hiding 'Add Existing' Contact ribbon button on 'new_training' Entity.

    I did that using CRM Context Rule.

    But now i am having a problem, when i click 'Add Existing' Contact ribbon button on other than the 'new_training' entity, it shows me Account data than Contacts.

    Please help me in this.

    I modified RibbonDiff xml to below for Contact Entity.

    <RibbonDiffXml>
            <CustomActions />
            <Templates>
              <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
            </Templates>
            <CommandDefinitions>
              <CommandDefinition Id="Mscrm.AddExistingRecordFromSubGridAssociated">
                <EnableRules>
                  <EnableRule Id="Mscrm.AppendToPrimary" />
                  <EnableRule Id="Mscrm.EntityFormIsEnabled" />
                </EnableRules>
                <DisplayRules>
                  <DisplayRule Id="new.contact.DisplayRule4.DisplayRule" />
                  <DisplayRule Id="Mscrm.AddExisting" />
                  <DisplayRule Id="Mscrm.AppendSelected" />
                  <DisplayRule Id="Mscrm.AppendToPrimary" />
                  <DisplayRule Id="Mscrm.ShowForManyToManyGrids" />
                </DisplayRules>
                <Actions>
                  <JavaScriptFunction FunctionName="Mscrm.GridRibbonActions.addExistingFromSubGridAssociated" Library="/_static/_common/scripts/RibbonActions.js">
                    <CrmParameter Value="PrimaryEntityTypeCode" />
                    <CrmParameter Value="SelectedControl" />
                  </JavaScriptFunction>
                </Actions>
              </CommandDefinition>
            </CommandDefinitions>
            <RuleDefinitions>
              <TabDisplayRules />
              <DisplayRules>
                <DisplayRule Id="Mscrm.AddExisting">
                  <ReferencingAttributeRequiredRule Default="false" InvertResult="true" />
                </DisplayRule>
                <DisplayRule Id="Mscrm.AppendSelected">
                  <EntityPrivilegeRule PrivilegeType="Append" PrivilegeDepth="Basic" AppliesTo="SelectedEntity" />
                </DisplayRule>
                <DisplayRule Id="Mscrm.AppendToPrimary">
                  <EntityPrivilegeRule PrivilegeType="AppendTo" PrivilegeDepth="Basic" AppliesTo="PrimaryEntity" />
                </DisplayRule>
                <DisplayRule Id="Mscrm.ShowForManyToManyGrids">
                  <RelationshipTypeRule AppliesTo="SelectedEntity" RelationshipType="ManyToMany" />
                </DisplayRule>
                <DisplayRule Id="new.contact.DisplayRule4.DisplayRule">
                  <FormEntityContextRule EntityName="new_training" Default="true" InvertResult="true" />
                </DisplayRule>
              </DisplayRules>
              <EnableRules>
                <EnableRule Id="Mscrm.AppendToPrimary">
                  <RecordPrivilegeRule PrivilegeType="AppendTo" AppliesTo="PrimaryEntity" />
                </EnableRule>
                <EnableRule Id="Mscrm.EntityFormIsEnabled">
                  <FormStateRule State="Disabled" InvertResult="true" />
                </EnableRule>
              </EnableRules>
            </RuleDefinitions>
            <LocLabels />
          </RibbonDiffXml>

    Please help.


    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 13, 2013 7:00 AM

Answers

  • Hi,

    If you want to hide the 'Add Existing' button for a specific sub grid - you simply need to make the relationship lookup attribute mandatory. You don't need to customise the ribbon xml.

    hth


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 13, 2013 8:33 AM
    Answerer

All replies

  • Hi,

    If you want to hide the 'Add Existing' button for a specific sub grid - you simply need to make the relationship lookup attribute mandatory. You don't need to customise the ribbon xml.

    hth


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 13, 2013 8:33 AM
    Answerer
  • How can we do that ?

    Can you explain me with some example ? I really dont get how it will be done through what you said.


    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 13, 2013 12:39 PM
  • You need to go into the entity customisations for your solution -> Entities -> Contact -> Attributes -> Locate the attribute that is a lookup to the new_Training entity.

    Open this attribute and mark the 'Requirement Level' as 'Business Required' 

    It just occurred to me though - is this a 1:N or N:N relationship?

    hth


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 13, 2013 12:56 PM
    Answerer
  • It is N:N .

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Wednesday, August 14, 2013 10:06 AM