You need to sign in to do that
Don't have an account?
sfdc550
fetch values from lookup and update in another object
I am new to salesforce please help me out. I am having 2 objects both are custom objects let us consider x and y. x is parent and y is child i.e.. from y i am having lookup to x. Now i need to select a product in 'y' and select 'x' using lookup and saves a record.
I am having two fields in x object amount, quantity,..
Now I need to get all pricebooks(price and quantity...) related to that product and update amount in 'x' object. Similarly if i add multiple products then i need to sum of all and update it in x object. How can i achieve this .
Please refer me with some sample code or guide me how to write soql query to get product pricebook from products and update it in other object. I am planning to change relationships if needed please some one help me in detail.
Thanks in advance.
I am having two fields in x object amount, quantity,..
Now I need to get all pricebooks(price and quantity...) related to that product and update amount in 'x' object. Similarly if i add multiple products then i need to sum of all and update it in x object. How can i achieve this .
Please refer me with some sample code or guide me how to write soql query to get product pricebook from products and update it in other object. I am planning to change relationships if needed please some one help me in detail.
Thanks in advance.
Not sure if I got it right but I would suggest you to change your objects to a Master/Detail relationship. By doing so, you can use Roll -Up Summary Fields which allow you to achieve what you are looking for.
Find out more here:
https://help.salesforce.com/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm&siteLang=en_us (https://help.salesforce.com/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm&siteLang=en_us" target="_blank)
https://www.youtube.com/watch?v=ny_iTAgeXqE (https://www.youtube.com/watch?v=ny_iTAgeXqE" target="_blank)
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.