Thursday 7 November 2013

CRM 2013 demo builder

http://demobuilder.cloudapp.net

user must be either Microsoft Partner employee or Microsoft employee to use it.

Friday 25 October 2013

Remote Debugging

Remote debugging is the one of the most challenging things to accomplish.

To remote debug.

1. Check visual studio version, to do this go to Help -> About mine is "Microsoft Visual Studio 2010 Ultimate".

2. Google for "Microsoft Visual Studio 2010 remote debugger download"

3. Download the 64 bit installer from the Microsoft website e.g.
http://www.microsoft.com/en-gb/download/details.aspx?id=475

4. The one I needed to download was 64 bit and called "rdbgsetup_x64.exe"

5. Install the installer on the server where the web service is running

6. On the start enter 'remote debugger' and then right click the 'Visual Studio Remote Debugging Monitor (x64) from the list of available options  and select to run under 'Run as Administrator'

7. In the remote debugger go to 'Tool -> Options' and select 'No Authentication (native only) and also check 'Allow any user to debug' then copy the name from Server name at top e.g. 'TempServerbox01:4015'

8. Disable Firewall on this server

9. Go to dev box and go to tool-> Attach to process option

10. select following value from the opened 'Attach to Process'
Transport: Remote (Nateive only with no authentication)
Qualifier: TempServerbox01:4015

click on refresh button and then select wp.exe/

11. Remote debugging is all set.

No if at the break point you are getting the message of "The breakpoint will not currently be hit", Then perform following steps.

1. Turn off firewall at dev box as well as at server where the webservice is deployed, as remote debugging process will try to send and receive request at both sides

2. Where remote debugger is running, change the  Authentication mode to  Windows Authentication, and copy the server name value e.g. abc\kaleemkhan@TempServerBox1

3. On the dev box open the attach to process window and enter following values
Transport: Default
Qualifier:  abc\kaleemkhan@TempServerBox1

4. Select any wp.exe present.

Remote debugging is all set now.

Disclaimer.

I take no responsibility of above mentioned instructions and any repercussions whatsoever as firewall should never be stopped and also remote debugger should be running under authentication which off course clearly I have not abide.

Thursday 24 October 2013

This page cant be displayed


I was working on one crm org, and today when I tried to log back into system and tried accessing the page, I was getting following error screen.
 After spending bit of time. Following is the resolution I have applied.
Click on Setting icon and go to internet option

Go to 'Connections' tab and click on 'LAN settings' button

On the 'Local Area Network (LAN) Settings' make sure 'Automatically detect settings is checked and the option 'Use a proxy server for your LAN (These settings will not apply to dial-up or VPN connections)' should be un-checked.

Tuesday 24 September 2013

On press of Find Available time on Schedule service activity CRM throws "An Unexpected error occurred." error

 
On press of Find Available time on Schedule service activity CRM throws "An Unexpected error occurred." error
 
In event viewer the following error message is shown
 
The Web Service plug-in failed in OrganizationId: xxxxx-xxxx-xxxx-xxxxxxxxxxx; SdkMessageProcessingStepId: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx; EntityName: none; Stage: 30; MessageName: Search; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
   at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
Inner Exception: System.ArgumentException: Item has already been added. Key in dictionary: 'Plugin Friendly Name'  Key being added: 'Plugin Friendly Name'
   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at Microsoft.Crm.Scheduling.Engine.PluginTypeLibrary.LoadPlugins(SchedulingContext context)
   at Microsoft.Crm.Scheduling.Engine.PluginTypeLibrary.GetPluginType(String friendlyName, SchedulingContext context)
   at Microsoft.Crm.Scheduling.UserDefinedFunctionFactory.Create(IPluginTypeLibrary typeLibrary, String functionName, SchedulingContext context)
   at Microsoft.Crm.Scheduling.UdfExpression.Evaluate(SchedulingContext context, Object[] args)
   at Microsoft.Crm.Scheduling.Engine.ResourceSpecTree.EvaluateObjective(IExpression expression, IResource resource, DateTime proposalStartTime, TraceInfo traceInfo, AppointmentRequest request, Int32 leftOffset, Int32 rightOffset, SchedulingContext context)
   at Microsoft.Crm.Scheduling.Engine.ResourceSpecTree.ScoreTreeContext(NodeEntry bindEntry, TimeInterval interval, AppointmentRequest request, TraceInfo traceInfo, TimeZone userTimeZone, SchedulingContext context)
   at Microsoft.Crm.Scheduling.Engine.Strategy.Search(AppointmentRequest request, SchedulingContext schedulingContext)
   at Microsoft.Crm.Scheduling.Engine.StrategyBroker.Search(AppointmentRequest request, SchedulingContext context)
   at Microsoft.Crm.Scheduling.ScheduleSearchCommand.Execute(ISchedulingExecutionContext context)
   at Microsoft.Crm.ObjectModel.ScheduleService.Search(AppointmentRequest request, ExecutionContext context)
 
 
