We have an app that pulls data from our rails server and loads it into SalesForce via batch jobs. The object that we load data into MyObj
has 2 lookup fields for relating it to Contacts and Leads. The problem is that rails knows nothing about Contacts or Leads therefore it cannot set these lookup fields. The only relationship between MyObj
and a Contact/Lead is an email address.
The problem that arises is that we end up having to query all Contacts and Leads, grab the ID and then set the lookup field in MyObj
. When we ran checkmarx on this, it complained about "Queries with no Where clause or no LIMIT clause"
.
So the question is, how can we relate objects, without knowing the IDs of SalesForce objects and do this without exceeding the governor limits?
PS. External IDs are not an option since we do not have a relationship to Contacts/Leads in the first place.