Git Product home page Git Product logo

Comments (7)

perbrondum avatar perbrondum commented on June 17, 2024

line 5: Should read "fails when using USER struct, works when using SALESFORCERECORD"

from swiftlysalesforce.

mike4aday avatar mike4aday commented on June 17, 2024

@perbrondum I believe the issue is that the Id field is not in the list of queried fields in your SOQL query; only CompanyName is queried. Does it work if you add Id to the queried field list?

from swiftlysalesforce.

perbrondum avatar perbrondum commented on June 17, 2024

Sorry, just saw this. While id is not needed in the select list, I will check tomorrow if the bug still exists with it in.

from swiftlysalesforce.

perbrondum avatar perbrondum commented on June 17, 2024

Indeed, adding id to the select list solves the problem.

from swiftlysalesforce.

perbrondum avatar perbrondum commented on June 17, 2024

Looked at this again, the id field does not have to be in the select list for this to work, but the Id field in the USER struct does have to be optional.
public var Id: String?
In my case I had the Id field as non-optional and that reproduces the error.

from swiftlysalesforce.

mike4aday avatar mike4aday commented on June 17, 2024

Hi @perbrondum - I assume User is a custom model struct you defined? If so, then any property defined as optional will work since the automatic decoding provided by Swiftly Salesforce via Swift's Decodable protocol will not throw an error if the server response is missing a value for that property. If the property is required, however, then it must be present in the JSON response, and the relevant field has to be in the SOQL select list.

from swiftlysalesforce.

perbrondum avatar perbrondum commented on June 17, 2024

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.