Sum two score fields into another score field with Webhook

Itay_Billet4
Level 8

Sum two score fields into another score field with Webhook

Hi all, we wanted to setup a webhook to calculate the sum of 2 fields (Behavior Score and Demographic Score) and update to another field called "Person Score".

We created the webhook and the php code (attached both), and we're getting Response Code: 200, but the actual "Person score" is not updated. 

Can you check what might be the issue? 

 

Many thanks

 

Itay

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Sum two score fields into another score field with Webhook

This isn't really the place to troubleshoot code running on a totally different server. The design of that PHP code is totally wrong, though: you don't need to (and certainly shouldn't) use the REST API to update. You send the summed field in the response and Marketo writes it to the person record.

Anyway, I think you still have a FlowBoost subscription. Why not use that? It's one and done:

sum = {{lead.field1:default=0}} + {{lead.field2:default=0}}