Customizing
The following chapter gives some tips regarding the way to parameterize the standard managed solution to make it fit your business requirements. You will be able to modify the buttons, fields and translations but also to review and to complete the standard integration mechanism if necessary.
PROS Quote Content IN/OUT entities are considered as ‘technical’ entities.
For parameterization purpose, you may have to modify the Quote entity and other PROS entities. However, you MUST NOT modify the PROS Quote Content IN or PROS Quote Content OUT entities.
To perform modifications regarding MSCRM and/or the CPQ managed solution setup, you have to login using a System Administrator profile.
Standard MSCRM setup
OVERRIDING THE DEFAULT LABELS AND TRANSLATIONS
To be able to modify and import translations in a given language, the pack - provided by Microsoft - corresponding to this language must have been installed on your CRM instance first.
In order to modify the default translations provided in the standard solution, log in as a System Administrator and follow the steps below:
- Go in the Settings > Solutions menu of the navigation bar
- Select your solution and click on “Export Translations”
Your solution has to be in unmanaged mode to modify the default translations otherwise you will get a warning message
- When prompted with the following message, click on OK:
- Download the exported zip file and extract the XML files contained in it. Translate all the elements in the new language.
The exported elements that could be translated are those marked as translatable in the MSCRM customization menu.
- You have then to re-import the elements you have translated in your solution. In the solution menu, click on “Import Translations”.
- Select the modified zip file and click on “Import”
- Once done, click on “Publish all customizations” in the actions menu
If you want to translate textual elements more globally than just on a given solution, you can do it as a System Administrator through the Settings > Data Management menu by using the “Export/Import fields translations” sections
MODIFYING THE QUOTE MAIN FORM
The Quote entity contains by default one Main form with an overview of its attributes and linked entities. It contains several tabs, among which is the “Content” tab. It is possible to customize both. The following chapters will show you how to modify the Quote Main form and its Content sub-tab.
The “Content” tab is dedicated to data from CPQ. Modify this tab to add or remove CRM fields is possible but presents a low interest in comparison with the configuration of the rest of the Quote Main form more dedicated to this usage.
Accessing the Quote form editor
The modification of the Quote Main form can be performed thanks to the MSCRM form editor:
- Go in the Settings > Customization menu in the navigation bar
- Open the “Customize the system” menu
- In the Components > Entities directory, select the Quote entity
- Click on Forms. Then, select your Quote "Main" form.
Adding a field in a form
The following procedure present how to add a field in a form through an example.
To know how to build a relationship between an Quote Lines and a Quote as an example, please refer to the chapter Synchronizing Quote Lines
The following procedure explains how to add a lookup field “Opportunity” in the Quote “Main” form. (NB: this already exists. This chapter goal is to present an example on how to do it):
- Access the Quote form editor (See previous chapter)
- In the field explorer, click on “New Field” and set the Opportunity field as follows:
- Click on “Save & Close”
- Then, put the focus in the “General” section and double-click on the Opportunity field in the
Fields Explorer. The field is added to the form section - Click on “Save” and “Publish all customizations”
The Opportunity lookup field is now available in your Quote “Main” form.
If you add new fields as part of the Quote entity (or entities linked to the Quote used in the PROS Mapping Set), pay attention to give them names different from those of the Quote entity (or linked entity) so that there is no overlap during the synchronization with CPQ.
Controlling fields access rights
From the Settings > Customization > Customize the system menu, you can also handle security rights on form fields.
- In the Components > Entities directory, select the Quote entity
- Click on Fields. Then, select one field in the list displayed in the right pane.
- In the field window, on the General tab, to the right of Field Security, Enable security for the field.
- Save your modifications and click on “Publish all customizations”.
- In the Quote entity, the corresponding field is identified by a “key” icon.
Once enabled, the security rights on fields can be managed as follows:
- Go in the Settings > Security menu in the navigation bar
- Open the “Field Security Profiles” menu
- Select a profile in the list or create a new one
- In the left pane, click on “Fields permissions”
- Select your field by double-clicking on it and modify its rights
- Click on “OK” and then on “Save”. Finally click on “Publish All Customizations”
Modifying the UI rendering
You can also define the structure of the PROS custom entities forms by using the form editor.
To know how to access the form editor for the Quote, please refer to the chapter Accessing the Quote Forms Editor. Note that it is possible to modify the forms of other entities in the same way.
From there, it is possible to modify the structure of the form, to add/remove fields and section, etc. You can also access the “INSERT” tab to help you design your global form, tabs and sections:
Please refer to the Microsoft online documentation for more details on the form edition.
Defining Quote Statuses
In the MSCRM Quote entity, The ‘Status Reason’ field is at the core of the approval workflow. This field can be edited to add, modify or remove statuses in order to customize this workflow.
- Go in the Settings > Customization menu in the navigation bar
- Open the “Customize the system” menu
- In the Components > Entities directory, select the Quote entity
- Click on Fields. Then, select the ‘Status Reason’ and click on edit
- By default, in the ‘Type’ section, select the ‘Draft’ status. It corresponds to the status where a Quote (in CRM & in CPQ) is editable. A list of status reasons appears at the bottom. (By default, only the ‘Draft’ status reason appears in that list)
- To add more status reasons if needed (‘Approved’, ‘Rejected’...), click on the ‘Add’ button. Enter the label of the new status reason and click on OK.
- Do not forget to Save and Publish your modifications
- The new Status Reason is now available in the Quote entity
Managing Date and Time fields
The data type Date and Time can have 3 different behaviors:
- User Local - When the behavior of a field is User Local, field values are displayed in the user’s local time. In the SDK, these values will be returned using a common UTC time zone format
- Date Only - When the behavior of a field is Date Only, field values are displayed with no time zone conversion. The date portion of the value is stored and retrieved as specified in the UI and SDK. The time portion of the value will always be 12:00 A.M.
- Time-Zone Independent - When the behavior of a field is Time-Zone Independent, field values are displayed with no time zone conversion. The date and time values are stored and retrieved as specified in the UI and SDK
The time zone of the user should be applied only for the User Local scenario.
MODIFYING PARENT ENTITIES LAYOUT
The Quote entity is by default linked to the Account and Contact entities. These entities are Parent entities of the Quote.
The Quote can also be linked with any other entity available in the CRM. Once the link between the Parent entity and the Quote is configured, the layout of the Parent entity can be modified to view the list of associated Quotes linked to it.
To include this section in the Parent entity Main form, proceed as follow: For instance, the Opportunity entity is parent from the Quote entity.
- Go in the Settings > Customization menu in the navigation bar
- Open the “Customize the system” menu
- In the Components > Entities directory, select the Opportunity entity
- Click on Forms. Then, select your Opportunity Main form
- In the form, choose where you want to insert the Quote section. Go in the “INSERT” tab and click on “1 tab”
- The tab is inserted in the form. If you double-click on it, a window pops up to configure the new tab. Give it a name and a label and click on OK
- Put the focus on the new tab and add a one-column section
- Put the focus on the new section and add a sub-grid. A window pops up to configure the sub-grid. Fill the following parameters and click on Set
- Save and Publish your modifications
You can now see the Quote section in your Opportunity Main form.
CPQ Content parameterization (basic)
In the following chapter we describe how to parameterize the way Quote ‘Main’ form (representative of the CRM) and Quote ‘Content’ tab (representative of CPQ) communicate and how to share some custom data depending on your business needs.
- the knowledge of CPQ model parameterization
- a basic understanding of MSCRM set-up capabilities.
Please refer to Appendix A to know how to access and modify the CPQ Quote model.
UNDERSTANDING THE COMMUNICATION FROM MSCRM TO CPQ – MAPPING IN
When switching from the ‘Main form to the ‘Content’ tab in the MSCRM Quote, the CPQ webservice is called and initialized with values from both the Quote entity, and entities linked to the Quote.
System fields mapping
The system fields (technical mandatory fields of the PROS Quote entity) are mapped as follows (This mapping cannot and must not be modified):
| MSCRM PROS QUOTE ENTITY FIELD NAME | CPQ OBJECT QUOTE MODEL FIELD NAME | |
|---|---|---|
| CPQ Quote Domain | MSCRM organization ID | Quote Domain ID |
| CPQ User Group | pros_cpqusergroup in PROS Custom Settings | Quote UserGroup |
| Quote Name | name in Quote | ParameterTab.QuoteDescription |
| Quote Status | statuscode in Quote | ChangeAndControlTab.CurrentStatus |
| Owner field | pros_cpqownergroup in PROS Custom Settings | ChangeAndControlTab.CurrentOwnerId |
| Language | Inherited from the UserSettings system entity | ParameterTab.Language |
| Currency | transactioncurrencyid in Quote | ParameterTab.Currency |
The ‘Main’ system fields override the values contained in the PROS Quote Content IN each time the CPQ webservice is called.
Implicit Quote fields mapping
The standard fields of the Quote entity and custom fields of the Quote entity are automatically passed as volatile session parameters in the PROS Quote Content In if their value has been modified and is not empty. Thus, they can be retrieved and used in the CPQ Quote model as values of header and footer fields, and in the configuration processes or catalogs (as CPE session settings).
During the synchronization from MSCRM to CPQ, the fields are sent with a prefix: “pros_” for standard fields and “new_” for custom fields. To use these fields in CPQ, you must keep the prefix in their naming.
To use the value of the custom field in the catalog/configuration processes, use the following CPE format:
Format of the CPE -
CPE.Settings.Session.Application.pros_myQuoteCustomFieldName
Explicit external fields mapping - Standard Mode
It is possible to inject values from MSCRM entity fields (external fields) into CPQ module on the condition that these entities are linked to the Quote entity.
We consider that an entity is linked to the Quote entity if:
- a look-up relationship has been defined between the PROS Quote and the entity (1-to-1 relationship) [we call this entity a parent Entity]
- For example, in the default managed solution, the Account is a linked MSCRM entity
- the entity is a child of an entity linked to the PROS Quote via a look-up type of relation (1-to-n relationship) [we call this entity a 2nd level Entity]
- For example, in the default managed solution, the Task is a child entity of the Account.
- For example, in the default managed solution, the Task is a child entity of the Account.
To pass some eligible fields values to CPQ, you need to define a PROS Mapping Set.
- [In the Settings > PROS Mapping Set]
(If not activated check your access rights)
Create a new (or edit an existing) PROS Mapping Set.
- Click on ‘New’ button
- Specify a name for your mapping set
- [In the PROS Mapping Set Builder]
Define the external fields you want to pass to the CPQ module:
- Ensure that the Mapping IN is selected in the dropdown list
- By default, the tree view only shows the Quote entity
- If you want to map ‘Parents’ or ‘2nd level’ entities, you first need to add these entities in the mapping tree
To add a parent entity to the Quote (e.g. Account), select the Quote entity in the tree, click on the ‘Add’ button and choose an entity in the popup window.
To add a child entity (e.g. Task) of a linked entity (e.g. Account) select the entity in the tree, click on the ‘Add’ button and choose the child entity in the popup window.
- Select the fields you want to pass to CPQ:
Select the entity from the tree (in the left part), and then check the boxes of the fields you want to map (in the right part)
- Click on ‘Save Mapping’
- [In the PROS Custom Settings entity]
- Select the PROS Mapping Set you want to use for your Quote in the corresponding lookup field
The mapped field are passed as volatile session parameters in the CPQ Quote controller. Thus, they can be retrieved and used in the quote model as values of header and footer fields, and in the configuration processes or catalogs (as CPE session settings).
To use the value of the custom fields in the catalog/configuration processes, use the following CPE
format:
Format of the CPE – for parent Entity:
CPE.Settings.Session.Application.QuoteLookUpFieldName.entityFieldName
e.g. CPE.Settings.Session.Application.AccountId.Name
Format of the CPE – for an 2nd level Entity:
CPE.Settings.Session.Application.QuoteLookUpFieldName.entityLinkName[xx].entityField Name
e.g.
CPE.Settings.Session.Application.AccountId.Task[1].Name
CPE.Settings.Session.Application.AccountId.Task[2].Name
Explicit external fields mapping - Advanced Mode
As described in the previous chapters, the tree of entities in the PROS Mapping Set allows defining the mapping of CPQ fields with CRM fields from Quote parent entities and children of Quote parent entities (2nd level entities).
However, when seting up the Mapping IN, it could occur that you need to access fields from CRM entities at deeper levels or to leverage several instances of the same entity during the Quote sync (several Contacts of the Account linked to the Quote for instance). For that use case, the PROS Mapping Set entity provides a query mechanism to retrieve data from entities not accessible from its entity tree.
The outcome of those queries is an XML structure that is automatically integrated in the XML sent to CPQ during the Mapping IN mechanism.
You can write queries directly in the text field of the PROS Mapping Set. However, it is recommended to leverage an external editor - like the XRM toolbox and fetch XML builder plugin provided by Microsoft – and then to copy/paste the query in the PROS Mapping Set text field.
Query example to retrieve the name and last name of all the Contacts associated to the Account specified in the Quote:
The format of the answer to that query would be:
This portion of XML would be controlled in the PROS Quote Content IN entity after a request to CPQ. As a designer of the CPQ Quote model, you have to make sure that the elements from the answer you want to leverage are correctly mapped on CPQ fields.
How to retrieve a field value from MSCRM into CPQ?
If you need to store or modify a custom field that you have previously created in your MSCRM Quote entity you can use a computation method (Attribute) allowing to retrieve a Quote controller value, based on the name of the attribute.
Name of the attribute of the Quote controller:
Convention for System, Standard and Custom Fields in the PROS Quote
The name of the attribute is the exact same name as the one used for the Quote field on the MSCRM side. However, if your field has a prefix ‘pros_’ (standard fields) or ‘new_’ (custom fields), this prefix has to be considered:
QuoteCustomFieldName
Convention for External Fields
For external fields, it follows the same syntax as the CPE (without the CPE.Settings.Session.Application prefix)
QuoteLookUpFieldName.entityFieldName QuoteLookUpFieldName.entityLinkName[xx].entityFieldName
The Attribute computation method allows to set the value or the default value of any header or footer field.
In the following example, we have created a MyCustomField field on the MSCRM Quote side. On the CPQ side, we compute the value of the total cell based on this field name.
UNDERSTANDING THE COMMUNICATION FROM CPQ TO MSCRM – MAPPING OUT
When, from the Quote ‘Content’ tab, the user clicks on the Save action. Some Quote entity fields are updated implicitly and others are updated if they have been setup in the PROS Mapping Set in the CRM. Fields of other CRM entities could also be updated via the PROS Mapping Set. These mechanisms are described in the next chapters.
The Synchronize action called when clicking on the “Save” button can be parameterized in the CPQ Quote Designer.
If a synchronized field is empty on the CPQ side, its value will not be updated on the CRM side.
At the end of the synchronization process, a page is displayed inviting the user to switch back to the Quote “Main” form manually. This page can be customized in the CPQ Quote layout XML page.
Quote System Fields Implicit Mapping
The system fields are mapped as follows:
| CPQ OBJECT QUOTE MODEL FIELD NAME | MSCRM QUOTE ENTITY FIELD NAME | |
|---|---|---|
| Quote Name | ParameterTab.QuoteDescription | name |
| Quote Status | ChangeAndControlTab.CurrentStatus | status |
During the synchronization from CPQ to MSCRM, these Quote fields are the only one to be updated implicitly – meaning with no specific manual setup
Quote Fields Explicit Mapping
To update Quote fields – other than system fields – in MSCRM from CPQ Quote values, you have to define the corresponding mapping via the PROS Mapping Set entity:
- [ In the Settings > PROS Mapping Set ] (If not activated check your access rights)
Create a new (or edit an existing) PROS Mapping Set.
- [ In the PROS Mapping Set builder ]
- Ensure that the Mapping OUT is selected in the dropdown list
- Click on the Quote entity in the left panel
- Define the Quote fields you want to update (check the boxes of the fields in the right part of the builder) and indicate the name of the CPQ header or footer cell (for the header fields of the CPQ, do not forget to indicate the tab name before the field name: e.g. CartInfoTab.UserMail)
- Define the Quote fields you want to update (check the boxes of the fields in the right part of the builder) and indicate the name of the CPQ header or footer cell (for the header fields of the CPQ, do not forget to indicate the tab name before the field name: e.g. CartInfoTab.UserMail)
- Click on ‘Save Mapping’
- [ In the PROS Custom Settings entity ]
- If not already done, select the PROS Mapping Set you want to use for your Quote in the corresponding lookup field
Explicit external fields mapping - Standard Mode
It is possible to create/update MSCRM entities linked to the Quote during the mapping out process.
The way linked entities are updated depends on the type of the entity : Parent Entity or 2nd Level Entity.
‘Parent Entity’ fields update
It is possible to update some fields of parent entities based on header and footer cells of the quote. The mapping between the CPQ and the MSCRM field is indicated in the PROS Mapping Set (OUT Mapping Type).
- [ In the Settings > PROS Mapping Set ] (If not activated check your access rights) Create a new (or edit an existing) PROS Mapping Set.
- [In the PROS Mapping Set Builder] Define the external fields you want to update when updating
the PROS Quote Content Out.
- Ensure that the Mapping OUT is selected
- By default, the tree view shows the Quote entity. Select the Quote entity, click on the ‘Add’ button and select the parent entity you want to update the fields in the popup window.
- Define the fields you want to update (check the boxes of the fields in the right part of the builder) and indicate the name of the CPQ header or footer cell (for the header fields of the CPQ, do not forget to indicate the tab name before the field name: e.g. CartInfoTab.UserMail)
- Ensure that the Mapping OUT is selected
- Click on ‘Save Mapping’
- [ In the PROS Custom Settings entity ]
- If not already done, select the PROS Mapping Set you want to use for your Quote in the corresponding lookup field
When synchronizing the quote in CPQ with the Quote in MSCRM, the external fields are mapped following the PROS Mapping Set.
You have to ensure that the fields on both CPQ and MSCRM side are of the same type.
‘2nd level entity’ creation/update/deletion
It is possible to create and/or delete and/or update some 2nd level entities based on cells of the CPQ Quote spreadsheet.
For each line and/or sub-line of the quote in CPQ, you will be able to create or update a 2nd level Entity on the MSCRM side.
The lines to take into account for the creation or update of the entities are identified thanks to a synchronization column. If the line cell for this specific column is not empty (not null), then the quote line is eligible for the creation or update of the MSCRM entity The mapping set (OUT Mapping
Type) allows establishing a correspondence between the line columns and the 2nd level entity fields:
- it indicates the type of entities to be generated
- it specifies, for each entity, the synchronization column allowing to identify/select which quote lines are used to update/create/delete the entities
- it is driven by the entity management policy.
- it maps the entity fields with quote line cells
Entity Management Policy rules:
- ‘Basic’ policy (‘Delete & Re-Create All’ policy): when the Quote synchronization process is launched, all the 2nd level entities linked to the parent entity are deleted. Then brand new entities (one per quote line identified by a non-empty value in the quote synchronization column) are created following the mapping OUT structure in the PROS Mapping Set.
- ‘Advanced update (delete/update/add)’ policy: when the Quote synchronization process is launched, for each line of the quote (identified by a non-empty value in the quote synchronization column), the process compares the value of this cell with the synchronization ID stored in the already existing 2nd level entities:
- If an already existing entity having the same synchronization ID is found, then this entity is updated.
- If no existing entity with the same synchronization ID is found, then a new entity identified by the synchronization ID is created
- Other entities attached to the parent entity are deleted.
- ‘Advanced update (update/add)’ policy: when the Quote synchronization process is launched, for each line of the quote (identified by a non-empty value in the quote synchronization column), the process compares the value of this cell with the synchronization ID stored in the already existing 2nd level entities:
- If an already existing entity having the same synchronization ID is found, then this entity is updated.
- If no existing entity with the same synchronization ID is found, then a new entity identified by the synchronization ID is created
- Other entities stay attached to the parent entity
If you have chosen the ‘Advanced’ update policy, you have to ensure that a field having the same name as the CPQ synchronization column is present on the synchronized 2nd level entities. Indeed, this field is used to store the unique identifier (called synchronization ID) of the entity. This ID (which has to be a String – TEXT type) allows determining if the entity has to be deleted, created or
updated.
If the field is not present, you have to add this field as a custom field on the entity.
In this example we will create a new custom entity: “Asset”. This entity will be a child of the “Account” system entity. To create a new entity, proceed as follows:
- Go in the Settings > Customization > Customize the system menu in the navigation bar
- Click on Components > Entities
- In the right part, click on “New entity”
- Fill the mandatory fields and save:
- Create a new 1-to-Many relationship between the Account and the new Asset entity
To have an example on how to create this kind of relationship, please refer to the chapter: Synchronizing Quote Lines
To illustrate 2nd level entities mapping, we will create as many Assets linked to the Account as we have lines in the spreadsheet for which synchronization column is not empty.
- [In the PROS Mapping Set]
(If not activated check your access rights)
Create a new (or edit an existing) PROS Mapping Set.
- [In the PROS Mapping Set Builder]
Define the external fields you want to update when updating the PROS Quote Content OUT:
- Ensure that the Mapping OUT is selected
- By default, only the Quote Entity is selected. Click on “Add” and select the Account parent entity. Then select the “Account” entity in the tree and “Add” the “Asset” second level entity
- Select the “Asset” entity
- In the right part of the builder select the mapping policy
- Indicate the synchronization column name
- Define the fields you want to update (check the boxes of the fields to be mapped) and indicate the name of the CPQ column used for the synchronization
- Click on ‘Save Mapping’
- [From the PROS Custom Settings]
- If not already done, specify the name of the Mapping set you want to use for your Quote.
You have to ensure that the fields on both CPQ and MSCRM sides are of the same type.
Moreover, the mapping OUT will only work if the current user has a profile allowing to update the ‘OUT’ entities.
For example if users have the following profile and your Mapping OUT targets the Accounts and Assets, this configuration will not work.
If a field of a sync entity is mandatory and the mapped CPQ field is empty, then the MSCRM entity field is not updated and keep its former valuation.
For the specific case of the Opportunity Products synchronization, please refer to the following chapter: Synchronizing Quote Lines
Proposal sync.
When generating some proposals in CPQ, these documents are sent to MSCRM during the synchronization process. They are then stored in the “Notes & attachments” section of the Quote entity, in the “Notes” tab.
The generated documents are also stored in the PROS Quote Content OUT entity on every Out synchronization. They are deleted in that entity on every new Out synchronization. This helps managing the case where the Quote entity is in Read-Only mode when doing an Out synchronization (thus preventing the automated storage in the "Notes and attachment section"). By storing the documents in the PROS Quote Content Out entity, it allows copying them in the Quote object whenever the Quote is not Read-Only anymore. This copy has to be implemented separately as a customization (not included in the managed solution by default).
The Out synchronization process from CPQ to MSCRM allows to synchronize 0 to N documents at the same time.
By default, N is limited to 1 but you can configure CPQ to extend this limit.
Quote Revision
MSCRM provides the capability to revise a quote. This is available in standard via the ‘Revise’ button in the Quote entity action bar. On the CRM side, clicking on that button clones the current quote and creates a new one with a new quote ID and an incremented Revision ID. In that operation, the associated Quote Lines are also duplicated in the new quote.
For this operation to be successful in the context of the CPQ managed solution, it is important that a new quote is created in CPQ and associated with the new CRM quote revision, anytime a new revision is created by the CRM end-user. Therefore, on each ‘Revise’ action in the CRM, a specific sync mechanism is triggered to clone the source CPQ quote and to associate it with the new CRM quote revision. The corresponding CPQ quote lines are synced with the CRM new revision as well as all the fields entering in the setup of the PROS Mapping Set.
In both systems, the source quotes are kept and maintained in sync
CPQ Integration Customization (advanced)
In the following chapter we describe how to customize the standard CPQ integration
- understand the way CPQ is integrated with MSCRM
- know how to code Workflows and plugins within MSCRM
PERSONALIZING THE IN SYNCHRONIZATION PROCESS
There are two cases when we need to synchronize data from the CRM to CPQ: Refreshing a quote, and Opening a quote.
For optimization purpose, we synchronize data differently in these two cases.
Personalizing the IN Synchronization Process when opening a Quote
For optimization reasons, synchronization process is done within an internal library. Any additional logic or data will need to be built within the CPQ quote. You will need to address this case with Professional Services, more specifically with Customer Enablement.
Personalizing the IN Synchronization Process when opening a Quote
In the case of quote Refresh, If you need to replace the way MSCRM synchronizes its data with CPQ, you have to modify the custom action that performs the In synchronization.
To change the In synchronization custom action, proceed as follows
- Go in the Settings > Processes menu in the navigation bar
- Open the process named “Cameleon In Synchronization”.
If needed, you can assign the process to your user and deactivate it. Be careful that In synchronization is not possible when the process is deactivated.
Replacing standard behavior with your own logic
To use your own custom logic, just delete all steps in the process and use your own Custom Workflow Activities. They have to generate a XML feed that can be consumed by the CPQ web service. You can use the CPQ Custom Workflow Activity “ExecuteRequestActivity” to send the XML feed to the CPQ web service.
Add your custom logic in standard behavior
To insert your own custom logic in the standard behavior, write a Custom Workflow Activity. Your Custom Workflow Activity has to implement one parameter:
- XmlFeed: a String In Argument to read the xml feed sent by MSCRM
- This CPQ Custom Workflow Activity must be placed after the Custom Workflow Activity “FillQuoteXmlDataActivity” validation (red line on the screenshot below). This Custom Workflow Activity exposes the XML Feed as an output argument, so you can consume and update it in your own Custom Workflow Activity.
- When your Custom Workflow Activity is added in the process, activate the process.
Example of code to modify the XML:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.IO;
using Microsoft.Xrm.Sdk;
namespace MsCRM.CameleonCPQ.CustomWorkflows
{
public class customXmlHelpers {
public customXmlHelpers(){}
//Generate the Custom Settings and the Cart Data and attach them to the 'xml'
parameter which already contains the header.
public String generateCartData(String xml, Entity quote) {
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
//get the root element of the Xml Document
XmlElement root = xmlDoc.DocumentElement;
XmlNode elemNode = xmlDoc.SelectSingleNode("/cartSession/customSettings");
if (elemNode == null){
XmlElement customSettings = xmlDoc.CreateElement("customSettings");
//Create Custom Settings
XmlElement settingNode = xmlDoc.CreateElement("setting");
XmlAttribute typeAtt = xmlDoc.CreateAttribute("type");
typeAtt.Value = "java.lang.String"; //test
XmlAttribute valueAtt = xmlDoc.CreateAttribute("value");
valueAtt.Value = "valueCustomSettings";
XmlAttribute idAtt = xmlDoc.CreateAttribute("id");<
idAtt.Value = "idCustomSettings";
settingNode.Attributes.Append(typeAtt);
settingNode.Attributes.Append(valueAtt);
settingNode.Attributes.Append(idAtt);
customSettings.AppendChild(settingNode);
root.AppendChild(customSettings);
} else {
XmlElement settingNode = xmlDoc.CreateElement("setting");
XmlAttribute typeAtt = xmlDoc.CreateAttribute("type");
typeAtt.Value = "java.lang.String"; //test
XmlAttribute valueAtt = xmlDoc.CreateAttribute("value");
valueAtt.Value = "valueCustomSettings";
XmlAttribute idAtt = xmlDoc.CreateAttribute("id");
idAtt.Value = "idCustomSettings";
settingNode.Attributes.Append(typeAtt);
settingNode.Attributes.Append(valueAtt);
settingNode.Attributes.Append(idAtt);
elemNode.AppendChild(settingNode);
}
//return the XmlDocument as String
using (var stringWriter = new StringWriter())
using (var xmlTextWriter = XmlWriter.Create(stringWriter)) {
xmlDoc.WriteTo(xmlTextWriter);
xmlTextWriter.Flush();
return stringWriter.GetStringBuilder().ToString();
}
}
}
}
PERSONALIZING THE OUT SYNCHRONIZATION PROCESS
Write your own Custom Workflow Activity
To understand how to develop your own Custom Workflow Activity, please refer to the MSCRM how-to provided online by Microsoft on this topic.
Your Custom Workflow Activity has to implement three parameters:
- XmlFeed: a String In Argument to read the xml feed sent by CPQ
- Success: a Boolean Out Argument that indicates if the synchronization succeeded or not
- Message: a String Out Argument that allows sending information back to CPQ
Replace Out Synchronization with your own logic
If you need to replace the way CPQ synchronizes its data with MSCRM, you have to modify the custom action that performs the Out synchronization:
To change the Out synchronization custom action, proceed as follows
- Go in the Settings > Processes menu in the navigation bar
- Open the process named “PROS Synchronization Out”
If needed, you can assign the process to your user and deactivate it. Be careful that Out synchronization is not possible when the process is deactivated.
- Replace the custom activity “ContentOutActivity” by your own Custom Workflow Activity
- Map the arguments in your Custom Workflow Activity and in the process steps
- Then activate the process.
CALLING STATELESS ACTIONS
Stateless actions can be used to make calls to CPQ services from MSCRM. These actions can be invoked at any step of the quotation process.
This configuration implies to:
- Use the stateless methods provided in the MSCRM solution with the corresponding CPQ model action:
/****************************************
- entityId : Id of Quote object
- operationType : (fixed value)
- initAction : Name of CPQ Quote Model action
*****************************************/ function executeInSync(entity)
- Configure the corresponding stateless action in the CPQ Quote Designer
For instance, a “Print proposal stateless” action can be configured to generate proposal documents directly from the Quote in MSCRM, without requiring opening CPQ.
In that example, the two steps above can be implemented as follows:
- Implement the call to the stateless method as follows:
function executeInSync(entityId, operationType, initAction)
{
// Creating the request XML for calling the Action
var requestXml = "";
requestXml += "<s:Envelope
xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
requestXml += " <s:Body>";
requestXml += " <Execute
xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\"
xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
requestXml += " <request
xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
requestXml += " <a:Parameters
xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
requestXml += " <a:KeyValuePairOfstringanyType>";
requestXml += " <b:key>Target</b:key>";
requestXml += " <b:value i:type=\"a:EntityReference\">";
requestXml += " <a:Id>" + entityId + "</a:Id>";
requestXml += " <a:LogicalName>cam_cameleonquote</a:LogicalName>";
requestXml += " <a:Name i:nil=\"true\" />";
requestXml += " </b:value>";
requestXml += " </a:KeyValuePairOfstringanyType>";
requestXml += " <a:KeyValuePairOfstringanyType>";
requestXml += " <b:key>operationType</b:key>";
requestXml += " <b:value i:type=\"c:string\"
xmlns:c=\"http://www.w3.org/2001/XMLSchema\">" + operationType + "</b:value>";
requestXml += " </a:KeyValuePairOfstringanyType>";
requestXml += " <a:KeyValuePairOfstringanyType>";
requestXml += " <b:key>initAction</b:key>";
requestXml += " <b:value i:type=\"c:string\"
xmlns:c=\"http://www.w3.org/2001/XMLSchema\">" + initAction + "</b:value>";
requestXml += " </a:KeyValuePairOfstringanyType>";
requestXml += " </a:Parameters>";
requestXml += " <a:RequestId i:nil=\"true\" />";
requestXml += "
<a:RequestName>cam_insynchronization</a:RequestName>";
requestXml += " </request>";
requestXml += " </Execute>";
requestXml += " </s:Body>";
requestXml += "</s:Envelope>";
var req = new XMLHttpRequest();
req.open("POST", getClientUrl(), false);
req.setRequestHeader("Accept", "application/xml, text/xml, */*");
req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");v
req.setRequestHeader("SOAPAction",
"http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execu te");
req.send(requestXml);
//Get the Resonse from the CRM Execute method
return req.response;
}
function getClientUrl()
{
var clientUrl = "";
if (typeof Xrm.Page.context == "object")
{
clientUrl = Xrm.Page.context.getClientUrl();
}
var servicePath = "/XRMServices/2011/Organization.svc/web";
return clientUrl + servicePath;
}
And then call the method executeSyncIn as follows:
executeInSync(Xrm.Page.data.entity.getId(), 'openReleaseStateless', 'PrintStateless')
You can plug this method call to a button in the MSCRM interface for instance.
- In CPQ, add an Automated Action, triggered by a ‘StatelessExecutionMode’ (i.e. the action can be launched when CPQ Web service is launched in silent mode) and of type JavaClass pointing to the following class:
com.pros.mscrm.services.ExecutePrintStatelessAction
