function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Need Apex Trigger for picklist from one object to checkbox on another object


I just have a brief overview of Apex, but I'm wondering if someone can help me here.

I have two custom objects:
Parent Object: Requests
Related Child Object: Requestor

On the parent object, I have a picklist field: Request Status (None, In Progress, Complete)
On the child object, I have a checkbox: Request Complete

I need a workflow to trigger when Request Complete = True. However, I don't want to manually edit the checkbox. I need an Apex trigger that will edit the child object when the parent object is edited, and I need that to trigger my workflow on the child object. I need an Apex Trigger that will do the following:

When Request Status = Complete
Then Resource Complete = True

Is this possible? If so, could someone help show what such a code would look like?
you could make the request complete field a boolean formula field.
the formula field would be something like:
if(ISPICKVAL(request status, complete),true,false)

when doing the formula field, you will see an advanced tab, use that and the insert field to get the correct related field.

than, you could do the workflow based on that value

praveen murugesanpraveen murugesan
Hello Umair,

If I understood your question correctly.

You should write the trigger on parent object that should have query to select all the child records. Select query should execute only when Request Status = 'Complete'.  

If your query is not null you can update like this Resource Complete = True.


trigger test on object__c (before update) {
   set<id> idval = new set<id>();
    for(object__c ben : Trigger.New){
           if(ben.Request Status = 'Complete'){
                  idval.add(;                                 //adding id value to query child records
       list<childobj> tet = [select id,Resource Complete from childobj where parentobj IN:idval and Resource Complete!=:true ];
for(childobj t : tet)
  t.Resource Complete =true;
  update tet;   //updating child values.

I hope this will helpful.


Praveen Murugesan

Hi Praveen,

Thank you for your reply. Is your example what the final code would look like? I'm VERY new to learning code, so what would a final code look like for the following:

parent object is REQUEST__C
child object is REQUESTOR__C
This is the logic I have so far, so could really use help in seeing how this looks like in the actual coding:

If Request_Status__c = Resource Complete on RRT_Request__c,

Then Update

Add_Requestor_to_Evaluation__c To TRUE on RRT_Requestor__c
Additionaly, I need this trigger to update ALL child records.
praveen murugesanpraveen murugesan
Yes Umair, Final code will look like that only.


Praveen Murugesan