Pump multiple linked app fields from one app to another
Hi Calculation gurus,
I'm looking to create one calculation to 'pump' many app fields from one app to another. When I do something like
- app 1: `JSON.stringify({firstname: @firstname, date: @Date, number: @Number})`
- app 2: `var data = JSON.parse(String(@All of Calculation[0]));`
I get `Script syntax error: Unexpected token S` so the text is not just basic stringified json but probably has some invisible bytes / characters in it.
Has some one found an elegant way to migrate a bunch of of values (while preserving type) from one app to the other?
-
Short version
try {
JSON.parse(data).firstname;
} catch (e) {
"Could not parse JSON"
}Long version
This was already solved here https://help.podio.com/hc/en-us/community/posts/202620823-Using-calulation-field-javascript-to-parse-JSON
We need to wrap the code in a try catch block because at the time that we save the calculation. Podio will validate the calculation and insert ["Script field example text"] into @all of calculation. This is of course no valid json string and let's the validation fail.In real circumstances the calculation does work fine so bypassing it (just to getting it stored in Podio) is the way to go.
Please sign in to leave a comment.
Comments
1 comment