Tuesday 28 October 2014

SharePoint 2010 :- 'Activate Features'. A timeout has occurred while invoking commands in SharePoint host process.

When trying to deploy a SharePoint project getting Error Message:
Error occurred in deployment step 'Activate Features'. A timeout has occurred while invoking commands in SharePoint host process.

After doing a bit of search found every second article was saying to specify the time in the key

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\SharePointTools key, and then add a time out to 'ChannelOperationTimeout' to something like 240 for 4 mins time out.

but the issue I was getting in my system I only had path up to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0

Resolution

Open Regedit
go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0
Create a new Key (folder) SharePointTools
Create a DWORD entry called ChannelOperationTimeout
Specify the value of 480

I used the 480 as the project I was trying to deploy actually took 06.14 mins

Wednesday 24 September 2014

Ribbon button display issue

I was involved in the issue of finding why one of the ribbon button R1 was not shown when deployed at client environment, after checking the entity ribbon diff xml everything looked fine, I started investigating into the database side of it.

After investigation I found that there was an old solution1 which used to refer the same entity but at that time the ribbon button which should be shown was not included in it.
Later on it was decided the correct place for the entity is solution2 and a new ribbon button R1was added on it afterward and entity was removed from solution1.

Theory says the ribbon xml should be merged instead of overwritten, but actually what's happening is the last one wins, so I updated installation instruction document to re-import soution2 when solution1 is deployed to make sure ribbon button appears correctly. This could be due to same publisher is in use for both solution1 and solution2.

Other option.
As any managed change deployed can not be removed from the system unless the managed solution which installed it is uninstalled but doing this would cause the import data to be deleted. one option we could use is to create a new solution3 with the same publisher for solution1 with the changes we like to keep in the system and then after installation of the solution3 uninstall solution1 doing this will keep the entities, records in the system as referred by solution3, but will take any change no longer required i.e. entity with R1, this would cause the deletion of any layers/records defined in the database due to solution1 initial import.

but the reason we didn't got with this option and stick for the installation instruction to re-import is the level of risk involved in uninstallation.

Thursday 4 September 2014

Permission denied - javascript prompt

In development environment when trying to make ajax call using the ActiveX object post request was getting following error

Permission denied.


Resolution

Add the website the request is made to trusted site along with the one the site is making the request.

if the dialog is disabled due to enforced policies, use the following register key and delete it and then reopen the browser, this will let you add site to trusted area


HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings

Reduce the trust security to low

(before making any change to register please take a backup, and to reduce the trusted security level you should know the implication).

This is not in any shape the desired solution and should be avoided if possible.

Monday 1 September 2014

getting the related view values from the lookup field

 
 
 

returns the  schema name of the field1
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[0].name

returns the  value of the field1
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[0].value


 returns the schema name of field2
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[1].name

returns the value of the field2
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[1].value

Wednesday 27 August 2014

After installing Rollup 16/17, i started getting Syntax Error (it happens on RU 12+)

I upgraded my crm 2011 org from Rollup 5 to 16/17. After installing rollup when I try to refresh page or close page,  I started getting following error

Microsoft Dynamics CRM Error Report Contents
<CrmScriptErrorReport>
  <ReportVersion>1.0</ReportVersion>
  <ScriptErrorDetails>
   <Message>Syntax error</Message>
   <Line>1</Line>
   <URL>/userdefined/edit.aspx?etc=10083&id=%7bD659C33F-2C2D-E411-A69D-00155DC1050C%7d&pagemode=iframe</URL>
   <PageURL>/userdefined/edit.aspx?etc=10083&id=%7bD659C33F-2C2D-E411-A69D-00155DC1050C%7d&pagemode=iframe</PageURL>
   <Function></Function>
   <CallStack>
   </CallStack>
  </ScriptErrorDetails>
  <ClientInformation>
   <BrowserUserAgent>Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0E; .NET4.0C)</BrowserUserAgent>
   <BrowserLanguage>en-US</BrowserLanguage>
   <SystemLanguage>en-US</SystemLanguage>
   <UserLanguage>en-GB</UserLanguage>
   <ScreenResolution>1829x1029</ScreenResolution>
   <ClientName>Web</ClientName>
   <ClientTime>2014-08-27T13:47:55</ClientTime>
  </ClientInformation>
  <ServerInformation>
    <OrgLanguage>1033</OrgLanguage>
    <OrgCulture>1033</OrgCulture>
    <UserLanguage>1033</UserLanguage>
    <UserCulture>1033</UserCulture>
    <OrgID>{6D7D42E2-F413-E411-B524-00155DC1050C}</OrgID>
    <UserID>{8594944A-FE13-E411-B524-00155DC1050C}</UserID>
    <CRMVersion>5.0.9690.4156</CRMVersion>
  </ServerInformation>
</CrmScriptErrorReport>

When I press F12 to see the error in IE developer tool it shows

edit.aspx?etc=....
<!DOCTYPE HTML PULBIC "..//W3C//DTD HTML 4.0 Transitional//EN">
<!DOCTYPE html PUBLIC "" ""><HTML>...



After doing bit of search I found out that this has started happening after Rollup 12+

