You need to sign in to do that
Don't have an account?
Cindy C 10
Help with trigger to prevent delete related list record based on checkbox on opportunity object
I am very new to writing triggers and would appreciate any and all help. I have searched the forums to no avail, I am unable to find any information related to this particular scenario. I do not want to go the roll up summary field route.
I have a custom object (related list) on which I would like to prevent the deletion of a record if checkbox=true on the related Opportunity record.
I have a custom object (related list) on which I would like to prevent the deletion of a record if checkbox=true on the related Opportunity record.
Please check the samplee code below :
Here account is a parent in the account I have created DeleteOpp__c checkbox field if it is true we cant delete its related opportunity.
Hope this helps.
Please let me know in case of any other assistance.
If the above information is informative please mark it as a best answer.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
All Answers
Please check the samplee code below :
Here account is a parent in the account I have created DeleteOpp__c checkbox field if it is true we cant delete its related opportunity.
Hope this helps.
Please let me know in case of any other assistance.
If the above information is informative please mark it as a best answer.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
I have tried your code but am getting errors (Error: Compile Error: Variable does not exist: oppid at line 5 column 15).
To clarify, Opportunity is the parent and my custom object (Origination Fee Allocation is the child).
In the place fs.oppid here you need to use fs.Your opportunity lookup field API name.
In your object Origination_Fee_Allocation__c check opportunity API name add the same thing to your code.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
In fields check opportunity API name (Ex : opportunity__C)
Same API Name you need to use in code.
if(fs.oppid != null){
Origination_Fee_Allocation__cIds.add(fs.oppid);
}
In place of oppid you need to use opportunity API name (;Ex : opportunity__C)
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com