0

I am trying to achieve like an Apex invoke-able method that takes input Object Name, field(s) to update, values for the corresponding field, Ids to use in query, the Apex method will query based on parameters and update passed fields with values.

Or, Could I create a formula field under an object that has all my apex code like SELECT statement diff_object, Ids passed to operate on, fields to update, values to set, update statement at end.

Then invoke Apex method from Process builder, pass this formula field as input, apex understands and run the logic.

2

The first method you describe where you have parameters defined for variables is something that's achievable.

The problem with the 2nd method you describe is that while you can pass a query as a string or values to set in variables, you cannot pass code statements as strings in variables. You would also not be able to pass all of it as a formula field from a process builder or from an object's formula field since either one would be expected to "execute" or "evaluate" the formula field, not pass the contents to the Apex class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.