-1

I am calling global function defined in my salesforce org using the tooling api /services/data/v35.0/tooling/executeAnonymous/?anonymousBody= in python and that global class is actually returning a list of values which i need to capture in python. Is there a way to capture the value.

Regards, Balaji.

3
  • I don't know why this question is under rated. I am not worried about this, but please provide any solution for my requirement. Dec 22, 2015 at 14:30
  • please, go to any freelancers site, hire someone and then ask to provide some answers from them. P.S. Why don't use apex web services for that? P.S.S. Why dont create attachment/document in SF and query that? P.S.S.S. why don't google that question and find this salesforce.stackexchange.com/questions/83961/…?
    – kurunve
    Dec 22, 2015 at 15:27
  • @kurunve Thanks for the response. I am new to sales force so can you please elaborate on the apex web services and attachment/document part. Actually the global class which i am calling is from a managed package. Dec 22, 2015 at 16:29

1 Answer 1

0

I've covered a similar requirement before in Adding Eval() support to Apex. Essentially, you want to execute anonymous Apex and read a response.

There are two main ways to achieve this.

  1. Enable Debug logging when the anonymous Apex is executing. Then write out any return value to the log so it can be parsed out at a latter stage.
  2. Deliberately make a failed assertion call or throw an Exception. This method was first proposed by Kevin Poorman in his blog post EVAL() in Apex. Secure dynamic code evaluation on the Salesforce1 platform.

Both methods have their pros and cons. In your case you may find throwing an intentional exception and parsing the response to be an easier approach.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .