You need to sign in to do that
Don't have an account?
Arav Sundar
deleting parent should delete the child with self lookup relationship getting an error pls suggest
Hi All ,
i am new to the Coding and i really want to learn the coding and intrested too and i am finding very difficult to build the logic and to write can anyone please suggest ..
i am trying to build the code for the requirement " i am havng an self lookup relationship with opportunity and when i delete the parent child should also get deleted " Below is the code can anyone pls suggest and the error i am getting is " Error: Compile Error: sObject type 'childofopp' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 7 column 37 " Not sure what is the mistake i have done
Standard object = Opportunity
Custom object = Child_of_Oppty__c (having an self lookup realtionship)
trigger DeletionofParentchildgetsdeleted on Opportunity (before delete) {
List<id> OpptyID = new list<id>();
for( Opportunity Oppty : trigger.old){
opptyid.add(oppty.id);
}
list<Child_of_Oppty__c> childofopp =[select id from childofopp where opportunityid in : opptyid];
delete childofopp;
}
i am new to the Coding and i really want to learn the coding and intrested too and i am finding very difficult to build the logic and to write can anyone please suggest ..
i am trying to build the code for the requirement " i am havng an self lookup relationship with opportunity and when i delete the parent child should also get deleted " Below is the code can anyone pls suggest and the error i am getting is " Error: Compile Error: sObject type 'childofopp' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 7 column 37 " Not sure what is the mistake i have done
Standard object = Opportunity
Custom object = Child_of_Oppty__c (having an self lookup realtionship)
trigger DeletionofParentchildgetsdeleted on Opportunity (before delete) {
List<id> OpptyID = new list<id>();
for( Opportunity Oppty : trigger.old){
opptyid.add(oppty.id);
}
list<Child_of_Oppty__c> childofopp =[select id from childofopp where opportunityid in : opptyid];
delete childofopp;
}
Arav,
Could you please let me know - :
Child_of_Oppty__c is lookupField on opportunity ?
I will help you to assist you in coding part, Don't be worry :)
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
In your code you are trying to delete the sobject "childofopp " but you are getting error in at line 7 column 37 " because you are not using the API Name in your code so I suggest you to try this code .
Try this code: I hope it will help you.
Regards,
Akshay
Please mark my answer as a solution.
Arav,
I am assuming Opportunity have self lookup as you have said, so "Child_of_Oppty__c" is field API name associated with opportunity.
Please let me correct, If I am wrong -
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
could you please let me know whats is the error?
I think can you change your triiger to after delete ....i think it may work