formula field syntax error

  • 3
  • Problem
  • Updated 3 years ago
I'm getting this error in runtime:

Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('scheduledInitialAppointments','TotalRecords','grpCategories',{{grpCategories}}). SyntaxError: missing ) after argument list

However, as you can see from the formula reproduced in the error message, there is just one open and one close parenthesis.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 3
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
This would be amusing, if I didn't need it to work. Even so, still slightly amusing.

Errors:

3. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('AVRonIntake','TotalRecords','grpCategories',{{{grpCategories}}})) *100. SyntaxError: missing ) after argument list
4. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('AVRonIntake','TotalRecords','grpCategories',{{{grpCategories}}})) *100. SyntaxError: Unexpected token )
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Single quotes, double quotes.
double mustaches, triple mustaches.

Still getting the same error on the model_lookup function:

1. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('scheduledInitialAppointments','TotalRecords','grpCategories',{{grpCategories}}). SyntaxError: missing ) after argument list2. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('scheduledInitialAppointments','TotalRecords','grpCategories',{{grpCategories}}). SyntaxError: missing ) after argument list
3. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('AVRonIntake','TotalRecords','grpCategories',{{{grpCategories}}}) *100. SyntaxError: missing ) after argument list
4. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('AVRonIntake','TotalRecords','grpCategories',{{{grpCategories}}}) *100. SyntaxError: missing ) after argument list
5. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('AVRonIntake','TotalRecords','grpCategories',{{{grpCategories}}}) *100. SyntaxError: missing ) after argument list
6. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP('AVRonIntake','TotalRecords','grpCategories',{{{grpCategories}}}) *100. SyntaxError: missing ) after argument list
7. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP("completedInitialAppointments","TotalRecords","grpCategories",Initial {{CaseType}} Appointment) *100. SyntaxError: missing ) after argument list
8. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP("completedInitialAppointments","TotalRecords","grpCategories",Initial {{CaseType}} Appointment) *100. SyntaxError: missing ) after argument list
9. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP("completedInitialAppointments","TotalRecords","grpCategories",Initial {{CaseType}} Appointment) *100. SyntaxError: missing ) after argument list
10. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP("ReturnAppointmentsScheduled","TotalRecords","grpCategories",{{grpCategories}}) *100. SyntaxError: missing ) after argument list
11. Invalid syntax for field formula: {{TotalRecords}} / MODEL_LOOKUP("ReturnAppointmentsScheduled","TotalRecords","grpCategories",{{grpCategories}}) *100. SyntaxError: missing ) after argument list
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
The Model lookup function only seems to work when I pass a static value for the last argument... it will not process merge syntax.

Both of the following work:

{{TotalRecords}} / MODEL_LOOKUP("completedInitialAppointments","TotalRecords","grpCategories","Initial Pregnancy Appointment") *100

{{TotalRecords}} / MODEL_LOOKUP('numberOfSchedulingLeads','TotalRecords','grpCategories',null) *100
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Is total records another formula field?  You alerted us to that issue last week. 
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
No, TotalRecords is a COUNT(Id).
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
I'm getting this same error when trying to merge in a field from an external data source.