Category Archives: Workflow

CRM 2011 Workflow Entity View records are not sorted alphabetically

I just recently come across customer reported CRM issue related workflow view displaying on demand workflow list random manner and not displaying them in alphabetically manner.

This issue mainly hits you if you got lots of workflow related to particular entity and while trying to run specific on demand workflow you will see lots of workflow in view and needs to manually sort the list to find your workflow.

B6510

Well looking at issue it seemed really easy issue to fix, so just open relevant view and apply sort on name column and publish the changes BUT this view is called “On Demand Workflows” is not customizable and hence we have to do unsupported change to fix this issue. Following steps done to fix this issue using unsupported manner.

Step 1: first find existing view and view definition from the data base. So run following query for this.

select savedqueryid,name,fetchxml from savedquerybase where name like '%On Demand Workflows%' order by name

Please note down savedqueryid as we will be using this in next steps.

B65112

Step 2: So following is the Original FetchXML definition for this view. As can be seen there is default sort order is not defined in this definition.

<fetch version="1.0" mapping="logical"><entity name="workflow"><attribute name="workflowid" /><attribute name="name" /><attribute name="createdon" /><attribute name="modifiedon" /><attribute name="statecode" /><attribute name="owningbusinessunit" /><attribute name="ownerid" /><filter type="and"><condition attribute="type" operator="eq" value="1" /><condition attribute="ondemand" operator="eq" value="true" /><condition attribute="statecode" operator="eq" value="1" /><condition attribute="category" operator="eq" value="0" /></filter></entity></fetch>

We will be Modifying above fetch xml with following to include sort order related to this. We refer highlighted change in fetchxml below for this.

<fetch version="1.0" mapping="logical"><entity name="workflow"><attribute name="workflowid" /><attribute name="name" /><attribute name="createdon" /><attribute name="modifiedon" /><attribute name="statecode" /><attribute name="owningbusinessunit" /><attribute name="ownerid" /><order attribute="name" descending="false" /><filter type="and"><condition attribute="type" operator="eq" value="1" /><condition attribute="ondemand" operator="eq" value="true" /><condition attribute="statecode" operator="eq" value="1" /><condition attribute="category" operator="eq" value="0" /></filter></entity></fetch>

Step 3: now update this specific view definition using SQL query against CRM database, please replace the SAVEDQUERYID with value noted down in step 1.

update savedquerybase
Set fetchxml ='<fetch version="1.0" mapping="logical"><entity name="workflow"><attribute name="workflowid" /><attribute name="name" /><attribute name="createdon" /><attribute name="modifiedon" /><attribute name="statecode" /><attribute name="owningbusinessunit" /><attribute name="ownerid" /><order attribute="name" descending="false" /><filter type="and"><condition attribute="type" operator="eq" value="1" /><condition attribute="ondemand" operator="eq" value="true" /><condition attribute="statecode" operator="eq" value="1" /><condition attribute="category" operator="eq" value="0" /></filter></entity></fetch>'
where name = 'On Demand Workflows'
and savedqueryid = 'SAVEDQUERYID';

After applying above changes log in to CRM and verify this view is displayed record correctly now.

B65113

****Important Notes regarding above change****
above change is unsupported so make sure you apply this change to Dev, Test environment before applying this to Live environment. Also make sure you take back up of database before doing this
change.

Hope this helps…

Cheers,
MayankP:)

Advertisements

Send the failed email again in Dynamics CRM

Sometimes because of various reason email created and send from CRM 4.0 fails to reach the destination and in this case CRM changes the email status to “Failed”
If you want to resend the email then you can easily do this using some simple workflow and then manually running this against the relevant emails. Following are the steps for the same..

Step 1: Go to Settings -> workflow – > click New

Step 2: Enter Workflow name “Send Failed email again” and then select entity as Email

Step 3: Remove/Deselect option to start this “Record is created” and select the option to run this on Demand as follows

im

Step 4: Now add step to send email as follows

mj

Step 5: Now add steps to change the status of original email from failed to cancel so it does not pick up again. Finally publish the workflow

Step 6: select the relevant email with status “failed” and click run workflow button and select the workflow created in above step.

Done !!

Delete Read only/closed Record in CRM 4.0

Here is how to delete almost any Read Only / Closed item in CRM 4.0.Create a workflow to change the status of the item for closed to new or draft.
For Example…You just installed CRM 4 and are using some test accounts and creating some test invoices…You try to delete the test invoices after they are closed.. and what do you know? You can’t delete them! They are ‘Read only’!

So, you must create a workflow to change the status of the Invoice from Closed to New. To do this:

 Go to Settings Then Workflows
 New -> Type workflow name ‘Invoice Closed to New’
 Entity -> Invoice
 Click Ok.
 Check ‘Availability to run on demand’
 Uncheck everything else.
 Add Step -> Change Status
 It should read -> Change record status to: Invoice New
 Save the Workflow.
 Publish the Workflow.

Now go back to the invoice you want to delete. Open it. Run your newly created workflow on it. (Use the workflow button at the top)Close out of the Invoice, and wait for a min or two depending on the load of your system. Then, refresh your page. If the invoice status has changed, you can try to delete it!

Notes: –
1. This trick does not work on Contract record.
2. BE ADVISED -> I don’t know how this will affect any records associated to the items you are trying to delete. USE AT YOUR OWN RISK!!