- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 04:43 PM
Hello guys, can you notice something wrong in this script? It is returning a string and when I try to access it in the client side, even parsing with JSON.parse, I cannot access the obj elements...
Script include:
OnChange client script:
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 05:02 PM
response.getBody()
returns a string, so you shouldn't "stringify" it - it is already a string.
An advice, if you allow me: post text, not pictures.
Someone might want to test your code, should that person re-type what you already have? How many do you thing would go the length?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 05:02 PM
response.getBody()
returns a string, so you shouldn't "stringify" it - it is already a string.
An advice, if you allow me: post text, not pictures.
Someone might want to test your code, should that person re-type what you already have? How many do you thing would go the length?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2022 04:32 PM
Thanks a lot, it worked.
And thanks for the advice, I'll take it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2022 09:07 PM
You're welcome, I'm glad it works! 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 05:28 PM
getXMLAnswer() returns a string and not an object so can's do answerParsed.logradouro.
Would need to do ga.getXML(HelloWorldParse);
ga.getXMLAnswer(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('street', answerPrsed.logradouro);
g_form.setValue('city', answerParsed.localidade);
}
If the value is not being returned from script include, the most common cause is the object returned is not created properly.
When creating an array, use .toString().
e.g.
var jsonData = [];
jsonData.push(gr.street.toString()); // convert object to string
Return a JSON.stringify(array).
return JSON.stringify(jsonData);