You need to sign in to do that
Don't have an account?
Jim Montgomery
sqol query in apex trigger
I have a trigger that inserts new line items into a custom object. One of the items I need to insert is the productID of a specific product.
How can I use [select id from product2 where productcode = 12345'] in an apex trigger?
How can I use [select id from product2 where productcode = 12345'] in an apex trigger?
product2 pro = [select id from product2 where productcode = 12345' limit 1];
assign your product id like below to another record :
object.product2id = pro.id;
Hope it helps you.
Thanks
Varaprasad
All Answers
list<product2 > lstOfProd = [select id from product2 where productcode = 12345'];
Hopes it helps you
thanks
product2 pro = [select id from product2 where productcode = 12345' limit 1];
assign your product id like below to another record :
object.product2id = pro.id;
Hope it helps you.
Thanks
Varaprasad