Saturday, December 24, 2011

Loading JSON in your CRM ribbon

Add an enable rule in your customizations.xml and put the following
  <EnableRules>
            <EnableRule Id="Atif.new_customentity.WebClient.EnableRule">
              <CrmClientTypeRule Type="Web" />
              <CustomRule Library="$webresource:agd_/scripts/json2.js" FunctionName="isNAN" Default="true"></CustomRule>
            </EnableRule>
          </EnableRules></EnableRules>

Next in your Command Definition you need to put the display rule defined above.
  <CommandDefinition Id="Atif.new_customentity.SubGrid.AddSecondAssessment.Command">
            <EnableRules>
              <EnableRule Id="Atif.new_customentity.WebClient.EnableRule" />
            </EnableRules>
            <DisplayRules>
              <DisplayRule Id="Atif.new_customentity.WebClient.DisplayRule" />
            </DisplayRules>
            <Actions>
              <JavaScriptFunction Library="$webresource:agd_/scripts/Ribbonfunctions.js" FunctionName="AddSecondAssessment">
                <CrmParameter Value="FirstPrimaryItemId" />
                <CrmParameter Value="OrgName" />
              </JavaScriptFunction>
            </Actions>
          </CommandDefinition>
        </CommandDefinitions>
Now when your ribbon loads JSON will be loaded as well and you can use it in any of your custom ribbon javascript functions.

Happy CRMing!

1 comment:

  1. JackpotCity Casino Site - LuckyClub Live
    JackpotCity Casino. 3D-Screen luckyclub 3D-Sorted Odds Game - Available in Any Game ✓ Mobile Friendly ✓ Fast Payouts ✓ Play With or Without Deposits.

    ReplyDelete