The power of JSON to generate your dynamic data in calculation field

You can build dynamic records in your calculation field using json.

This is how it works I have 2 workspace CRM and Lead source, Inside CRM workspace we have Leads app this will be the main app used to monitor leads.

In Lead source worspace we have list of apps be pulled from different lead source websites using mail to app, webhook and API.

each leads app generate your json data using calculation field

if you link this to the main app like the Leads app, pull the records from relation app is easy no need to write them manually per field in calculation field, just pull them using the power of json in javascript.

you can create javacript function inside calculation field to parse json:

function JP(json){var jObj;try {jObj = JSON.parse(json);} catch(e){"Error"} return jObj;}

Generate your dynamic records using javascript loop then insert it in table

for (var key in JP(json)) {
 if (JP(json).hasOwnProperty(key)) {
  table = table + "<tr>";
  table = table + "<td>"+key+"</td>";
  table = table + "<td>"+JP(json)[key]+"</td>";
  table = table + "</tr>";
 }
}

this is the result if i click any of the lead source button it will generate records base in Lead source app, remember each lead source app has different fields inside it.


6 Likes

Thanks for sharing @comfreakph - this looks really powerful.

One question that came to my mind: how do you populate the field โ€œjson_property_leadsโ€ in your 3rd screenshot? :slight_smile:

Hi @Tim, I manually create a json format in string :slight_smile:

1 Like

Very impressive! i also started to check this direction in order to overcome the need to create the variables in each calc field (and the reference limit), and i think you saved me allot of research time with those instructions :grinning:

@Tim i populate the calc field by creating an object of {key:value}, then using JSON.stringify(object) to fill the calc field with the JSON (i assume this is the same method @comfreakph used)

1 Like

Hi @shir ,
no need to stringfy the json. will post an image in my custom json format

1 Like

This is the json format in json_property_leads

2 Likes

@comfreakph
Great view! HTML support enables so many options for customization :slight_smile:

However, I have the problem that sometimes the calculation field is not up to date with the data. Did you also encounter this problem? What do you think could be the issue?

1 Like

@Mario
try to use with all of json with null

2 Likes