Solved

Dynamics CRM Workflow updating closed letter after Mail Merge

Posted on 2009-07-03
8
932 Views
Last Modified: 2013-11-24
I have created a new entity (Fund Member) to create a many to many relationship between Contact and a new entity called Fund. Users will be running mail merges from this entity either via Advanced find, or associated views from  the Contact or Fund entity. When the activity is created, the default regarding is the Fund Member record, and the recipient is blank. We need recipient to be populated with the contact and the regarding to be populated with the fund. To do this I have created a workflow described below.

The workflow changes the recipient and regarding for a Letter Activity after the activity has been created. To do this, the workflow has to change the activity status to Open, update the activity, then reclose it.

This works when a letter is created for a single contact, but when applied to multiple contacts, some of the instances complete, but most of them get stuck in the 'Wait' status, and on further investigation they have failed after opening the activity with a with  "SQL error has occured" message.

I improved the success rate to only the occasional error by including a wait timout of 1 minute between the status change and the update, but this isn't a totally risk free solution.

HAs anyone else experienced this issue and developed a better solution?
0
Comment
Question by:swakyn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 29

Expert Comment

by:Feridun Kadir
ID: 24781350
What is the trigger for the workflow?
0
 
LVL 8

Expert Comment

by:Aftab_Khateeb
ID: 24781850
Can you try enabling the Trace feature using CRMDiagTool4
http://blogs.msdn.com/benlec/archive/2008/03/04/crmdiagtool4-for-microsoft-crm-4-0-has-been-released.aspx
This would help in finding out more information.
Once you have enabled tracing - you could find the file in <install drive:>\Program Files\Microsoft Dynamics CRM\Trace locaiton and the file name would be have "CrmAsyncService" (which is a trace file for workflow).

Have you tried restarting the CRM Asynchronous processing service? Does it make any difference in sending those waiting letters?

Let me know how u go
0
 
LVL 1

Author Comment

by:swakyn
ID: 24814742
I have tried restarting the async process but still have the issue.

I have turned tracing on, and reproduced the issue, but can't find any clues in the trace (not really sure what I am looking for). The trace is attached.
VDEVGF1-CrmAsyncService-bin-2009.log
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 8

Expert Comment

by:Aftab_Khateeb
ID: 24818651
Hi Swakyn,

May I know if you have added any rollups to CRM 4.0?
Please refer to this http://support.microsoft.com/kb/952858. There is one hotfix 957701  that addresses workflow waiting issue.

0
 
LVL 1

Author Comment

by:swakyn
ID: 24821025
We are on Rollup 3, so this hotfix has already been applied.
0
 
LVL 1

Author Comment

by:swakyn
ID: 24879612
Further investigation with SQL Server Profiler has found that deadlocks are causing the problem.See message below:-
Transaction (Process ID 108) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
0
 
LVL 29

Expert Comment

by:Feridun Kadir
ID: 24882786
It sounds as if you have workflows competing with each other. Reading your original post again, I notice that you say: "To do this, the workflow has to change the activity status to Open, update the activity, then reclose it. "

Could this be triggering the workflow again?

Perhaps you need to include a test at the beginning of the workflow to prevent it running more than once.
0
 
LVL 1

Accepted Solution

by:
swakyn earned 0 total points
ID: 25233240
The solution is to set the read committed snapshot isolation level  on. Perform iisreset and restart the SQL service after applying change.
-- Check the snapshot and read committed snapshot isolation states before setting them
SELECT      [name]
            ,snapshot_isolation_state
            ,is_read_committed_snapshot_on
FROM sys.databases
WHERE [name] = '<database name>'
 
-- Switch on allow snapshot isolation
ALTER DATABASE <database name> SET ALLOW_SNAPSHOT_ISOLATION ON
GO
 
-- Switch on read committed snapshot isolation
ALTER DATABASE <database name> SET READ_COMMITTED_SNAPSHOT ON
GO
 
-- Check the snapshot and read committed snapshot isolation states after setting them - they should both be 1
SELECT      [name]
            ,snapshot_isolation_state
            ,is_read_committed_snapshot_on
FROM sys.databases
WHERE [name] = '<database name>'

Open in new window

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Zoho  vs Salesforce 2 191
SAP PM 5 168
Reinstalling a named instance of Dynamics CRM SSRS Data Connector 6 110
Dynamics crm 2011 8 96
Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
"Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question