Issue reading our variables from external code in Reactive Web

Hi,

I'm going to explain my issue: 

I have a reactive web, and an external company has a JS component that I have to integrate in my app.

The only thing I need to do is to include the external JS reference to my page and in my JS code I have to declare a variable with an specified name given by them and push the attributes to that variable.

The problem is that they can't read the properties of my variable from their code, (always undefined). We have tried this in many ways and it always work in every scenario, like for example, a simple HTML opened with a browser and it doesn't need to be published in an app server.

In Outsystems, I think there must be some security facts involved that makes this impossible to reach.

Have you ever had a similar case?

Do you know a solution?


If you need more info, just me let know.

Thank you in advance

what variable property assign to js component?

i think you need to pass widegt id for js component and than it will read widget property.

Widget like - input/checkbox/dropdown/container etc.


regards

Rahul Sahu

Rahul Sahu wrote:

what variable property assign to js component?

i think you need to pass widegt id for js component and than it will read widget property.

Widget like - input/checkbox/dropdown/container etc.


regards

Rahul Sahu

Hi Rahul.

I don't have an specified widget for this. 

I only have a javascript reference in my DOM and a javascript variable declared on the onready (I also tried oninitialize) event.

The external JS can't read my var and I think is for the context generated in a Reactive Web page, because they always have undefined value.


Thanks


Hi Jorge Sánchez

how are you passing variable for this JS.

you are using any function of this JS. can you share some images or code.


Regards

Rahul Sahu

Rahul Sahu wrote:

Hi Jorge Sánchez

how are you passing variable for this JS.

you are using any function of this JS. can you share some images or code.


Regards

Rahul Sahu


No, I have just a var:

var _chatq = _chatq || [];

_chatq.push(["_fillCustomVariable", "custom_country_scf", proso_Pais]);
_chatq.push(["_fillCustomVariable", "custom_language_scf",proso_Idioma]);
_chatq.push(["_fillCustomVariable", "custom_service_scf",proso_Service]);
_chatq.push(["_fillCustomVariable", "custom_test_sgin_priority",proso_Prioridad]);


This var needs to be read from in an external JS that can't be modified because is an external product. The name of the var can't be modified in all ways. It has to be _chatq

I have declared that var in OnInitialize (And also tried on OnReady) like a JS added.


When I click in a button (for example), I create the JS reference to the DOM and is loaded:

(function(d) {
    var cm = d.createElement('scr' + 'ipt'); cm.type = 'text/javascript'; cm.async = true;
    cm.src = 'https://nameoftheexternaljavascriptdomain/loader.js';
    var s = d.getElementsByTagName('scr' + 'ipt')[0]; s.parentNode.insertBefore(cm, s);
  }(document));

The external JS is loaded and debuggers are set, and the var _chatq is always undefined.

This var must be global and accesible from everywhere, also external.

Thank you in advance.