locked
CRM 2011 - 1:N contract to contract relationship association getting reversed RRS feed

  • Question

  • Here are the details:

    - 1:N contract to contract relationship defined.

    - "Child Contracts" subgrid on the Contract form. 

    - "Child Contracts" subgrid "Add Existing" button is customized on the ribbon to call JS function to filter the lookup view.

    Here's the problem, with the "Add Existing" button customized, when I "Add Existing" child contract to a parent contract, the reverse association is made. The parent contract's subgrid is blank and the parent shows up on the child contract's subgrid. Removing the customized button command solves the problem, but how is it doing that?

    Here's the ribbon.xml:

    <?xml version="1.0" encoding="utf-16"?>
    <RibbonDiffXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <CustomActions></CustomActions>
        <Templates>
            <RibbonTemplates Id="Mscrm.Templates" />
        </Templates>
        <CommandDefinitions>
            <CommandDefinition Id="Mscrm.AddExistingRecordFromSubGridStandard">
                <EnableRules>
                    <EnableRule Id="Mscrm.AppendToPrimary" />
                    <EnableRule Id="Mscrm.EntityFormIsEnabled" />
                </EnableRules>
                <DisplayRules>
                    <DisplayRule Id="Mscrm.AddExisting" />
                    <DisplayRule Id="Mscrm.ShowForOneToManyGrids" />
                    <DisplayRule Id="Mscrm.AppendToPrimary" />
                    <DisplayRule Id="Mscrm.AppendSelected" />
                    <DisplayRule Id="Mscrm.CanWriteSelected" />
                </DisplayRules>
                <Actions>
                    <JavaScriptFunction FunctionName="filterSubgridLookup" Library="$webresource:new_ctrl_contracts_lookup.js">
                        <CrmParameter Value="SelectedEntityTypeCode" />
                        <CrmParameter Value="SelectedControl" />
                        <CrmParameter Value="PrimaryEntityTypeName" />
                    </JavaScriptFunction>
                </Actions>
            </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
            <TabDisplayRules />
            <DisplayRules>
                <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.CanWriteSelected">
                    <EntityPrivilegeRule PrivilegeType="Write" PrivilegeDepth="Basic" AppliesTo="SelectedEntity" />
                </DisplayRule>
                <DisplayRule Id="Mscrm.ShowForManyToManyGrids">
                    <RelationshipTypeRule AppliesTo="SelectedEntity" RelationshipType="ManyToMany" />
                </DisplayRule>
                <DisplayRule Id="Mscrm.ShowForOneToManyGrids">
                    <RelationshipTypeRule AppliesTo="SelectedEntity" RelationshipType="OneToMany" />
                </DisplayRule>
                <DisplayRule Id="Mscrm.AddExisting">
                    <ReferencingAttributeRequiredRule Default="false" 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>
    </RibbonDiffXml>

    Any help is much appreciated.


    • Edited by roslynese Friday, January 8, 2016 3:27 PM
    Friday, January 8, 2016 3:21 PM

All replies