0

Lead Scoring Assistance

I need some help creating a formula to build Lead Scoring.  I have created a formular field in all Lead Records called Engagement Score.  I want it to build a score based on their status value with each status being a separate number worth, for example "Applicant" equals 50 points.  Then I want it to look at the Chrono subrecords and add up points based on "Successful Phone Calls, "Opened Emails", "Texted Back"  I just need a good way to build this so I can tweak it as I continue on to also include other variables as well.  Any assistance is greatly appreciated!

12 replies

null
    • Fred
    • 10 mths ago
    • Reported - view

    One way is the generous use of switch commands. For the Status you can do something like:

    let xStatus := switch Status do
      case 2:
         50
      case 12:
         25
    end
    

    For the chrono subrecords, I don't see a nice choice field that has those options, so I guess you are putting those phrases into the Chronos text block. Which makes filtering a bit more complicated.

    One idea is to create an engagement score in the Chronos table with something like:

    switch true do
    case contains(Chronos, "successful phone"):
        5
    case contains(Chronos, "text back"):
        3
    end
    

    The problem with this method is that it is case sensitive and switch statements stop after it encounters a successful case.

    Then in the Leads table engagement score field you would do:

    xStatus + sum(Chronos.'Engagement Score')
    
    • Dave_Irving
    • 10 mths ago
    • Reported - view

     

     said:
    One way is the generous use of switch commands. For the Status you can do something like:
    let xStatus := switch Status do
    case 2:
    50
    case 12:
    25
    end

     Where would I put this switch command?  I also just added toggle switches in my chronos for opened email and text response to make this easier.

    • Dave_Irving
    • 10 mths ago
    • Reported - view

    This is what I've started to put into the Engagement Score field and it doesn't return any values.

    let xStatus := switch Status do
        case 2:
            50
        case 12:
            20
        case 22:
            60
        case 13:
            70
        end;
    void
    
      • Fred
      • 10 mths ago
      • Reported - view

      nothing got returned because you didn't tell Ninox to express the variable. You just created one. Notice the void at the end. Just put xStatus at the end.

    • Dave_Irving
    • 10 mths ago
    • Reported - view

    Never mind, didn't add number() to the values

    • Dave_Irving
    • 10 mths ago
    • Reported - view

    Now getting stuck on the Chronos section.  Using this code

    let xStatus := switch Status do
        case 2:
            number(50)
        case 12:
            number(20)
        case 22:
            number(60)
        case 13:
            number(70)
        end;
    let xEmail := switch Chronos.'Open Email' do
        case "Yes":
            number(10)
        end;
    let xText := switch Chronos.'Text Response' do
        case "Yes":
            number(10)
        end;
    xStatus + xEmail + xText
    
      • Fred
      • 10 mths ago
      • Reported - view

      you don't need number() just putting a number without quotes is a number.

      To make things easier, the Open Email and Text Response checks should be in the Chronos table. Then you can do the sum(Chronos.'Engagement Score').

      • Dave_Irving
      • 10 mths ago
      • Reported - view

       For some reason it didn't work for me until I used number.  So odd.  Ok, but now I created a contact score in my Chrono records.  I used the following to no avail

      let xPhone := switch 'Type of Contact' do
          case 1:
              number(10)
          end;
      let xText := switch 'Text Response' do
          case "yes":
              number(10)
          end;
      let xEmail := switch 'Open Email' do
          case "yes":
              number(5)
          end;
      xPhone + xText + xEmail
      
      • Fred
      • 10 mths ago
      • Reported - view

      For yes/no, it is best to use 1 for yes.

      let xText := switch 'Text Response' do
          case 1:
              10
          end;
      
    • Dave_Irving
    • 10 mths ago
    • Reported - view

     Real quick.  With this code snippet, I want it to score any multiple choice that includes Phone Call which is ID #1.  Here is the code:

    let xPhone := switch 'Type of Contact' do
        case contains(chosen (1)):
           10
    

    I receive this error: Cannot read properties of undefined ('reading base')

      • Fred
      • 10 mths ago
      • Reported - view

      The contains() command needs an array/string and a single item to check.

      With multiple choice (regular or dynamic) you should use the numbers() command and not chosen() command. The numbers() command returns the selected choices and creates an array.

      Using a switch here probably is not the best choice. you can just use a simple if then.

      let xType := numbers('Type if Contact')
      let xPhone := if contains(xType,1) then 10 end
      

      A switch is great if you have multiple single outputs that you can set different results.  A switch goes down the list and stops at the first 'true' case. In this case if you use a multiple choice field you will may not get past the first case.

      But if you want to use the switch you can do something like:

      let xType := numbers('Type if Contact')
      let xPhone := switch true do
           case contains(xType,1):
               10
           end
      

      As you can see the if then is shorter.

    • Dave_Irving
    • 10 mths ago
    • Reported - view

    Perfect.  Used the first option!

Content aside

  • Status Answered
  • 10 mths agoLast active
  • 12Replies
  • 66Views
  • 2 Following