You need to sign in to do that
Don't have an account?
Rakesh M 20
Hi All ,can anyone help me to add values to map of sObject and update the same
Example : this is my map with list of sObject
Map<Id,List<Product_Stock__c>> updateProductStock = new Map<Id,List<Product_Stock__c>>();
Fields required to add a map :
id and available_qty
Map<Id,List<Product_Stock__c>> updateProductStock = new Map<Id,List<Product_Stock__c>>();
Fields required to add a map :
id and available_qty
your map consist id and list,
so to fill the map you have to iterate over the Product_Stock__c list: In your Map key will be the id of Product_Stock__c and value would be List of Product_Stock__c that contains all the fields that you have in productStockList.
For more reference, you can go: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_map.htm
If you find this helpful, kindly mark this as the best answer to help others.
All Answers
your map consist id and list,
so to fill the map you have to iterate over the Product_Stock__c list: In your Map key will be the id of Product_Stock__c and value would be List of Product_Stock__c that contains all the fields that you have in productStockList.
For more reference, you can go: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_map.htm
If you find this helpful, kindly mark this as the best answer to help others.