Skip to content

Commit 8b131eb

Browse files
committed
Add scripts
1 parent cdae809 commit 8b131eb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let family=prompt('What family of products would you like to add?');
2+
if(!family)
3+
return;
4+
try{
5+
let items = || select Id,UnitPrice from PricebookEntry where Pricebook2.Name='Standard Price Book' and IsActive=true and Product2.Family='${family}' ||;
6+
if(!items || items.length===0){
7+
alert('No Products found');
8+
}
9+
let oli = items.map(item => ({PriceBookEntryId: item.Id, OpportunityId: recordId, Quantity: 1, ListPrice: item.UnitPrice, TotalPrice: item.UnitPrice}));
10+
|| insert OpportunityLineItem(oli) ||;
11+
$A.get('e.force:refreshView').fire();
12+
}catch(e){
13+
alert(JSON.stringify(e));
14+
}

0 commit comments

Comments
 (0)