Exception message “entityName” in CRM 2011


Hi,

We get the “entityName” exception if we haven’t specified value for LogicalName property of Entity class. (easy to figure out 🙂 )
Hope it helps!

Using Bulk Data Export tool of CRM 4.0 with CRM 2011


We need to make following changes to get the Bulk Data Export tool for CRM 4.0(http://mscrmbulkdataexport.codeplex.com/workitem/list/basic) to work with CRM 2011.

Change the app.config of the tool

http://mscrmuk.blogspot.com/2011/02/using-crm-40-assemblies-on-crm-2011.html

<runtime>
<assemblyBinding
xmlns=urn:schemas-microsoft-com:asm.v1>
<dependentAssembly>
<assemblyIdentity
name=Microsoft.Crm.Sdk
publicKeyToken=31bf3856ad364e35
culture=neutral/>

<publisherPolicy
apply=no/>
</dependentAssembly>
</assemblyBinding>
</runtime>

And add references to the 64 bit version of Microsoft.crm.sdk and Microsoft.crm.sdktypeproxy dlls. (Which we can get from its SDK)

http://www.microsoft.com/downloads/en/confirmation.aspx?familyid=82e632a7-faf9-41e0-8ec1-a2662aae9dfb&displaylang=en

http://www.box.net/shared/z6z1dcby0k

Hope it helps.

Configuring Forms Based Authentication (FBA) for SharePoint 2010


Create a new web application from Central Administration.

Select Authentication as Claims Based Authentication

Check Enable FBA checkbox and specify Membership provider name and role manager name as SqlMembers and SqlRoles.

Click on Ok to create the web application.

After successful creation of the web application create a site collection.

Navigate to C:\Windows\Microsoft.NET\Framework64\v2.0.50727 and run aspnew_regsql.exe tool there.

Follow the screen shots below to create a new database named MYFBADB.

After successful creation of the database add the following information(highlighted in yellow) to the web.config file of our FBA application

<membership
defaultProvider=i>

<providers>

<add
name=i
type=Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c />

<add
connectionStringName=SqlConn
applicationName=/
name=SqlMembers
type=System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
minRequiredPasswordLength=5
minRequiredNonalphanumericCharacters=0 />

</providers>
</membership>

<roleManager
defaultProvider=c
enabled=true
cacheRolesInCookie=false>
<providers>
<add
name=c
type=Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c />

<add
connectionStringName=SqlConn
applicationName=/
name=SqlRoles
type=System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a />

</providers>
</roleManager>
</SharePoint>
<connectionStrings>
<add
name=SqlConn
connectionString=server=crm2011;database=MYFBADB;Trusted_Connection=true />
</connectionStrings>
<system.web>

Next open the web.config of the Central admin site and add the same information added above

<roleManager
enabled=true
defaultProvider=AspNetWindowsTokenRoleProvider>
         <providers>
             <add
connectionStringName=SqlConn
                 applicationName=/
                 name=SqlRoles
                 type=System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a/>
         </providers>
     </roleManager>

         <providers>
             <add
connectionStringName=SqlConn
                 applicationName=/
                 name=SqlMembers
                 type=System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a />
         </providers>     </membership>

</SharePoint>
    <connectionStrings>
        <add
name=SqlConn
connectionString=server=crm2011;database= MYFBADB;Trusted_Connection=true />

    </connectionStrings>    
<system.web>

Lastly add the following configuration information in the web.config file of the SecurityTokenServiceApplication (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken)

    </system.net>
    <connectionStrings>
        <add
name=SqlConn
connectionString=server=crm2011;database= MYFBADB;Trusted_Connection=true />
    </connectionStrings>    <system.web>
        <membership
defaultProvider=SqlMembers>
            <providers>
                <add
connectionStringName=SqlConn
applicationName=/
name=SqlMembers
type=System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a />
            </providers>
        </membership>
        <roleManager
enabled=true
defaultProvider=SqlRoles>
            <providers>
                <add
connectionStringName=SqlConn
applicationName=/
name=SqlRoles
type=System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a/>
            </providers>
        </roleManager>
    </system.web>

That’s it.

Adding User to SharePoint Group through a custom ASP.NET web service.


I had a requirement to create a web service which would be used to add user to a SharePoint group. The code for it

[WebMethod]
public  string AddSharePointUser(string username,string password, string email){
string statusInfo = “”;
try
{
s
tring SharePointUrl = ConfigurationManager.AppSettings[“SharePointUrl”].ToString();
string SharePointGroup = ConfigurationManager.AppSettings[“SharePointGroup”].ToString();

SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite oSiteCollection = new
SPSite(SharePointUrl))
{
oSiteCollection.AllowUnsafeUpdates = true;
using (SPWeb oWebsite = oSiteCollection.OpenWeb())
{
oWebsite.AllowUnsafeUpdates = true;
SPUser spUser = oWebsite.EnsureUser(username);

SPGroup spGroup = oWebsite.SiteGroups[SharePointGroup];

spGroup.AddUser(spUser);
oWebsite.AllowUnsafeUpdates = false;

}

oSiteCollection.AllowUnsafeUpdates = false;

}});

