This project is read-only.
1
Vote

Cannot add display rules

description

After I enter a display rule and try to save the ribbon an error occured:
Application Message: The import file is invalid. XSD validation failed with the following error: 'The required attribute 'Field' is missing.'. The validation failed at: '... Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.ValueRule"><ValueRule Field="kkit_isactivated" Value="1" Default="false" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.EntityPrivilegeRule"><EntityPrivilegeRule EntityName="kkit_privilegerebook" AppliesTo="PrimaryEntity" PrivilegeDepth="Global" PrivilegeType="Write" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.ValueRule">< <<<<<ERROR LOCATION>>>>> ValueRule /></DisplayRule></DisplayRules><EnableRules><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Command.EnableRule.FormStateRule"><FormStateRule State="Create" InvertResult="true" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Command.EnableRule.RecordPrivilegeRule"><RecordPrivilegeRule AppliesTo="PrimaryEntity" PrivilegeType="Write" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Command.EnableRule.FormStateRule"><FormStateRule State="Create" InvertResult="true" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Command.EnableRule.RecordPrivilegeRule"><RecordPrivilegeRule AppliesTo="PrimaryEntity" PrivilegeType="Write" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.EnableRule.FormStateRule"><FormStateRule State="Create...'."
Exception Type: FaultException`1
Fault Action: http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/ExecuteOrganizationServiceFaultFault
Fault Code: Sender
Fault Action: http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/ExecuteOrganizationServiceFaultFault
Fault Code: Sender
Error Code: -2147188710
Error Message: The import file is invalid. XSD validation failed with the following error: 'The required attribute 'Field' is missing.'. The validation failed at: '... Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.ValueRule"><ValueRule Field="kkit_isactivated" Value="1" Default="false" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.EntityPrivilegeRule"><EntityPrivilegeRule EntityName="kkit_privilegerebook" AppliesTo="PrimaryEntity" PrivilegeDepth="Global" PrivilegeType="Write" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.ValueRule">< <<<<<ERROR LOCATION>>>>> ValueRule /></DisplayRule></DisplayRules><EnableRules><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Command.EnableRule.FormStateRule"><FormStateRule State="Create" InvertResult="true" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Command.EnableRule.RecordPrivilegeRule"><RecordPrivilegeRule AppliesTo="PrimaryEntity" PrivilegeType="Write" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Command.EnableRule.FormStateRule"><FormStateRule State="Create" InvertResult="true" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Command.EnableRule.RecordPrivilegeRule"><RecordPrivilegeRule AppliesTo="PrimaryEntity" PrivilegeType="Write" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.EnableRule.FormStateRule"><FormStateRule State="Create...'."
Error Trace: 
Message: The import file is invalid. XSD validation failed with the following error: 'The required attribute 'Field' is missing.'. The validation failed at: '... Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.ValueRule"><ValueRule Field="kkit_isactivated" Value="1" Default="false" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.EntityPrivilegeRule"><EntityPrivilegeRule EntityName="kkit_privilegerebook" AppliesTo="PrimaryEntity" PrivilegeDepth="Global" PrivilegeType="Write" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.ValueRule">< <<<<<ERROR LOCATION>>>>> ValueRule /></DisplayRule></DisplayRules><EnableRules><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Command.EnableRule.FormStateRule"><FormStateRule State="Create" InvertResult="true" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Command.EnableRule.RecordPrivilegeRule"><RecordPrivilegeRule AppliesTo="PrimaryEntity" PrivilegeType="Write" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Command.EnableRule.FormStateRule"><FormStateRule State="Create" InvertResult="true" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Command.EnableRule.RecordPrivilegeRule"><RecordPrivilegeRule AppliesTo="PrimaryEntity" PrivilegeType="Write" /></EnableRule><EnableRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.EnableRule.FormStateRule"><FormStateRule State="Create...'."
Error Details: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The import file is invalid. XSD validation failed with the following error: 'The required attribute 'Field' is missing.'. The validation failed at: '... Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.ValueRule"><ValueRule Field="kkit_isactivated" Value="1" Default="false" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.EntityPrivilegeRule"><EntityPrivilegeRule EntityName="kkit_privilegerebook" AppliesTo="PrimaryEntity" PrivilegeDepth="Global" PrivilegeType="Write" /></DisplayRule><DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command.DisplayRule.FormStateRule"><FormStateRule State="Create" Default="true" InvertResult="true" /></DisplayR... (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
I cannot save the ribbon, how can I fix that?

Greeting Daniel

file attachments

comments

Schmolch wrote Mar 14, 2015 at 2:53 AM

I was stepping into the view XML and I think your tool/or crm Needs a field attribute on form state rule because the error is:

'The required attribute 'Field' is missing.'. The validation failed at: '... Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.FormStateRule"

But a form state has no field reference!!

<DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command.DisplayRule.FormStateRule">
    <FormStateRule State="Create" Default="true" InvertResult="true" />
  </DisplayRule>

EvgenijM wrote Mar 14, 2015 at 3:25 AM

Hello!

I think you have a Value Rule, with no Field specified to check for value.
Alas, the tool currently does not validate required attributes for Display/Enable rules.

Please tell me if this solves your issue.

<DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.ValueRule">< <<<<<ERROR LOCATION>>>>> ValueRule /></DisplayRule>

Schmolch wrote Mar 16, 2015 at 9:33 PM

Hello,

the problem is, that the Display rules are not removed correctly if I remove the button and add a new button with same Name/id. I have removed the button and the Display rules still exists:
<DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.EntityPrivilegeRule">
        <EntityPrivilegeRule EntityName="kkit_privilegerebook" AppliesTo="PrimaryEntity" PrivilegeDepth="Global" PrivilegeType="Write" />
      </DisplayRule>
      <DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.ValueRule">
        <ValueRule Field="kkit_isactivated" Value="1" />
      </DisplayRule>
      <DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.ValueRule2">
        <ValueRule Field="kkit_candeactivate" Value="1" InvertResult="true" />
      </DisplayRule>
But the Botton is no longer available in the CommandUIDefinition
<CommandUIDefinition>
        <Group Id="StockManager.Form.kkit_outbound.MainTab.Actions" Command="Mscrm.Enabled" Template="Mscrm.Templates.Flexible2" Sequence="11" Title="$LocLabels:StockManager.Form.kkit_outbound.MainTab.Actions.TitleText" Description="$LocLabels:StockManager.Form.kkit_outbound.MainTab.Actions.DescriptionText" Image32by32Popup="/_imgs/ribbon/Actions_32.png">
          <Controls Id="StockManager.Form.kkit_outbound.MainTab.Actions.Controls">
            <Button Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate" Command="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Command" Sequence="20" LabelText="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.LabelText" ToolTipTitle="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.ToolTipTitle" ToolTipDescription="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Activate.Description" TemplateAlias="o1" Image16by16="/_imgs/ribbon/Enable_16.png" Image32by32="/_imgs/ribbon/Enable_32.png" />
            <Button Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate" Command="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Command" Sequence="40" LabelText="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.LabelText" ToolTipTitle="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.ToolTipTitle" ToolTipDescription="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Deactivate.Description" TemplateAlias="o1" Image16by16="/_imgs/ribbon/Disable_16.png" Image32by32="/_imgs/ribbon/Disable_32.png" />
            <Button Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite" Command="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Command" Sequence="60" LabelText="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.LabelText" ToolTipTitle="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.ToolTipTitle" ToolTipDescription="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.Overwrite.Description" TemplateAlias="o1" Image16by16="$webresource:kkit_overwrite_16x16" Image32by32="$webresource:kkit_overwrite_32x32" />
            <Button Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems" Command="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Command" Sequence="70" LabelText="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.LabelText" ToolTipTitle="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.ToolTipTitle" ToolTipDescription="$LocLabels:StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.UpdateLineItems.Description" TemplateAlias="o1" Image16by16="$webresource:kkit_update_16x16" Image32by32="$webresource:kkit_kkit_update_32x32" />
          </Controls>
        </Group>
      </CommandUIDefinition>
Now if I set a new button with the same Id the tool adds and empty Display rule in addinion with the existing rules:
<DisplayRule Id="StockManagerStockManager.Form.kkit_outbound.MainTab.Actions.DeactivateManager.Command.DisplayRule.ValueRule">
        <ValueRule  />
      </DisplayRule>
So I think its a bug while removing and adding Buttons with same id.

Greeting Daniel

Schmolch wrote Mar 16, 2015 at 10:03 PM

But there is a Workaround:
Remove the button and add a new button with a new ID. But be carefull, the dead Display rules are still alive in the ribbon XML :-)