You need to sign in to do that
Don't have an account?
Abhishek Singh 88
how to update parent record using child object
Hi All, I have queried parent object through child . and want to update parent object with some values. Here is query.
List<BMC_Servicedesk_BaseElement> belist=new List<BMC_Servicedesk_BaseElement>(); belist=[select name, Fisma_Low,Fisma_High from BMC_Servicedesk_BaseElement ]; List<BMC_Servicedesk_BaseRelationShip> bsrelation=new List<BMC_Servicedesk_BaseRelationShip> (); List<BMC_Servicedesk_BaseRelationShip> bsrelation1=new List<BMC_Servicedesk_BaseRelationShip> (); bsrelation=[select name, Destination__r.Hitrust,Destination__r.Fisma_Low,Destination__r.Fisma_High from BMC_Servicedesk_BaseRelationShip]; for(BMC_Servicedesk_BaseElement be: belist) { for(BMC_Servicedesk_BaseRelationShip berel:bsrelation) { if(be.Fisma_Low==true) berel.Destination__r.Fisma_Low=be.Fisma_Low; bsrelation1.add(berel); } } update bsrelation1; //Note Base Relationship has two lookup filed with same object Base Element As destination__c and Source__c
Abhishek Singh 88
here at line no.11 , I am updating parent object filed. But its not reflecting on parent object record.Any suggestion would be appriciated.