Call super method from extended class (Script Include)

GLewis5
Tera Guru

If a Script Include extends another class, how can I call a method in the super class?

1 ACCEPTED SOLUTION

Brian104
Tera Expert

It actually turned out pretty simple:

yourParentClassName.prototype.yourMethodName.call(this, data);

// Example in initialize

initialize: function(make, model, color){
 
     Car.prototype.initialize.call(this, make, model);

     this.color = color;

}

I found this from the article below with an example and it works:  https://community.servicenow.com/community?id=community_article&sys_id=7ef8d786db5d1cd023f4a345ca961...

View solution in original post

1 REPLY 1

Brian104
Tera Expert

It actually turned out pretty simple:

yourParentClassName.prototype.yourMethodName.call(this, data);

// Example in initialize

initialize: function(make, model, color){
 
     Car.prototype.initialize.call(this, make, model);

     this.color = color;

}

I found this from the article below with an example and it works:  https://community.servicenow.com/community?id=community_article&sys_id=7ef8d786db5d1cd023f4a345ca961...