In sf_user and sf_node, calls are made to salesforce_api_retrieve. However both sf_user and sf_node assume that the result will be a single object, when salesforce_api_retrieve can return an array of objects (even if it is an array of one object...). Patch coming.

Comments

kostajh’s picture

Here's a patch for sf_node and sf_user. I'm sure this needs to be fixed elsewhere, as it's not just salesforce_api_retrieve, but upsert that is also returning arrays of single objects. I've only just encountered this in switching to a new "full" sandbox (I was using a configuration only sandbox before). Has anyone else run into this problem?

dpearcefl’s picture

Title: salesforce_api_retrieve returns single object or an array of objects, but sf_user/sf_node assume only a single object » salesforce_api_retrieve and upsert return single object or an array of objects, but sf_user/sf_node assume only a single object
Status: Active » Needs work

Umm, what patch? ;-)

kostajh’s picture

Status: Needs work » Needs review
StatusFileSize
new2.88 KB

Oops! long day.

kostajh’s picture

StatusFileSize
new3.37 KB

Updated patch checks to see if the array has at least 1 element.

As an alternative, we could re-write function salesforce_api_retrieve($ids, $name) to have a third argument, $multiple = TRUE, and return an array of objects depending on whether that argument is set. We could do the same with upsert and and other salesforce_api functions.

kostajh’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.