I have the below functionality inside a for loop, the highlighted field is a master field in the child object that is populated in this piece. For the first iteration it populated the value but the second iteration on the same line it throws the Field is not writeable: Forecast_Line_Item__r.Order__c. Any help is much appreciated.TIA
It seems you are trying to do reparenting (change the parent when it is already associated with another parent record )in the master detail relationship, which is not allowed by default. Refer the link- https://help.salesforce.com/articleView?id=relationships_considerations.htm&type=5 , you can set Allow reparenting option in the master-detail relationship definition.