You need to sign in to do that
Don't have an account?
ApexDev
Apex Trigger to make checkbox true on standard object when field on second standard object is filled
Hi everyone! :)
I have 2 standard object on Salesforce: Case and Asset. On Case object I created 2 custom checkbox fields:
- In_House_Service__c
- Field_Service__c
Depends of Preferred_Service_Location__c on Asset, the right checkbox should be true on Case:
- if In-house service on Asset - the In_House_Service__c should be true on Case
- if Field Service on Asset - the Field Service__c should be true on Case
I am super newbie in Apex, I don't know how to write the right code. Maybe do you have any examples, that I can build or base on it?
I will be grateful! Thank you!
I have 2 standard object on Salesforce: Case and Asset. On Case object I created 2 custom checkbox fields:
- In_House_Service__c
- Field_Service__c
Depends of Preferred_Service_Location__c on Asset, the right checkbox should be true on Case:
- if In-house service on Asset - the In_House_Service__c should be true on Case
- if Field Service on Asset - the Field Service__c should be true on Case
I am super newbie in Apex, I don't know how to write the right code. Maybe do you have any examples, that I can build or base on it?
I will be grateful! Thank you!
What is relationship between asset & case ? which one is parent and which one is child.?
Thanks!!
The problem is because to each Case we can add multiple records of Devices (Asset). And also one Device (Asset) can be added to multiple Case records. So in this situation I think device is the Child..
try with below code.
Replace the API names as per your org.
If this helps, Please mark it as best answer.
Thanks!!