Resolution:
Make sure all the javscript libraries are starting with the $webresource: prefix



http://dynam1cscrm.wordpress.com/2013/03/25/visual-ribbon-editor-calling-javascript-function-syntax-error-after-upgraded-to-crm-2011-rollup-12/

Tuesday 26 August 2014

After installing RU 16 and then 17, one of the working webservice stopped working

We have a webservice  which was built using 32 bit dll and is used within crm, for that purpose we created a new application pool to run for .net 4 but to allow 32 bit application to run.
This was working fine, however

After RU 16 and 17 were installed, I started getting error

"HTTP Error 500.0 - Internal Server Error

Calling LoadLibraryEx on ISAPI filter "c:\Program Files\Microsoft Dynamics CRM\Server\bin\DefaultAddonFilter.dll" failed
...
Handler: ExtensionlessUrl-Integrated-4.0

"

Resolution:

1. Copy the "Microsoft.Crm.Core.dll" to the bin folder of webservice
2. Go to the app pool and click on "Advance Settings..." specified in the Actions properties area and set the 'Enable 32-Bit Applications" to False.
3. Add the node <clear/> in the configuration/system.web/httpModules node
<httpModules>
   <clear />
</httpModules>
4. Add the following section in the configuration/system.webServer/handlers node as below
<handlers>
     
<clear/>
     
<add name="svc-Integrated-4.0" path="*.svc" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" preCondition="integratedMode" />

<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" resourceType="Unspecified" preCondition="integratedMode" />

</handlers>







http://ms-crm-2011-beta.blogspot.co.uk/2011_09_01_archive.html

Friday 22 August 2014

After UR16 and 17, import solution process hangs

After UR16 and 17 when I try to import solution the progress bar shows 0 progress even after 15 mins, even if i have a pretty small solution file.

I tried repair CRM ... no luck
Tried IE 8,9 and 10 still no luck

looked into database using following query and no record is shown as created.

selectsolutionname,progress, startedon, completedon from importjob(nolock) order by startedon desc

----
By running trace log got following error

[2014-08-22 10:23:18.896] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   15 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 60faee5d-965c-4002-ac92-b398190d2694 | CrmException..ctor  ilOffset = 0x36
 at CrmException..ctor(Int32 errorCode, Object[] arguments)  ilOffset = 0x36
 at SolutionImportProcessPage.ProcessRequestData()  ilOffset = 0x4A
 at SolutionImportProcessPage.ProcessAction(String action)  ilOffset = 0x92
 at AppUIPage.OnPreRender(EventArgs e)  ilOffset = 0xD
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>Crm Exception: Message: An error occurred while importing a Solution., ErrorCode: -2147188685


Resolution:

Download the CRM 2011 SDK from microsoft website http://www.microsoft.com/en-gb/download/details.aspx?id=24004

Stop the Async Service

- Open Visual Studio Command Prompt in administrator mode and run following command

 gacutil -i "C:\SDK\Bin\Microsoft.Crm.Sdk.Proxy.dll"

- IISReset

- Restart Microsoft Dynamics Aync services

http://www.abhinavranjan.net/blog/2013/05/import-solution-issue-in-ur-12/

 

Wednesday 20 August 2014

selectSingleNode error after crm 2011 rollup 16 installed

The processes which were working before start giving 'selectSingleNode' error, after doing little bit of search I found out this is happening due to from rollup 12 and plus, CRM 2011 gives multibrowser support. And the javascript file referenced had i.e. specific calls. http://community.dynamics.com/crm/b/gonzaloruiz/archive/2013/02/13/javascript-xml-processing-dom-and-crm-2011-ur12.aspx

Tuesday 19 August 2014

import crmsolution failed after update to rollup 16

Import-CrmSolutionFile : Import Error. workflow:{000000000-xxxxx-xxxxx}:Workflow name This workflow cannot be created, updated or published because it was created
 outside the Microsoft Dynamics CRM Web application. Your organization does not allow this type of
workflow.

http://msdn.microsoft.com/en-us/library/8da8c71e-84af-441e-b99b-0b59399f10f6#enable_disable

when following above instructions I started getting the below error.

At C:\PS\CRMPS.SolutionSourceControl.psm1:478 char:26
+             import-crmsolutionfile <<<<  -connection $connection -inputfile $solutionfile -publis
hworkflows -OverwriteUnmanagedCustomizations
    + CategoryInfo          : NotSpecified: (:) [Import-CrmSolutionFile], Exception
    + FullyQualifiedErrorId : System.Exception,CRMPS.Snapin.ImportCrmSolutionFileCmdlet

CRMPS > Add-PSSnapin Microsoft.Crm.Powershell
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
At line:1 char:13
+ Add-PSSnapin <<<<  Microsoft.Crm.Powershell
    + CategoryInfo          : InvalidArgument: (Microsoft.Crm.Powershell:String) [Add-PSSnapin], P
   SArgumentException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand


Resolution:

Check if the deployment manager is installed on the same machine from where the PowerShell is running.

