- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 08:08 AM
Hi All,
Im trying to call a script include function inside it's script include. I've attempted it already with no results.
I was wondering if it was even possible to do what I'm attempting in a script include?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 08:47 AM
Hi Justin,
Reference functions with this.functionName().
Example:
var foo = Class.create();
foo.prototype = {
initialize: function() {
},
bar : function() {
this.zip(5);
},
zip : function(num) {
gs.info('num=' + num);
}
type: 'foo'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 08:47 AM
Hi Justin,
Reference functions with this.functionName().
Example:
var foo = Class.create();
foo.prototype = {
initialize: function() {
},
bar : function() {
this.zip(5);
},
zip : function(num) {
gs.info('num=' + num);
}
type: 'foo'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 06:24 AM
Thanks, Chuck! Exactly what I was looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2018 04:29 AM
Hi Chuck, ctomasi
We don't use this in business rule. Also in script includes sometimes we use "this" and sometimes not. For example please see below code taken from a script include. updateClassIfExists is being called without "this" but _generateProfilesFromType is being called with "this", kindly tell the difference?
generateProfilesFromType: function(type, updateClassIfExists) {
return this._generateProfilesFromType(type, updateClassIfExists); },
Regards
Ramandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 03:31 PM
I suspect the first instance is being used as a callback or reference. You're not calling the function outright, but rather passing it as a variable to another function (generateProfilesFromType). You're doing it again in the second one too....
If your code is calling the function/method directly, you need this.functionName, but if you're passing it as a parameter, then you don't.