Archive

Posts Tagged ‘CRM’

SQL Timeout error while exporting solution – CRM

Other day my CRM solution export stopped working and I was getting ‘SQL Timeout’ exception while export.

In the event viewer there was an entry with below content

Query execution time of 30.7 seconds exceeded the threshold of 10 seconds. Thread: 38; Database: {Organization_MSCRM}; Server:192.168.36.7; Query: update [WorkflowBase] set [SupportingSolutionId]=’00000000-0000-0000-0000-000000000000′, [OverwriteTime]=’01/01/1900 00:00:00′

Its bit surprising because my solution hardly had 10 components and timeout due to oversize is unlikely.

Troubleshoot steps 

  • Reset IIS and Restarted CRM Async & SQL Services
  • Finally restarted both CRM Application server and DB Server to complete software updates. But no luck.

 Reason

With failed restart machines solution I dig deeper in to event viewer log and found the reason

  • In my case since my event viewer log pointing to “update [WorkflowBase]” query I thought problem would be with workflow. I removed all workflows from my solution and tried exporting. But no luck.
  • Then I removed my ‘SLA’ from the solution since SLA create workflows when you configure SLA Items. Now solution export worked.

Fix

  • By fixing the SLA issue (i.e., In our case we delete a field from Case entity and same not updated in SLA Success criteria). After correcting my SLA  I was able to include SLA in my solution and export .

🙂

Categories: CRM Tags: , ,

Trigger USD event from CRM Hosted Control’s Jscript

August 22, 2015 1 comment

In one of our requirement we had to trigger a USD Event from CRM Hosted Control’s onchange event of an option set.

Below are the steps to invoke USD event from option set’s ‘onchange’ event.

  • Assume your USD event name is “USDOnChange
USD - Events

USD – Events

  • In my CRM Hosted Control’s onchange event placed this statement

