Salesforce Chat
Application Type

I'm trying to implement salesforce chat in a reactive application but it gives me the error below:

The code is a javascript generated by salesforce, and if I put this same code on a blank page with just the code the chat works normally.

Can someone help me?

Hi Carlos,

How are you including the external javascript to your application to get the chat to work. Are you adding the js script to Resources? Hope this post helps



In the OnReady add the JS:

var scriptSalesForce2 = document.getElementsByName("salesforceTag2")[0];

if( scriptSalesForce2===undefined ){

    var body = document.getElementsByTagName("BODY")[0];

    var script = document.createElement('script');

    script.setAttribute("type", "text/javascript");

// and the external JS is received in the parameter below;

    script.innerHTML = $parameters.Script;



I tried all the possibilities of the post, the same error always occurs. I just put the salesforce generated code in a js file and called it by Required Scripts it didn't work.  I did the load as Fabio Fantato explained the same thing.

I have no more ideas of what to do.

Hello @Carlos Eduardo Baldo,

I researched the error a bit and found that there can be a variety of reasons causing this error. So it is quite possible, it may not be related to how the javascript is being loaded. For e.g. of all articles this one seemed interesting. Please see if it is relevant in your use case. 

It would help if you could reproduce the issue as an oml file and share it here for the community to troubleshoot.

I will post the javascript here without the URLs, due to confidentiality. But in this same javascript, if I convert it to an index.html and put it on the outsystems development server and configure IIS it works perfectly.

var initESW = function(gslbBaseURL) {

embedded_svc.settings.displayHelpButton = true; //Ou falso        

embedded_svc.settings.language = '';      

embedded_svc.settings.defaultMinimizedText = 'Chat';       

embedded_svc.settings.disabledMinimizedText = 'Agente off-line';        

embedded_svc.settings.loadingText = 'Loading';       

embedded_svc.settings.enabledFeatures = ['LiveAgent'];

embedded_svc.settings.entryFeature = 'LiveAgent';








baseLiveAgentContentURL: 'https://',

deploymentId: '',

buttonId: '',

baseLiveAgentURL: 'https://',

eswLiveAgentDevName: '',

isOfflineSupportEnabled: false            




if (!window.embedded_svc) {

var s = document.createElement('script');

s.setAttribute('src', 'https://');

s.onload = function() {




} else {



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.