function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dev_CA_TechnologiesDev_CA_Technologies 

Calling javascript method from Apex Trigger

Hi,

 

I need to call a javascript method, which in turn is using a web-services call from Apex Trigger.

Please advise the best way to do that.

 

 

 

Thanks,

CA Technologies Developer

 

NiketNiket

Hi ,

 

you can make a web-services call direct from apex without javascript.

 

write a class and and inside a method, make web service call from there . Now you can call the class method from the trigger.

 

Is there a specific reason to use javascript here ?? if yes, please explain your use case ..

 

Please mark it as the solution if it answers your question so that others can also take benifit. 

 

Ckeck My Blog


Navatar_DbSupNavatar_DbSup

Hi,

 

For achieving this put your JavaScript on a VF page and open the page from the Apex class after that call the class method in your trigger. 

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Dev_CA_TechnologiesDev_CA_Technologies

Niket,

 

I am trying to use the Ajax Toolkit methods in order to update UserTerritory object, since i cannot update it using Apex.

How do i call them from Apex (the Ajax Toolkit create/update methods)?

 

Thanks,

CA Technologies developer

craigmhcraigmh

Do what Niket said. The trigger's context is purely server-side, and JavaScript is interpreted on the client-side, so these two don't mix.

 

Just call the class from the trigger directly.

RamsRams

Hi,

 

Can you give the sample example for this...
 Thanks in advance..

 

 

Thanks,

Rams

Brett Bernstein 17Brett Bernstein 17
Has this been answered?