function TriggerUSDOnchangeEvent() {

window.open(“http://event/?eventname= USDOnChange“);

}

🙂

Categories: CRM, USD Tags: ,

‘Saved’ event not triggering on ‘CRM Page’ hosted control – USD

April 13, 2015 2 comments

We have an Account form hosted in ‘CRM Page’ hosted control on USD. We got a requirement to navigate another page on CRM form Save event.

Below are the steps I initially followed

  • Created a new Hosted Control of type ‘CRM Page’
CRM Page Hosted Control

CRM Page Hosted Control

  • Go to ‘Events’ from Command Bar and open ‘Saved’ event
Saved event - Hosted Control

Saved event – Hosted Control

  • On ‘Saved’ event of Hosted Control, added a new ‘Action’ to Navigate to Bing
Navigate Action

Navigate Action

  • Save and close
  • Open the USD and open ‘Account’ record

But the ‘Saved’ event did not trigger when I click Save button from CRM page.

Reason

  • Looks like this is known issue with my USD version (Got fixed in latest USD version)

Fix

To fix this, below are workaround steps to hook the ‘Saved’ event to CRM hosted control.

  • Open ‘PageLoadComplete’ event of Hosted Control
PageLoadComplete Event

PageLoadComplete Event

  • Create a new ‘Action Call’
    • Action : ExecutionTimeout (Note : Create a new UII action if you can’t find ExecutionTimeout)
    • Data : milliseconds=6000
ExecutionOnTimeout Action Call

ExecutionOnTimeout Action Call

  • Create a new ‘Sub Action Call’
Sub Action Call

Sub Action Call

  • Add below Script using ‘RunXrmCommand’ Action

Script :

function hookSavedEvent(execContext)

{

window.open(“http://event/?eventname=Saved”); // notify USD of save

setTimeout(“top.ScanForData();”, 4000);

}

// Add ‘hookSavedEvent’ to Save event of CRM form

Xrm.Page.data.entity.addOnSave(hookSavedEvent);

Register Script Action

Register Script Action

  • Save & Close the forms
  • Close and reopen the USD client application to test the behavior now
  • Open ‘Account’ form, click on ‘Save’
USD CRM Form Save Action

USD CRM Form Save Action

  • We get a new tab with Bing page
USD - Navigated To Bing Page on Save

USD – Navigated To Bing Page on Save

🙂

Categories: CRM Tags: , , ,

Display Custom Entity on IPad or Windows 8 CRM App Home Screen

March 25, 2015 1 comment

I recently got a chance to work with CRM on Tablets. The requirement was to display a Custom entity on Tablets home screen. It’s very easy to achieve with below steps. Enable entity for tablets

  • I have a Custom entity ‘Change Of Address’
  • To enable this for tablets, Go to Customization and check ‘CRM for tablets’ check box
Enable entity for Tablets

Enable entity for Tablets

Getting Entity on Tablet home screen

  • By default ‘Sales Dashboard’ will get displayed on Tablet Home screen
  • So to get ‘Change Of Address’ entity on home screen, I added ‘Change Of Address’ entity view to the ‘Sales Dashboard’. (Note : Only 6 sections of Sales Dashboard visible on Tablet home screen)
Customize Sales Dashboard

Customize Sales Dashboard

  • Once you publish the changes and reopen the CRM application those changes will take effect
Tablet - Sales Dashboard

Tablet – Sales Dashboard

Points to be noted while working with Tablets Form Limitations

  • We get the ‘Main’ form of the entity on tablet but with below limitations
    • Tabs cannot be expanded or collapsed
    • IFRAMES in forms are not displayed in CRM for tablets
    • Cannot switch between forms if the entity has multiple forms
Tablet - Customization Limitation

Tablet – Customization Limitation

  • We can differentiate scripts running on Web or Tablet with below check
if (Xrm.Page.context.client.getClient() != "Mobile"){
    //Code that should not run in CRM for tablets can be included here
}
  • All Custom entities can be configured to view on Tablet but not all OOB entities viewable on Tablets (Below are list)
Tablet - Entity Configuration

Tablet – Entity Configuration

Customization changes Sync between Server and Tablet

  • New Customization changes will take effect in Tablet on reopening of application also when its idle for more than 20 hours.
Tablet - Meta Data Sync

Tablet – Meta Data Sync

Unsupported SDK messages

  • Below are list of unsupported SDK messages on Tablet
Tablet - Unsupported SDK

Tablet – Unsupported SDK

Off line Support

  • CRM application data will be cached on HTML5 local store.
  • Attachments of Records are not available offline.
  • You cannot search data when offline.
  • Only visited records using tablet gets cached; for example the records which i never opened with my tablet won’t come up when offline.
  • Few more points
    • We can only create new records. To edit existing records, you need to be connected. You can edit records that you created while you were offline, however.
    • You can only create records offline with the Quick Create form, not the full form.
    • While disconnected, you can only create standalone records or associate records to those that are cached on your tablet for offline access. For example, you can create an opportunity for an account only if that account was created before you went offline and if it’s cached for offline access. You can’t create an account while offline and then create an opportunity for that account.
    • When you’re offline, you can’t set the value for lookup fields. If you create a record that is associated with another record, such as adding a phone call to a contact, some lookup fields might populate automatically (in this case, the To and From fields might pre-populate). You need to fill these fields in once you re-connect while you review and save your drafts.
    • Article Work Offline
Tablet - Offline Support

Tablet – Offline Support

Refer below MSDN resources for more details

🙂

Categories: CRM Tags: , ,

Executing Failed Workflow Async Jobs – CRM

In my CRM application we trigger workflows on creation of Orders.

Other day because SQL server was down, there were 600 System Jobs failed with ‘SQL Time Out’ error.

Once SQL server issue fixed we had the problem of fixing failed workflow jobs, Since I cannot re-execute the failed jobs from the CRM ‘System Jobs’ UI, only way is to create 600 Orders again which was tedious.

After exploring I came to know that we can re-execute failed ‘System Jobs’ using ‘ExecuteWorkflowRequest’ SDK message.

ExecuteWorkflowRequest SDK message requires

  • WorkflowId
  • EntityId

Sample Code – 

// Create an ExecuteWorkflow request.

ExecuteWorkflowRequest request = new ExecuteWorkflowRequest(){

WorkflowId = _workflowId,

EntityId = _OrderId

};

// Execute the workflow.

ExecuteWorkflowResponse response = (ExecuteWorkflowResponse)_serviceProxy.Execute(request);

Refer article for source code and execution steps for failed jobs.

🙂

SQL Server Error While Exporting Advanced Find Records To Excel

February 18, 2015 Leave a comment

Few Users reported that they were getting “SQL Server Error” while trying to export the Advanced Find  records to Excel.

SQL Server Error while exporting records

SQL Server Error while exporting records

Reason :

  • The filter they used in Advanced Find resulted more than 10000 records.
  • CRM has OOB limit of 10000 records to export.
  • If your CRM instance is on premise, you can check the limit by querying OrganizationName_MSCRM database.
  • Below is the query
    • SELECT MaxRecordsForExportToExcel FROM OrganizationBase

Fix :

  • You can increase the value of “MaxRecordsForExportToExcel”.

Supported Way

  • Updating the MaxRecordsForExportToExcel using CRM SDK call is Supported.
  • This will work for both on premise and online instances

Organization organization = new Organization();

organization.Id = {Oragnization GUId}; // Get Org GUID from MSCRM_Config DB’s Organization table.

organization.MaxRecordsForExportToExcel = 300000; // Set desired value

service.Update(organization);

Unsupported Way

  • As you aware its strictly not recommended to update CRM database directly and also this approach only works for on premise.
  • Run below query by connecting to your OrganizationName_MSCRM Database.

UPDATE OrganizationBase

SET

MaxRecordsForExportToExcel = 100000

🙂

There is no active transaction – Error on Case Resolution

February 9, 2015 Leave a comment

I have an on demand workflow which Resolve the Case’s. I got below exception when I run the workflow against a Case.

No Active Transaction Error

No Active Transaction Error

Reason & Fix

  • There is no active transaction Error – message usually denotes the failure in any other Plug-in steps already registered on the same event.
  • In my scenario, there were OOB Activity Feeds Plug-in steps registered on Case entity ‘SetDynamicState’ message.
  • So the Activity Feeds  ‘SetDynamicState’ message failing when my workflow tried to change status of Case, causing “no active transaction Error “.
  • By deactivating the Activity Feed step on Case entity ‘SetDynamicState’ message solved the problem.
Disable Activity Feed Steps

Disabled Activity Feed Steps

🙂