Saturday 23 February 2013

Dynamics CRM 2011 - Unfulfilled order records – No code solution

In Dynamics CRM 2011, you have an option to fulfil an order record. Once you fulfil it you cannot modify that record further. Unlike lead and opportunity records, OOB, there is no action button on top ribbon bar that allows you to reopen the fulfilled order record. The very simple way to reopen it is to configure a workflow. One can create an on-demand workflow on order entity and change the status of the order record(s) from “Fulfilled” to “New”. Recently, one of my customers had the same requirement but with one constraint i.e. this action should be performed by users only with specific security roles. All system users cannot reopen the fulfilled orders.

To achieve this we can create our own custom ribbon button on Order record and replace the system button. There could be one configuration entity where system admin can select the security role(s) which can be validated later when user clicks on above custom ribbon button. If logged in user has any of the configured security roles then only that user can reopen an order.

However, I wished to develop this functionality without writing a single line of code. So, below is my no code solution.

My Solution

1. Create one custom entity say “Unfulfilled Orders”

2. Create new N:1 relationship with Order entity (A business required field)

3. Drag the mandatory order lookup control on a form

4. Create one workflow on this custom entity (created in step 1)

In workflow, first check the status of related order whether it is fulfilled or not.

If it fulfilled then only change its status to “New” as described in below screen shot.

image

5. On Administration tab, select the check box at the bottom of the window i.e.

“Automatically delete completed workflow jobs”

6. Change sitemap to place this custom entity at Settings – underneath Business tab.

7. Change the specific security role(s) which should have an access on the above custom entity.

8. Publish all customization changes.

9. Do not forget to activate the workflow.

And that’s it.

Here, I am done with my solution. Users who have permission on this entity can access it from Settings – Business area. I have configured the workflow to be triggered on two events, on creation of a new record or on change of related order record (change of orderid via lookup control) in edit mode. In both cases the above workflow will trigger and change the status of the related order to “New”. Moreover, it is a quite scalable solution; system administrator can allow/disallow this functionality to specific security role(s).

Please feel free to update this post with your no code solutions to reopen fulfilled order records, if any.

Saturday 9 February 2013

Dynamics CRM 2011 – Mapping of fields from Opportunity Products to Invoice Products

Recently, one of my customers would like to map couple of common custom attributes during execution of entire sales cycle. They are using the out of the box Dynamics CRM sales process. They have these attributes on Opportunity Product entity and want the same values to be auto populated with rest of the sales cycle. Like, when you create Quote record with Quote Products from an opportunity, the same custom attributes should be filled automatically for Quote Products. Likewise, the custom attributes should be populated when you create an Order with Order Products from a Quote and Invoice with Invoice Products from an Order.

Out of the box you cannot find such mappings on these relationships. So, to achieve this requirement, you can use below trick to generate the hidden mappings URLs.

On your development server/machine you just need to execute below query in SQL Management Studio to find out relationship GUID id for Opportunity Product and Quote Product entities.

SELECT    EntityMapId 
FROM      EntityMapBase 
WHERE     TargetEntityName='quotedetail' AND SourceEntityName='opportunityproduct' 


Use the above GUID in below URL and also change the organization name.

http://localhost:5555/[ORG_Name]/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=[Your_GUID]

Now, launch internet explorer and paste this URL at address bar. As displayed in below screenshot, you could see the list of all available mappings of the above two entities.

image

Click on New button to open below field mapping popup. Here, you are free to do your mappings.

image

In the same fashion, find out the mapping GUIDs for Quote Product to Order Product and Order Product to Invoice Product. Prepare their URLs as explained above and complete the attribute mappings.

Finally, add these entities to your unmanaged solution on your development organization. Export it as a managed solution and import the same on QA and Production environments. The same mappings should be applied to those organizations too. Moreover, the same managed solution can also be imported to CRM 2011 online or partner hosted.

I hope this will be helpful.

Reference:

http://crmconsultancy.wordpress.com/tailoring-the-product-selection-for-opportunities-and-quotes-in-dynamics-crm/productcataloguemapping-mscrm-fields-from-opportunity-product-to-quote-product/

Saturday 2 February 2013

Dynamics CRM 2011 - LookupSet Function in SSRS reports

 

Syntax

LookupSet(source_expression, destination_expression, result_expression, dataset)

LookupSet is generally used to retrieve a set of values from the specified dataset for a name/value pair where there is a 1-to-many relationship. For example, for a customer identifier in a table, you can use LookupSet to retrieve all the associated phone numbers for that customer from a dataset that is not bound to the data region.

The above is the description specified for use of LookupSet function. Yesterday, while creating a report I used the LookupSet function and overlooked the highlighted text. I used the LookupSet in a column expression within the tablix. The Dataset assigned to tablix was “DataSet2”.

image


In the LookupSet also I specified the same DataSet i.e. DataSet2 . While executing the query on DataSet, rows were fetched as required.


image


AS viewed above 8 distinct names could be viewed. But when running the report one row was not displayed in tablix but the distinct count i.e. 8 was correctly calculated on very first row of that column.

image

After spending few hours I found that the culprit was LookupSet function which was used in an expression of a column on same tablix . Both tablix and Lookupset function were using the same Dataset i.e. DataSet2.

image

According to the function description, the dataset that is not bound to the data region should be used whereas we were using the same dataset that was used for binding in the data region.

So, the solution is to create another dataset with fields that you want to Lookup. In the LookupSet function specify the newly created DataSet.

image

For me this fixed the weird behavior in displaying rows and the final results are displayed in below screen shot.


image