Run "Windows PowerShell Modules"

  1. Add-PSSnapin Microsoft.Crm.PowerShell
  2. $setting = get-crmsetting customcodesettings
    
  3. $setting.AllowDeclarativeWorkflows="True"
    
  4. set-crmsetting $setting
    
  5. get-crmsetting customcodesettings
    
    

Tuesday 15 July 2014

F-12 in model window and clear cache in IE

I had a requirement where we have to show a custom web page as a model window, I have used jquery on the custom site and was trying to hit a break point, I was hitting couple of issue first one was the javascript file was not getting updated as it was a model window I wasn't able to press CTRL+F5, to sort this out

Press F12 on the main I.E and got to Cache and then select 'Always refresh from server option'

Second issue I was hitting was I wasn't able to open debug window by pressing F-12 on model window. To sort this out

In the main window Go to Internet Options then select Security Tab and then click on the Custom Level button and under Miscellaneous options select the 'Disable' option for the 'Allow websites to open windows without address or status bars.

Thursday 10 July 2014

how to get access to parent record from the new entity record opened using the lookup view

I had a requirement where we got a lookup field on the entity form and on click of that lookup user is able to either select existing record or click on new record, the new record needs to have reference of some selects which user have specified in the initial form.

CRM passes the details of parent window in the url, and used the following code  to extract the id
 
var idMatch = (/currentid=([^&]+)/i).exec(parent.window.opener.location.search);

if (idMatch != null) {

var id = idMatch[1];

    id = id.replace("%7b", "");

    id = id.replace("%7d", "");

return id;



}

Monday 23 June 2014

Using Query Expression

QueryExpression query1 = new QueryExpression()
                    {
                        EntityName = "prefix_entityname",
                        ColumnSet = new ColumnSet(true),
                        LinkEntities = {
                            new LinkEntity
                            {
                                JoinOperator = JoinOperator.Natural,
                                LinkFromEntityName = "prefix_entityname",
                                LinkFromAttributeName = "prefix_entitynameid",
                                LinkToEntityName = "prefix_entityname2",
                                LinkToAttributeName = "prefix_entitynameid",
                                LinkCriteria = new FilterExpression
                                {
                                    FilterOperator = LogicalOperator.And,
                                    Conditions  =
                                    {
                                        new ConditionExpression
                                        {
                                            AttributeName = "prefix_entityname2id",
                                            Operator = ConditionOperator.Equal,
                                            Values =  {
                                                entity2id
                                            }
                                        },
                                        new ConditionExpression
                                        {
                                         AttributeName = "prefix_entity2attribute2",
                                         Operator = ConditionOperator.Equal,
                                         Values = {
                                         attribute2value
                                         }
                                        }
                                    }
                                }
                            }
                        }
                    };

Tuesday 17 June 2014

Query execution time of xxxx seconds exceeded the threshold of 10 seconds

When tring to delete one of the custom entity I was getting failure in deletion and when looked into the event view I saw the message

Query execution time of 30.0 seconds exceeded the threshold of 10 seconds


After a quick google I found the value of threshold is stored in the ServerSettingProperties table of MSCRM_Config database, I used following queue to update the value

use mscrm_config

update serversettingsproperties
set intcolumn = 25
where columnname = 'longQueryThresholdInSeconds'


http://community.dynamics.com/crm/f/117/t/64580.aspx

Thursday 29 May 2014

how to access crm record attributes from an opened window

For modeled window

window.showModalDialog(strSourceURL,window,"dialogHeight:600px;dialogWidth:450px;center:yes; resizable:0;maximize:0;minimize:0;status:no;scroll:no");

window.dialogArguments.Xrm.Page.data.entity.attributes.get('crm attribute name').setValue('some value');

---
For non modeled window

window.open(strSourceURL,"customsearchwindow","dialogHeight:600px;dialogWidth:450px;center:yes; resizable:0;maximize:0;minimize:0;status:no;scroll:no");

window.top.opener.Xrm.Page.data.entity.attributes.get('crm attribute name').setValue('some value');

--


Wednesday 21 May 2014

Creating a custom web.net application that will be hosted in the isv folder

1. Create an empty asp.net website,

2. Add reference to the following assemblies

AntiXssLibrary
Microsoft.Crm
Microsoft.Crm.Platform.Sdk
Microsoft.Crm.Sdk

3. Update web.config enter following details


<?xml version="1.0"?>

<configuration> 

  <system.webServer>

    <validation validateIntegratedModeConfiguration="false"/>

    <modules>

      <remove name="CrmAuthentication"/>

    </modules>

  </system.webServer>

  <system.serviceModel>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

  </system.serviceModel>

  <system.web>

    <compilation debug="true">

      <assemblies>

        <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

        <add assembly="System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

        <add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

        <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

        <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Data.Services.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

        <add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

        <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

      </assemblies>

    </compilation>

  </system.web> 
</configuration>

4. To reference fields on the crm entity form use
add a following line in the head tag of aspx/html page

<script type="text/javascript" src="/<crm org name>/webresources/clientglobalcontext.js.aspx"></script>

and then to reference the field on the entity form

<script type="text/javascript">
window.top.opener.Xrm.Page.data.entity.attributes.get("prefix_attributename").setValue("some value")
</script>