function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdc550sfdc550 

Can i update standard amount in opportunity from custom object

Whenever i create an opportunity record and add a "product" to that opportunity, "amount" field will be updated with productpricebook amount. amount is a readonly field in opportunity.

I want to do same using custom object and opportunity.

I am having a custom object "test" and another object opportunity.

In "Test" object i am having fields "Product(lookup)" and "Opportunity(lookup)".

In "test" object is child of product. whenever i select a lookup in test object and saves a record, product price must update in opportunity amount(which is readonly field).

Can i update readonly amount field with custom object product amount???

I tried to change it from developer console but since it is readonly field we can't edit directly. Please some one suggest a solution for it
sharathchandra thukkanisharathchandra thukkani
You can do that by writing a trigger on test object saying that after insert of evey "test" object insert the same record in the opportunity line item with quantity and sales price values, since amount depends on opportunity line item quantity and sales price values.