Git Product home page Git Product logo

Comments (7)

mike4aday avatar mike4aday commented on June 26, 2024

Hi @perbrondum - yes, you could execute anonymous Apex by creating your own struct that conforms to Swiftly Salesforce's Service protocol (example here) and calls the Salesforce Tooling API as described here.

You could also create a custom Apex web service that both queries and deletes records, and then call that web service via Swiftly Salesforce's apex method.

Another alternative: create a custom Service that calls the Salesforce Composite API to delete multiple record IDs as shown here.

from swiftlysalesforce.

perbrondum avatar perbrondum commented on June 26, 2024

from swiftlysalesforce.

mike4aday avatar mike4aday commented on June 26, 2024

@perbrondum if you use Swiftly Salesforce's apex method then you won't need the session ID. You just need to provide the method arguments (or accept the defaults if applicable).

If you do need to retrieve the access token, you could get it via ConnectedApp's getCredential method.

from swiftlysalesforce.

perbrondum avatar perbrondum commented on June 26, 2024

from swiftlysalesforce.

perbrondum avatar perbrondum commented on June 26, 2024

from swiftlysalesforce.

mike4aday avatar mike4aday commented on June 26, 2024

Hi @perbrondum It's difficult for me to follow the unformatted code, but let me offer this:

  • For the path argument that you pass to the apex method: you don't need the instance name, but only the string value you defined in the corresponding Apex class' urlMapping attribute of the @RestResource annotation. (Swiftly Salesforce knows the instance name upon user authentication and services/apexrest/ is already assumed.)
  • There's no need to call identity before calling the apex publisher.
  • The return type is JSON with whatever you defined as the return value in the corresponding, server-side Apex method. Define a custom, Swift struct that mirrors the Apex output and then Swiftly Salesforce will automatically deserialize the JSON into that struct.

from swiftlysalesforce.

mike4aday avatar mike4aday commented on June 26, 2024

@perbrondum here's an example of calling an Apex method exposed as a REST endpoint. The @RestResource annotation is RandomAccount which returns a Salesforce Account record.

from swiftlysalesforce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.