Thursday, June 9, 2011

Setting Attribute from javascript


Xrm.Page.getControl("neu_yearstart").setDisabled(false);
Xrm.Page.getAttribute("neu_yearstart").setValue(FiscalYearStart);
Xrm.Page.getAttribute("neu_yearstart").setSubmitMode("always");
Xrm.Page.getControl("neu_yearstart").setDisabled(true);


setSubmitMode as always will save the values to the database . if this value is not set then the value is not saved to the database but it will be visible in the front end

for example on change of one field you are setting other field then on the UI you can see the value as changed but when the user hits the save button the value is not saved to the database.


Saturday, June 4, 2011

Hide Custom Button when form is in create mode


 <RibbonDiffXml>
        <CustomActions>
          <CustomAction Id="org.button.Form.CustomAction" Location="Mscrm.Form.account.MainTab.Save.Controls._children" Sequence="1">
            <CommandUIDefinition>
              <Button Id="org.button.Form.WhatifButton" Command="org.button.Command" LabelText="What If Analysis" ToolTipTitle="Launch" ToolTipDescription="tooltip" TemplateAlias="o1" Image16by16="$webresource:neu_button16x16" Image32by32="$webresource:neu_button32x32" />
            </CommandUIDefinition>
          </CustomAction>
        </CustomActions>
        <Templates>
          <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions>
          <CommandDefinition Id="org.button.Command">
            <EnableRules>
              <EnableRule Id="org.account.WebClient.EnableRule" />
            </EnableRules>
            <DisplayRules>
              <DisplayRule Id="org.account.WebClient.DisplayRule" />
            </DisplayRules>
            <Actions>
              <Url Address="$webresource:helloworld.html" PassParams="true" WinMode="0" WinParams="width=1100,height=760,toolbar=no,location=no,resizable =yes" />
            </Actions>
          </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules>
            <DisplayRule Id="org.account.WebClient.DisplayRule">
              <FormStateRule State="Create"
                              InvertResult="true" />
            </DisplayRule>
          </DisplayRules>
          <EnableRules >
            <EnableRule Id="org.account.WebClient.EnableRule">
              <CrmClientTypeRule Type="Web" />
            </EnableRule>
          </EnableRules>
        </RuleDefinitions>
        <LocLabels />
      </RibbonDiffXml>

Add a custom button to entity ribbon



<RibbonDiffXml>
  <CustomActions>
    <CustomAction Id="org.button.Form.CustomAction" Location="Mscrm.Form.account.MainTab.Save.Controls._children" Sequence="1">
      <CommandUIDefinition>
        <Button Id="org.button.Form.WhatifButton" Command="org.button.Command" LabelText="What If Analysis" ToolTipTitle="Launch" ToolTipDescription="30 Years What If Analysis" TemplateAlias="o1" Image16by16="$webresource:neu_button16x16" Image32by32="$webresource:neu_button32x32" />
      </CommandUIDefinition>
    </CustomAction>
  </CustomActions>
  <Templates>
    <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
  </Templates>
  <CommandDefinitions>
    <CommandDefinition Id="org.button.Command">
      <EnableRules>
      </EnableRules>
      <DisplayRules>
      </DisplayRules>
      <Actions>
        <Url Address="$webresource:helloworld.html" PassParams="true" WinMode="0" WinParams="width=1100,height=760,toolbar=no,location=no,resizable =yes" />
      </Actions>
    </CommandDefinition>
  </CommandDefinitions>
  <RuleDefinitions>
    <TabDisplayRules />
    <DisplayRules/>
    <EnableRules />
  </RuleDefinitions>
  <LocLabels />
</RibbonDiffXml>

Thursday, June 2, 2011

How to pass Parameters from one Plugin Step to Ano...

How to pass Parameters from one Plugin Step to Ano...: "here is the way to pass some paramters and get in between the steps in MS CRM 2011, while writing plugin. this can be done by using SharedV..."

Wednesday, June 1, 2011

Get CRM 2011 CrmSvcUtil.exe and the Plugin Registration Tool to Work With WIF on Windows XP

Microsoft Dynamics CRM 2011 makes heavy use of the new Windows Identity Framework.   This been heavily integrated into most of the tools out there for development with the CRM 2011 platform.  This includes CrmSvcUtil.exe and the new plugin / plug-in registration tool.  This also presents a headache for anyone who would like to do any development for CRM 2011 with a Windows XP machine as WIF will not install on an XP machine.  You need to have Vista SP1+, Windows 7, or Windows Server.

It seems that there is an "unsupported" workaround for this.

1. If you were to happen to navigate to the following folder (C:\Program Files\Reference Assemblies\Microsoft\Windows Identity Foundation) on a supported machine that has the Windows Identity Framework (WIF) already installed you might find some assemblies in the directory structure and it's sub folders.

There are four assemblies in my installation:
- Microsoft.IdentityModel.dll
- Microsoft.IdentityModel.resources.dll
- Microsoft.IdentityModel.WindowsTokenService.dll
- Microsoft.IdentityModel.WindowsTokenService.resources.dll

2. If you were to happen to (accidentally of course) copy these assemblies and move them to the same folder as the CrmSvcUtil.exe file or the executable for the Plugin Registration Tool, they will function normally without needing to install the whole WIF framework package.

To build the plugin registration tool you just copy the 4 assemblies from that folder structure to the bin\debug folder and build the tool using Visual Studio.   It then functions normally.

Here is an example from the forums where someone has gotten this to work for CrmSvcUtil, and I have personally done this for the Plugin Registration Tool.  You will also notice that I was the naysayer in the thread at the time :)
http://social.microsoft.com/Forums/en/crmdevelopment/thread/8d8bd121-a34c-402d-86fd-b3c47709a0b4

I hope this helps!