You need to sign in to do that
Don't have an account?

Can I use two custom objects in an apex Trigger?
I have never made a trigger before and I am not sure where to start for this task. I have two custom objects. object A and object B. When the picklist value of a field in custom object B is selected it needs to change the checkbox field in object A to true. Does anyone know how to do this? I have tried to do this through a workflow and process builder but it cannot be done.
Can you provide the name of the objects + Relationships + Field names etc..
Thank You!
1) Is field named Sample_Request_Status__c is on Object B ? And field named Shipped__c is on Object A
2) Who is master and who is detail? Or if its lookup relationship then which one is parent and which one is child?
3) What are the picklist values on Sample_Request_Status__c field and on which value should the checbox be updated as TRUE?
Thanks!
As shown below....
you can make same as after Insert of before insert any of this........
Thank you for this but the pick list is on object A and the checkbox is one object B. When I tried substitiuitng them in for one another it did not work. Does it need to be rewritten?
1) The Sample_Request_Status is on Object A( Sample_Request) and the Shipped__c is on Object B (Solesence_Sample).
2) The Master is Sample_Request and the detail is Solesence_Sample
3) The picklist value that triggers the change is 'shipped' and the checkbox value needs to be updated as TRUE
Hope this helps!
please, check the spelling of Flags.....It written wrong......
In objBMethod
triggerHelper.objAflag = false;
I entered the code and subsituted for my values but I am receving the following 'error unexpected token: trigger' on line 7
In developer console...
click on new---> Apex Trigger----> then in Trigger name-- ' mytrigger' and object name-- 'Sol_sence_Sample__c'
and paste the code...
And again...
click on new---> Apex Trigger----> then in Trigger name-- ' myanothertrigger' and object name-- 'Sample_Request__c'
and paste the code...
And again new---> Apex Class----> class name ---'triggerHelper'
and paste the code...
These are common error you should check these errors carefully..
You can use this code, it may be good for you...
If it will help then mark it as best answer. :)
Have a nice day!!
Thanks!!