Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

How to call a function from a different script object?

Avatar

Former Community Member

Hi All,

Here is the scenario,

I have 2 script objects A and B .

In script object A i have a function called "funcA" and

in script object B i have a function called "funcB"

Now I want to call funcA from funcB which is not happening.

I tried doing

A.funcA();

inside funcB , but not able to access.

Kindly help.

Thanks

Abhiram

1 Reply

Avatar

Level 10

Hi Abhiram,

Just a guess - try including the root node/node reference above the script object.

form1.A.funcA(); 

What does the JavaScript Console say when firing the function? Are there any errors?

Your script objects can contain multiple functions. So you could move funcA() and funcB() into the same script object. This will make it easier.

Niall

Assure Dynamics