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
pierrefrazny.ax358pierrefrazny.ax358 

javascript in apex class?

Hello,

I have a button which executes some javascript. I need to expose this function via the api. 

Could I call the javascript in a apex? and then could I call the apex function via the api?

Thanks 

Best Answer chosen by Admin (Salesforce Developers) 
sfdccoder1sfdccoder1

1. You can't call javascript functions from Apex.

Javascript rusn on the user browser while Apex runs on SFDC servers.

 

2. You can call apex functions via the if you define them as web services.