Does anyone know how to call a JavaScript from within a JavaScript?
I have two scripts in my job, one local and one global. I want the global script to give me a result and populate a target in my database table and I want my local script to take that result and run a SQL query on it. I'm using a From LDAP pass so I cannot just wrap the function call inside another function call. From LDAP passes have a column specifically for the scripts so you can only use one per line.
So again, anyone know how to do this, call a script from inside a script?
Request clarification before answering.
Hello Brandon,
check the sap script for generating a password. It should include other scripts. I'm not at work right now so I can't check the function to call a script, but it wasn't complicated.
.
Regards,
Steffi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. The only thing I can think of is conflicting scope, i.e. one script is local and the other is global and the local script is trying to call the global script. Maybe they both have to be global or local but you can't have a mix match? I'll find out later today. Need to get into that client's site after getting some other stuff caught up.
Hey Brandon,
today I called a global script within a global script.
Both are of course linked in the job and the call in the first script was just
result = otherglobalscript();
So pretty easy indeed (the called script does not need a parameter, that's why () is empty). So I think you are correct, that it might have an issue with one script being local and one global (even though I'm confused why this would be an issue).
.
Regards,
Steffi.
Lol... So, I found out the reason why I was having issues. I was doing a lot of cutting and pasting when I was trying to get this script calling another script to work and the version of the script that's deployed in IDM is called something like, "custom_sap_blah". In my Notepad++ files, the script is called, "z_custom_sap_blah" so when I did what I did, the call to the global script was:
var output = z_custom_sap_blah(Par);
This, of course, will not work. Once I changed the call to the proper name of the script as it's deployed, it worked. Sorry all. A simple typo was the issue and it's my fault. 🙂
Good that it was just a simple CnP error. I was scared reading the thread as I do script calls all the time. 🙂
Hi Brandon,
Supposer you are inside script A. call the script as below
function ScriptA(Par)
{
//Calling script B
//if script b returns any values then user below syntax
var res = scriptB(Par); or UserFunc.scripB(Par)
//if script b doesn't return any values then user below
scriptB(Par); or UserFunc.scripB(Par)
}
Regards,
DP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.