Advanced Scripting

Follow

Advanced scripting allows even more flexibility on output for your deliveries. 

Perhaps you need to post a specific value when your SSID field is blank.

Or maybe you need to post out XYZ in a field when your lead comes from Supplier A, but 123 in that field when the lead comes from any other Supplier.

Typically the above would need 2 deliveries to accomplish. However, with advanced scripting you can condense this into 1 delivery.

 

Please note - This feature is only available on JSON and XML deliveries and requires some technical knowledge.

 

To enable this feature, ensure the "Advanced Scripting" button is checked in your delivery's advanced settings:

775b476d-834e-42f3-bd86-b3044524b968__1_.png

 

Example A - 

{"Source": "[ssid]"}

A JSON delivery where SSID is sent, but when the SSID field is blank we need to post out "XYZ".

In order to post out XYZ, we'd need to use the below script:

{"Source": "{if $ssid == '' }XYZ{else}[ssid]{/if}"}

The above is checking to see if the SSID field is blank. If yes, post out XYZ, otherwise post out the value in the SSID field.

 

Example B - 

{"Source": "123"}

A JSON delivery where you need to post out XYZ in a field when your lead comes from Supplier 1, but 123 in that field when the lead comes from any other Supplier.

{"Source": "{if $sid == 'SUP1' }XYZ{else}123{/if}"

The above is checking to see if the SID of the lead has come from SUP1, if so post out XYZ. If not, post out 123.

 

Example C - 

{"License_number": "[data1]"}

A JSON delivery where you need to ensure that you post out a value which is 13 digits long even if you're only collecting a number shorter than this.

{"License_number": "{$data1|str_pad:13:0}"

The above is instructing LeadByte to "pad out" the value in the data1 field to 13 digits by adding 0's on the end.

 

This feature also has the ability to omit sections of your delivery under certain circumstances, check the article here for more information.

Was this article helpful?
0 out of 0 found this helpful

Comments