statusInfo = “User Created Successfully”;

}
else
{
statusInfo = “User Already Exists”;

}}
catch (Exception ex)
{
statusInfo = ex.Message;

}
return statusInfo;

}

To run the web service successfully, we need to set the identity of application pool of the web service to SharePoint Administrator account.

Hope it helps.

Plugin for Resolve Case action against Incident Entity. (CRM 4.0)


We had a requirement wherein we wanted to update one of the fields in the incident record when we are resolving it through (Actionà Resolve Case).

Here we had to write a Pre-Update plugin registered on Child Pipeline against incident entity.

More on that

http://roman20007.wordpress.com/2010/04/25/resolve-case-event-in-plugin/

http://social.microsoft.com/Forums/en-HK/crmdevelopment/thread/ef1e594f-f50b-484e-a166-285429df8e4d

Hope it helps.

Calling On Demand Workflow through a Button in Ribbon (launchOnDemandWorkflow) in CRM 2011


I had to call an on demand workflow through a custom button click inside the ribbon. I thought of using launchOnDemandWorkflow function.

http://inogic.blogspot.com/2009/06/call-workflow-from-isv-button.html

But couldn’t really find a way of calling that function.

So thought of calling it through its url, which would be something like this

http://servername/orgname/_grid/cmds/dlg_runworkflow.aspx?


iObjType=10004

&iTotal=1

&sIds=%7b4BEBDCAF-8F66-E011-A475-00155D045711%7d%3b

&wfId=%7bF0ED25C7-5129-4297-8515-69DFFA0739FF%7d


function CallOnDemandWorkflow() {


var recordID = crmForm.ObjectId;


var url = http://server/org/_grid/cmds/dlg_runworkflow.aspx?iObjType=10004&iTotal=1&sIds={“ + recordID + “}&wfId={F0ED25C7-5129-4297-8515-69DFFA0739FF}”;

window.open(url);

}

However I keep getting some JavaScript Error.

Finally found out the correct way of doing so.

function CallOnDemandWF() {

var a = new Array(crmFormSubmit.crmFormSubmitId.value);

var sIds = crmFormSubmit.crmFormSubmitId.value+“;”;

var sEntityTypeCode = “10004”; //Replace this with your entity type code

var sWorkflowId = “{F0ED25C7-5129-4297-8515-69DFFA0739FF}”; //Replace this with your actual workflow ID

var iWindowPosX = 500; //Modal dialog position X

var iWindowPosY = 200; //Modal dialog position Y

var oResult = openStdDlg(prependOrgName(“/_grid/cmds/dlg_runworkflow.aspx”)+“?iObjType=” + CrmEncodeDecode.CrmUrlEncode(sEntityTypeCode) + “&iTotal=” +

CrmEncodeDecode.CrmUrlEncode(a.length) + “&wfId=” + CrmEncodeDecode.CrmUrlEncode(sWorkflowId)+ “&sIds=” + CrmEncodeDecode.CrmUrlEncode(sIds) , a, iWindowPosX, iWindowPosY);

}

Check out the thread

http://axforum.info/forums/showthread.php?t=29333

Final Output

The ribbondiffxml used is following

    <RibbonDiffXml>

            <CustomActions>

                <CustomAction

                Id=CA_MyFirstButton

                Location=Mscrm.Form.new_rip.MainTab.Workflow.Controls._children

                Sequence=31>

                    <CommandUIDefinition>

                        <Button

                        Id=B_MyFirstButton

                        Command=Cmd_JavaScript

                        LabelText=Invite Service Member

                        ToolTipTitle=Invite User

                        ToolTipDescription=Use this workflow to invite Service Member to the portal

                        TemplateAlias=o1

                        Image16by16=/_imgs/ribbon/startdialog_16.png

                        Image32by32=/_imgs/ribbon/startdialog_32.png></Button>

                    </CommandUIDefinition>

                </CustomAction>

            </CustomActions>

            <Templates>

                <RibbonTemplates

                Id=Mscrm.Templates/>

            </Templates>

            <CommandDefinitions>

                <CommandDefinition
Id=Cmd_JavaScript>

                    <EnableRules>

                        <EnableRule
Id=Mscrm.Enabled></EnableRule>

                    </EnableRules>

                    <DisplayRules></DisplayRules>

                    <Actions>

                        <JavaScriptFunction

                            Library=$webresource:new_InOut

                            FunctionName=CallOnDemandWF

                    >

                        </JavaScriptFunction>

                    </Actions>

                </CommandDefinition>

            </CommandDefinitions>

            <RuleDefinitions>

                <TabDisplayRules/>

                <DisplayRules/>

                <EnableRules/>

            </RuleDefinitions>

            <LocLabels/>

        </RibbonDiffXml>

Bye.

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