File tree Expand file tree Collapse file tree
providers/salesforce/internal/crm/batch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,30 +263,52 @@ func (r ResponseCreate) GetItemsMap() map[string]*CreateItem {
263263}
264264
265265func (i CreateItem ) ToWriteResult () (* common.WriteResult , error ) {
266- data , err := common .RecordDataToMap (i )
267- if err != nil {
268- return nil , err
266+ success := len (i .Errors ) == 0
267+
268+ if success {
269+ data , err := common .RecordDataToMap (i )
270+ if err != nil {
271+ return nil , err
272+ }
273+
274+ return & common.WriteResult {
275+ Success : true ,
276+ RecordId : i .ID ,
277+ Errors : nil ,
278+ Data : data ,
279+ }, nil
269280 }
270281
271282 return & common.WriteResult {
272- Success : len ( i . Errors ) == 0 ,
283+ Success : false ,
273284 RecordId : i .ID ,
274285 Errors : datautils .ToAnySlice (i .Errors ),
275- Data : data ,
286+ Data : nil ,
276287 }, nil
277288}
278289
279290func (i UpdateItem ) ToWriteResult () (* common.WriteResult , error ) {
280- data , err := common .RecordDataToMap (i )
281- if err != nil {
282- return nil , err
291+ success := len (i .Errors ) == 0
292+
293+ if success {
294+ data , err := common .RecordDataToMap (i )
295+ if err != nil {
296+ return nil , err
297+ }
298+
299+ return & common.WriteResult {
300+ Success : true ,
301+ RecordId : i .ID ,
302+ Errors : nil ,
303+ Data : data ,
304+ }, nil
283305 }
284306
285307 return & common.WriteResult {
286- Success : len ( i . Errors ) == 0 ,
308+ Success : false ,
287309 RecordId : i .ID ,
288310 Errors : datautils .ToAnySlice (i .Errors ),
289- Data : data ,
311+ Data : nil ,
290312 }, nil
291313}
292314
You can’t perform that action at this time.
0 commit comments