From 4631acb9d41ae0e2c3228792e40b77e9863ed7c0 Mon Sep 17 00:00:00 2001 From: "Kyle Capehart (Huntersville)" Date: Fri, 29 Mar 2024 16:48:37 -0400 Subject: [PATCH] fix struct to map conversion for composite api --- salesforce/salesforce.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/salesforce/salesforce.go b/salesforce/salesforce.go index 08474c7..c3872ef 100644 --- a/salesforce/salesforce.go +++ b/salesforce/salesforce.go @@ -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") @@ -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")