Views:

Scenario Overview

This simple scenario is an example of how to make a change a score from a Survey response based on how many other open cases the customer has in CRM currently.

The reason for this would be that if a customer has multiple open cases then we might lower the survey response score to highlight the fact that this customer may need some additional care or support.

Survey Response

N52 Formula Manager Solution

The Formula Manager solution works like this:

  • Formula of type 'Save - To Current Record' is set up on the Survey Response entity  
  • The formula is configured to the Pre-Operation stage.
  • The formula is triggered on Create of the Survey Response.

N52 Formula

                      

N52 Formula Manager Steps

The following set of steps outline how to create this Formula:

  • Create the formula of type Save - To Current Record on the Survey Response entity 
  • Copy in the formula code below
  • Use N52 Commands button to Toggle Advanced View and set the Stage to Pre-Operation
  • Create the FetchXML CountOpenCases and copy in the code below.
  • Click save and test

Formula

SmartFlow(
  
    SetVar('OpenCases', FindCountFD('CountOpenCases', 
                      'incidentid', 
                      '0', true,
                      SetParams([msdyn_surveyresponse.msdyn_contact.contactid.?]),
                      true)),
  
    Setvar('Score', [msdyn_surveyresponse.msdyn_score]),
 
    Iftrue(GetVar('OpenCases') > 0,  GetVar('Score')-20)

)

FetchXML CountOpenCases

<fetch version="1.0" >
  <entity name="incident" >
    <attribute name="incidentid" />
    <filter>
      <condition attribute="contactid" operator="eq" value="{0}" />                              
      <condition attribute="statecode" operator="eq" value="0" />
      <condition attribute="prioritycode" operator="eq" value="2" />
    </filter>
  </entity>
</fetch>