Method overloading check

abhijats
Tera Expert

Hi Everyone,

Last time my manager asked me to check if system support Method Overloading concept and I created a business rule with two Methods with different parameters, then I called 1st method in another business rule. but the result was not in support of Method Overloading concept. Everytime the last method was getting executing although I had created those methods with different parameters and also tried to call 1st method by its parameter only. So does that mean in SNC environment I can't use Method Overloading thing or I had performed that exercise in a wrong way. Please provide your opinion on the same, If have any sample program that will be better.

15 REPLIES 15

DaleHurtt
Kilo Contributor

The line of code:


this.y=d;


Should have been:


this.y = this.d;


As d was undefined, the script stopped on the error.


abhijats
Tera Expert

Hi Dale,

Thanks, now this code is working. If you have some more examples related to java script execution in SNC environment please throw light on them. It will be a good learning to know about :

1> I always think if it is possible to create JAVA program in some part of SN so that it can be called later or we can only create java script codes in Script include for re-usability ?
2> I am concern about the internal mechanism of SN in terms of creation of codes and calling it from different parts, like the OOB Glide Functions or Packages. How can I form such type classes/functions?

Please share your views..


DaleHurtt
Kilo Contributor

If you can write Java code and call it from within ServiceNow, I do not know how. That said, the JavaScript running server side is running in Rhino, a JavaScript interpreter written in Java. http://wiki.service-now.com/index.php?title=Glide_Stack#User_Interface_Stack_Technology_Map and http://www.mozilla.org/rhino/

I am sure Rhino can interface Java components, but I am not sure how you would go about uploading your own to your instance, and whether ServiceNow would allow it. A call to support would probably clear that up.

Don't forget that you can always create a Java application that responds to web services and embed your business logic in that. Again, I don't know how you could run those resources on the ServiceNow instance, if at all, so talk to support. If they can't do it, running your own Amazon EC2 instance is still pretty inexpensive.

Script Includes and Business Rules are a great way to create reusable code. I suggest the book JavaScript Patterns as a great way to think about organizing your code. If you are heavy into client-side scripting, I suggest the book JavaScript Web Applications, although it gets rather deep very fast.

I would be shocked if you needed another way to run code, given the more than 200 places where you can put it (according to their Scripting class book). Coming from a lengthy (18+ years) run with BMC Remedy, I find that the hardest part of ServiceNow development is translating what I know (and how to do it) into how ServiceNow does it. I have a few friends that came from the Remedy world too, and they indicate the same. It sounds like you come from a Java world, so you will have that same challenge - translating what you know and how to do it into the ServiceNow way.


abhijats
Tera Expert

Yea Dale, Before coming into ITSM world I was learning about OOPS, and basic way of forming logic on .Net and Java plateform that's why I have curiosity to understand the SNC environment that how all internal communication with different pieces of code is going on afterall the system should have been following those same concepts.
If I get that type of knowledge, I will be able to customize requirements in better and effiecient manner in SNC environment.


abhijats
Tera Expert

.