This is happening due to CRM is adding plugin name in some sort of dictionary and in the system it is finding plugins with the same Friendly name. The name of plugin is in  the following lines copied from above
 
Inner Exception: System.ArgumentException: Item has already been added. Key in dictionary: 'Plugin Friendly Name'  Key being added: 'Plugin Friendly Name'
 
Though the plugins are coming from totally different solutions and have there own namespace still due to we using crm developer toolkit the friendly name generated does not contains the complete name space and due to this there are duplicate friendly name exists in the system and somehow CRM scheduling engine is adding the plugin friendly names in dictionary and hence giving error.
 
Resolution is to update the plugin friendly name and make sure these are unique with in system they are going to be exported if not sure then make the friendly name include the name space of the project.

Thursday 12 September 2013

sending CRM email with just the email address only

Entity toParty = new Entity("activityparty");
toParty["addressused"] =" khan.kaleemul@gmail.com"

Entity email = new Entity("email");
email["from"]=new Entity[]{ <<from party>>};

email["to"]= new Entity[]{toParty};
email["subject"]="email subject";
email["description"]="email body";
email["regardingobjectid"]=<<"regarding entity">>;

Guid emailId = crmService.Create(email);

SendEmailRequest reqSendEmail = new SendEmailRequest();
reqSendEamil = emailId;
reSendEmail.TrackingToken = string.empty;
reqSendEmail.IssueSend = true;

crmService.Execute(reqSendEmail);

 

Monday 29 July 2013

CRM Development Toolkit issue

We are using the CRM development toolkit in our projects for sometime. Recently one of the project has stop showing the "Connect to Dynamics CRM Server" option under tools menu, not sure the exact cause of it but following actions were performed which might have caused the issue.

Defined the ALM process for the project and for this created a new crm org. Added a webservice project with in the solution of CRM dynamics project solutions. Removed silver-light project as this is not required.

Resolution:

Close the CRM project and then open the solution file in notepad and add the following lines with in the Global node.

GlobalSection(CRMSolutionProperties) = preSolution
     SolutionIsBoundToCRM = True
EndGlobalSection

Reopen the project and go to Tools and "Connect to dynamics CRM Server" option to connect to CRM server.

Wednesday 12 June 2013

CRM utilities

Metadata document generator
https://xrmtoolbox.codeplex.com/releases/view/107901

Web-resource Manager,  lists down all the web resources which do not have dependency in system.
http://mscrmtools.blogspot.co.uk/2013/06/web-resource-manager-identify-and.html

Wednesday 5 June 2013

xrm.page.getattribute does not support this object or method

When debugging Xrm.Page.getAttibute in console of ie debugger with breaking at a break point in console area was giving "xrm.page.getattribute does not support this object or method" error message.

Solution is to use: frames[0].Xrm.Page.getAttribute('attribute name').getValue()

http://stackoverflow.com/questions/12901795/object-doesnt-support-property-or-method-getattribute

Monday 3 June 2013

QueryByAttribute

QueryByAttribute query = new QueryByAttribute
{
EntityName= "new_customentity",
ColumSet= new ColumnSet(new string{"new_customfield2","new_customfield3"})
};

query.Attributes.Add("new_customfield1");
query.Values.Add("value1");

EntityCollection records = crmService.ReteriveMultiple(query);

foreach(Entity record in records.Entities)
{
  
Console.WriteLine("custom field 2 " + record["new_customfield2"]);
Console.WriteLine("custom field 3 " + record["new_customfield3"]);

}


Tuesday 28 May 2013

Associate Plugin not triggering

I have created a 1:N relation with customer to companies A plugin on assoicate is defined however when I assign company to customer plugin doesn't trigger. This plugin does trigger for any N:N relation but not for 1:N/N:1.

However when the association is defined using code it triggers plugin fine.

http://social.microsoft.com/Forums/en-US/crm/thread/9150f71c-39e3-473f-a022-ecc54ad37992

Wednesday 3 April 2013

CRM 2011 database sql investigation

--List down the name of solutions and entity/form where this label is used.
select
FriendlyName, LocalizedLabel.* from [LocalizedLabel]
inner join Solution on LocalizedLabel.SolutionId = Solution.SolutionId where LocalizedLabelId = 'localised label id'

--Published Form Xml
select FriendlyName,SystemForm.* from SystemForm inner join Solution on SystemForm.SolutionId = Solution.SolutionId where FormId = 'formid'

