You need to sign in to do that
Don't have an account?
Atomic_Force
Help with Trigger on Product2 - Urgent help please!!
Need to update a custom boolean field on Product2 if PricebookEntry UnitPrice > 0. Here is the simple trigger that I started to update the value of Product2 In_Pricelist__c field. How do I get this portion of the trigger to work and then iterate over PricebookEnties to see if Product2Id is in list and UnitPrice > 0?
trigger trueInPricelist on Product2 (before update) { List<Product2> prods2update = new list<Product2>(); for(Product2 prods : trigger.new){ if(prods.In_Pricelist__c == Null){ prods2update.add(prods); } if(prods2update.size() > 0){ for (Product2 p : prods2update){ p.In_Pricelist__c = True; } } update prods2update; } }
This worked for me:
Give it a shot and let me know if it works for you.
Regards, jh
All Answers
This worked for me:
Give it a shot and let me know if it works for you.
Regards, jh
Awesome! Thank you so much. Really appreciate the help. Works almost perfect. Adding some conditional statements to the trigger.new loop.