-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parent Child on Lookup Field Does not seem to return data #78
Comments
@gaberger Thank you for opening an issue! I'll take a look at this when I can, but in the meantime, does this query work if you use the REST explorer in workbench? Or by using Postman? The endpoint should be something like Also, double check that the user executing the auth flow has permissions for that field. |
@k-capehart thanks for the quick response.
I get back a list of records like
|
@gaberger Thanks for checking. This is how I wrote my code to access a field on a custom Lookup relationship. The key is to append "__r" in your golang struct field for a custom relationship. There might be opportunity to improve this (maybe with the go-soql package?). type Contact struct {
Id string
LastName string
}
type Account struct {
Id string
Primary_Contact__r Contact
}
type Opportunity struct {
Id string
Account Account
}
opps := []Opportunity{}
err = sf.Query("SELECT Id, Account.Primary_Contact__r.LastName FROM Opportunity WHERE Account.Primary_Contact__c != null", &opps)
if err != nil {
panic(err)
}
fmt.Println(opps) Result in my test org: ➜ go-testing go run main
[{006Dn00000EkTNFIA3 { { Stark}}}] Let me know if that works, and if it doesn't, then please share some code snippets so I can further debug. |
@gaberger Were you able to resolve this? |
Not sure if this is a limitation of the library but if I try and use
This reference
Account.Technical_Solution_Engineer__r.FirstName,
which is a lookup to the User table.Returns nothing in the library response but execute in salesforce workbench
The text was updated successfully, but these errors were encountered: