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
Bill_kurasBill_kuras 

Calling APEX Class from workflow

I have an APEX Class that is used as a controller for a visualforce page.  The visualforce page is called from a button event.  The class's main purpose is to call a webservice. I would like to use the class's method that calls the webservice in workflow.  Is there a way to do that?

Best Answer chosen by Admin (Salesforce Developers) 
EnthEnth

You need to create a (hidden) custom field which you update from your workflow as a field update action. Then write an Apex Trigger that calls your apex class when the (hidden) field is changed to the value set by the workflow.  

All Answers

EnthEnth

You need to create a (hidden) custom field which you update from your workflow as a field update action. Then write an Apex Trigger that calls your apex class when the (hidden) field is changed to the value set by the workflow.  

This was selected as the best answer
tggagnetggagne

That might be the answer, but it would be simpler and more obvious to call Apex methods directly from workflow.  With Apex being last on the the Chatter enhancements list, and being unavailable to workflow, it's almost as if Salesforce has different plans for Apex than the rest of us.