Skip to main content
Hi,

I have a map which consists of an sObject and a custom class, i'm mapping objects that i need to process to a class.

map<service_call__c, JobResponse> scTaskList = new map<service_call__c, JobResponse>();

My issue is I perform an upsert on the Service call object before I send this scTaskList map into another method for some further processing. After I perform that upsert the Service_call__c object that is in the map will get an ID assigned to it (if it wasn't an exisiting record) but it then looses it's mapped Job response. 

Is there anything I can do to prevent this? 
2 个回答
  1. 2017年10月3日 13:53
    Hi RD,

    I reveresed the order in the Map from map<service_call__c, JobResponse> to map<JobResponse, service_call__c>. The issue it seems was to do with service_call__c changing after the Upsert (by it getting assigned an ID) that it now was a different Key in the map and therefore loosing it's value. 
0/9000