--Form Xml exists in solution
select FriendlyName,SystemFormBase.* from SystemFormBase inner join Solution on SystemFormBase.SolutionId = Solution.SolutionId where FormId = 'form id'

--List down the Form Xml for the solution which matches the published formxml solution

select
FriendlyName,SystemFormBase.* from SystemFormBase inner join Solution on SystemFormBase.SolutionId = Solution.SolutionId inner join SystemForm on SystemForm.FormXml = SystemFormBase.FormXml where SystemForm.FormId = 'form id'

Wednesday 13 March 2013

systemuser with Id &#61; guid Does Not Exist

I have created a crm org in one server, then imported that org from that server to dev server and then imported few solutions on top it.

things were fine however in order to diagnose one of the bug client was facing I deployed solution to debug as I used to do in my old dev machine/domain.

When solution was deployed some of the plugins were working fine however on couple of plugins I was getting following error

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: systemuser With Id &#61; 56702f79-c33a-e111-8820-00155d450361 Does Not ExistDetail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ErrorCode>-2147220969</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>systemuser With Id &amp;#61; 000000000-0000-0000-0000-000000000000 Does Not Exist</Message>
  <Timestamp>2013-03-13T10:05:18.7976683Z</Timestamp>
  <InnerFault i:nil="true" />
  <TraceText>
[Plugins:Plugins.PluginName]
[000000000-0000-0000-0000-000000000000: PluginName]
Entered Plugins.PluginName.Execute(), Correlation Id: 000000000-0000-0000-0000-000000000000, Initiating User: 000000000-0000-0000-0000-000000000000 Plugins.PluginName is firing for Entity: prefix_entityname, Message: Update, Correlation Id: 000000000-0000-0000-0000-000000000000, Initiating User: 000000000-0000-0000-0000-000000000000 Exception: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: systemuser With Id = 000000000-0000-0000-0000-000000000000 Does Not Exist (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault)., Correlation Id: 000000000-0000-0000-0000-000000000000, Initiating User: 000000000-0000-0000-0000-000000000000
Exiting Plugins.PluginName.Execute(), Correlation Id: 000000000-0000-0000-0000-000000000000, Initiating User: 000000000-0000-0000-0000-000000000000
</TraceText>
</OrganizationServiceFault>

when trying to find something from plugin registeration tool, nothing was strange, plugins are running under calling user.

REASON/Resolution: This was happing due to I am using crm development toolkit, and in RegisterFile.crmregister I am using ImpersinatingUser to run plugin under certain useraccount. and here it had old crm user GUID which was valid in different domain and crm org but for my current new crm orgs under new domain are invalid.

Tuesday 12 March 2013

SQL Profiling

I was investigating a bug on UAT environment which was one-off and apparently not reproduce able in  other environments. After spending many hours I didn't know what was causing the issue due to lack of logging and error message in event viewer. I was left with 2 options first to enable tracing on CRM server and second was to go to SQL profiling which is not a preferred option generally. However due to number of front end servers running, turning on tracing on each of them was not my preferred option in this case and I opted for SQL profiling.  I was generating SQL tracing information for the action which was giving error, and I made sure we do SQL profiling after business hours.

Before starting the profiling stop any service which can trigger lots of SQL tracing. In my case i was investigating some ui issue so I disabled Microsoft Async Service and Reporting Service for some time.
Following are the steps to do sql profiling.

Open SQL server Management studio, then go to "Tools" -> "SQL Server Profiler" option.

On Trace properties prompt shown select "Event Selection" tab.
Select "Show all events" check-box.

Expand security option and select
- Audit Login
-Audit Logout

Expand Stored Procedures option and select
-RPC output parameter
-RPC:Completed
-RPC:Starting
-SP:Completed
-SP:Starting
-SP:StmtCompleted
-SP:StmtStarting

Expand TSQL
-SQL:BatchCompleted
-SQL:BatchStarting


Thursday 21 February 2013

Could not load file or assembly 'Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral

If ISV code is giving following error

Could not load file or assembly 'Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference
This is most likely due to latest version of CRM is installed which has 5.0.0.0 assembly, and ISV code was developed using Version=4.0.0.0 crm.sdk assembly.


To solve this issue open isv code's web.config file and add following config after <configSections> node and do an iis reset code.

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

Monday 18 February 2013

An attempt was made to load an assembly from a network location


