Skip to content

Commit

Permalink
fix struct to map conversion for composite api
Browse files Browse the repository at this point in the history
  • Loading branch information
k-capehart committed Mar 29, 2024
1 parent 005f989 commit 4631acb
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions salesforce/salesforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,7 @@ func (sf *Salesforce) InsertComposite(sObjectName string, records any, allOrNone
return
}

var recordMap []map[string]any
if _, ok := records.(map[string]any); ok {
recordMap = records.([]map[string]any)
} else {
recordMap = convertToSliceOfMaps(records)
}
recordMap := convertToSliceOfMaps(records)

if len(recordMap) > 200 {
fmt.Println("Composite API call supports lists up to 200 in length")
Expand Down Expand Up @@ -253,12 +248,7 @@ func (sf *Salesforce) UpdateComposite(sObjectName string, records any, allOrNone
return
}

var recordMap []map[string]any
if _, ok := records.(map[string]any); ok {
recordMap = records.([]map[string]any)
} else {
recordMap = convertToSliceOfMaps(records)
}
recordMap := convertToSliceOfMaps(records)

if len(recordMap) > 200 {
fmt.Println("Composite API call supports lists up to 200 in length")
Expand Down

0 comments on commit 4631acb

Please sign in to comment.