Calling global Script Include in a scoped Business Rule

yundlu316
Kilo Guru

We brought in moment.js as a global script includes and are trying to access it via a business rule it keeps returning as [Object object].

 

In our Business rule, we've put in the following:

var x = new global.moment();
gs.addInfoMessage(x);

This returns an info message saying [Object object].

However, when we put in the exact same code in Background Scripts, it returns back as today's date.  Any advice?

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

you need to call function in moment script include from your business rule to return any value.

 

Regards,

Sachin

Abhinay Erra
Giga Sage

how did you define the script include? Did you use classless function for defining moment in the script include?

hey abhinay, yes I couldn't get momentjs to work at all with the normal script includes syntax.  My script includes looks like this:

find_real_file.png

 

i tried and i am able to get that.

 

please refer the screenshot below.

 

find_real_file.png

 

Now i am in scoped application

 

find_real_file.png

 

find_real_file.png

 

Note: Make sure your script include set as "All Application scope"

also remove the variable var moment= from line number 1

 

give a try