cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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?

0 Likes
View Entire Topic
Steffi_Warnecke
Active Contributor

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.

brandonbollin
Active Participant
0 Likes

I wouldn't think it would be complicated but the simple call of the script that I would think would work, isn't working.

var result = externalScript(Par);

That above line is producing an error when I try to use it. 😞

Steffi_Warnecke
Active Contributor
0 Likes

Are both scripts linked to the job?

brandonbollin
Active Participant
0 Likes

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.

Steffi_Warnecke
Active Contributor
0 Likes

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.

brandonbollin
Active Participant

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. 🙂

former_member201064
Active Participant

Good that it was just a simple CnP error. I was scared reading the thread as I do script calls all the time. 🙂