You need to sign in to do that
Don't have an account?
D srinivas 8734
i have to store pricebook name in custom setting from their i have to query the pricebook & create pricebookentry for that?
i am importing products from other system into salesforce ,
i have to store pricebook name in custom setting from their i have to query the pricebook & create pricebookentry for each and every imported products ,
can anyone assist me ?
i have to store pricebook name in custom setting from their i have to query the pricebook & create pricebookentry for each and every imported products ,
can anyone assist me ?
First create a pricebook and then Instead of pricebook name store pricebookId in the custom setting.
Step 1
String pricebookId = get id from custom setting.
ImportedProductList = import and insert all the products (Product2) from other system.
Step 2
List<PricebookEntry> pricebookEntryList = new List<PricebookEntry>();
PricebookEntry pricebookEntryRecord;
for (ImportedProduct p : ImportedProductList) {
pricebookEntryRecord = new PricebookEntry();
pricebookEntryRecord.Product2Id = p.Id;
pricebookEntryRecord.Pricebook2Id = pricebookId;
pricebookEntryList.add(pricebookEntryRecord);
//set other fields as per requirement.
}
if (pricebookEntryList.size() > 0) {
insert pricebookEntryList;
}
Hope this help you !!
Thanks,
M K Lal