When trying to register an assembly (This assembly was extracted from existing unmanaged solution) through plugin registeration tool, i was getting following error

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\svccrmcapdev\Desktop\<<assembly name>>-<<guid>>\<<assembly name>>-<<guid>>\<<assembly name>>.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)

   at System.Reflection.Assembly.LoadFrom(String assemblyFile)

   at Microsoft.Crm.Tools.PluginRegistration.AssemblyReader.LoadAssembly(String path)

   at Microsoft.Crm.Tools.PluginRegistration.AssemblyReader.RetrievePluginsFromAssembly(String path)

   at Microsoft.Crm.Tools.PluginRegistration.AssemblyReader.RetrievePluginsFromAssembly(String path)

   at Microsoft.Crm.Tools.PluginRegistration.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly)

   at Microsoft.Crm.Tools.PluginRegistration.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e)

Inner Exception: System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

--------

Resolutions: Right click on assembly and go to properties, In General tab, next to security label following message would be shown "This file came from another computer and might be block to help protect this computer". Click on Unblock to register this assembly through plugin registeration tool. 


Thursday 24 January 2013

CRM 2011 Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service


When trying to connect to org through Plugin registration tool, was getting error.

When tried to browse http://server:5555/XRMServices/2011/Discovery.svc also was getting error and detail of error is in event viewer as 

WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/65652305
Exception: System.ServiceModel.ServiceActivationException: The service '/xrmservices/2011/Discovery.svc' cannot be activated due to an exception during compilation. The exception message is: Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service.. ---> System.NotSupportedException: Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service.
at System.ServiceModel.Activation.HostedAspNetEnvironment.ValidateHttpSettings(String virtualPath, Boolean isMetadataListener, Boolean usingDefaultSpnList, AuthenticationSchemes& supportedSchemes, ExtendedProtectionPolicy& extendedProtectionPolicy, String& realm)
at System.ServiceModel.Channels.HttpChannelListener.ApplyHostedContext(String virtualPath, Boolean isMetadataListener)
at System.ServiceModel.Channels.HttpTransportBindingElement.BuildChannelListener[TChannel](BindingContext context)
at System.ServiceModel.Channels.Binding.BuildChannelListener[TChannel](Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, BindingParameterCollection parameters)
at System.ServiceModel.Description.DispatcherBuilder.MaybeCreateListener(Boolean actuallyCreate, Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, ServiceThrottle throttle, IChannelListener& result, Boolean supportContextSession)
at System.ServiceModel.Description.DispatcherBuilder.BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, Boolean supportContextSession, IChannelListener& result)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
Process Name: w3wp
Process ID: 3648


--
When opened IIS manager Microsoft Dynamic CRM authentication was set to "Windows Authentication" but was still getting above error.

Resolution:

This was due to mistakenly someone removed "Negotiate" Provider from "Microsoft Dynamic CRM" website,
To add it back perform following steps

Start->Run-> Inetmgr -> Microsoft Dynamic CRM -> select authenticate and click open feature in action panel ->click windows authentication and click on providers in action panel-> select Negotiate from available providers dropdown list and click add, and move it to top.

Restart IIS 





Monday 21 January 2013

A currency is required message prompt


On entity form a currency type field is placed. When record is opened and some number value is added in it, I got following error message.

---------------------------
Message from webpage
---------------------------
A currency is required if a value exists in a money field. Select a currency and try again.
---------------------------
OK  
---------------------------


Resolution:

Go to File -> Option. Under General Tab go to option "select a default currency" and then click on "Currency" lookup and specify currency to use.

Wednesday 16 January 2013

Tuesday 15 January 2013

Report Server Error


In event viewer following error message was display,

“Report Server (MSSQLSERVER) cannot load the SQLPDW extension.”
“Report Server (MSSQLSERVER) cannot load the TERADATA extension.”

This is due to reporting server installed does not have SQLPDW and TERADATA extentions installed, there are two options to resolve this, first if these extensions are not used then comment configuration to not load these, and second to install these component on server. 

More details on: http://jandho.blogspot.co.uk/2012/06/report-server-cannot-load-teradata.html


Friday 11 January 2013

Error occurred while fetching the report

I exported solution from one environment and trying to import into different environment half way through on import i started getting this error "Error occurred while fetching the report" having error number 0x8004832B

Reason: Reporting server/services was not running

Resolution:  Before importing try to open and run any built in report in destination environment and make sure that is working fine, that will give you bit more detail to problem. it might be because you don't have permission on reporting server.

Wednesday 9 January 2013

Assembly must be registered in isolation

When trying to import solution Error message is coming ".... Assembly must be registered in isolation".
Error is shown as user who is trying to import solution does not have got deployment admin rights.

To resolve this open deployment manager with a user who has got access to it, and then add the user who is trying to import solution as a deployment administrator.


http://gotcrm.blogspot.co.uk/2012/02/assembly-must-be-registered-in.html

Wednesday 2 January 2013

Business Management Error

Error Message: You are attempting to create a user with a domain logon that does not exist. Select another domain logon and try again.

Reason: User is not added in CRM users area to access CRM org.