Code studio - External requests/responses


#1

Are we able to currently deal with external data in a code studio call back (e.g. fetch or ajax requests/responses) from either an API defined in code studio or a call created in build?

Or is there another method of dealing with this example? When the map widget is clicked we can get the lat/lng and update a field with this data using a call back. However during this call back can we also connect to a reverse geocoding service to display the address without having to save the page?


#2

Hi James,

I am currently researching this and will get back to you once I have the correct answer.

Regards MP


#3

Hi Mark thanks for checking. I should note the original question and the extra below is for v10.2.

As an add on, I’ve been trying to make an API call in build from an Event Action but I’m getting an error, can you check below and see what I’m doing wrong with mats.api_call ?

var a_mats_record = mats.record(params.record_id);
var api_call = mats.r('api_call_id','api_call_reference');
mats.​api_call(api_call, a_mats_record​);

The Event Action works up until the call (setting various field values on a_mats_record) but breaks then. I’m returned an error “SyntaxError: Invalid or unexpected token”. I presume either a_mats_record or api_call are not defined properly?#

Is there any wider documentation with examples for the expanded code studio? E.g. a 10.2 version of this doc?


#4

Hi James, I haven’t forgotten your query. I’m taking advice on this one, and will get back to you as soon as I’ve had that advice. Cheers - MP