Changing the Default Behavior of a Connector Integration
This post is intended to show you how to use Connector for Microsoft Dynamics to change a business rule based on a business example. It uses Dynamics GP 2010 integrated to Dynamics CRM 2011, however the basic concepts apply across Dynamics ERP’s. When creating the default maps for any integration, the maps in Connector include the most commonly used fields from the Dynamics ERP that also exist in Dynamics CRM’s default deployment. Dynamics GP tracks the following quantities for each item:
- Quantity On Hand -- The number of a particular item we currently have in house
- Allocated Quantity -- The number of a particular item that we have in house that are currently spoken for but have not yet shipped
- Quantity Available -- A calculated field to show the number you have available to sell at a particular moment in time
Because Dynamics CRM only has one of these three fields (Quantity On Hand), the default Dynamics GP Sales Item to Dynamics CRM Product map only maps Quantity On Hand. Salespeople working in Dynamics CRM might rather see the Dynamics GP Quantity Available, which is calculated as Quantity Available = Quantity On Hand – Allocated Quantity. In order to include this calculation in the Sales Item to Product Map, we will do the following (each step will be described in detail below):
- The min value for Quantity On Hand in both Dynamics CRM 4 and Dynamics CRM 2011 is 0, Dynamics GP allows Quantity On Hand to have a negative value. Since this difference could cause items to not integrate, use the “If” and “LessThan” mapping function to set the Quantity On Hand to 0 if Quantity On Hand from Dynamics GP is less than 0. Use of the default mapping shipped with Connector, since this was already accounted for. (It is possible to customize Dynamics CRM to allow this field to accept negative values, in which case this step would not be necessary.)
- Dynamics GP returns quantities as a collection of physical sites. Use the “SumCollection” mapping function to return the sum total for each item regardless of the site they are located in.
- Last, use the “Subtract” mapping function to return the Quantity On Hand less the Allocated quantity.
Steps to update the default mapping for Quantity On Hand
1. Open the Connector client
2. Select the Sales Item to Product map for the integration you want to customize.
3. Click the edit button for the Quantity On Hand field
4. Click the edit button for the condition field
5. Click the delete button for the value1 field
6. Click the edit button for the value1 field
7. Click Use a Function
8. Select Math from the Function category drop down
9. Select Subtract from the function list
10. Click next
11. Click the edit button for the value1 field
12. Click Use a function
13. Select General from the Function category drop down
14. Select SumCollection from the function list
15. in the collection field enter source field: Quantities
16. in the propertyPath field enter string constant: "item/OnHandQuantity/Value"
17. Click Add
18. Click the edit button for the value2 field
19. Click Use a function
20. Select General from the Function category drop down
21. Select SumCollection from the function list
22. in the collection field enter source field: Quantities
23. in the propertyPath field enter string constant: "item/AllocatedQuantity/Value"
24. Click Add
25. Click Add
26. Click Add
27. Click the delete button for the falseValue field
28. Click the edit button for the falseValue field
29. Click Use a Function
30. Select Math from the Function category drop down
31. Select Subtract from the function list
32. Click next
33. Click the edit button for the value1 field
34. Click Use a function
35. Select General from the Function category drop down
36. Select SumCollection from the function list
37. in the collection field enter source field: Quantities
38. in the propertyPath field enter string constant: "item/OnHandQuantity/Value"
39. Click Add
40. Click the edit button for the value2 field
41. Click Use a function
42. Select General from the Function category drop down
43. Select SumCollection from the function list
44. in the collection field enter source field: Quantities
45. in the propertyPath field enter string constant: "item/AllocatedQuantity/Value"
46. Click Add
47. Click Add
48. Click Add
After making these changes to the mapping and reloading all Sales items the Quantity On Hand field in Dynamics CRM will match the Quantity Available from Dynamics GP. Another option is to customize the Dynamics CRM Product entity to display the Quantity Available, Allocated Quantity, and Quantity On Hand in different fields. Please see the Dynamics CRM SDK and Connector SDK for more information on how to add custom fields for integration.
Comments
Anonymous
July 12, 2011
Char - This is exactly what I needed! Thank you!Anonymous
July 12, 2011
Char - actually - I'm running into a problem. Since making the change, we get the following error: [Sales Item to Product] has encountered an error while processing key ['insert the product # here']. Object must implement IConvertible. They are all attempting to integrate but failing. Any suggestions?Anonymous
January 30, 2012
Hi Mike- I am not sure if you figured out the issue with the error "Object must implement IConvertible" but if you haven't, you need to change the paths from "item/OnHandQuantity/Value" to "itemOnHandQuantityValue" Thanks John Nyagaka