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
S Babu.ax1883S Babu.ax1883 

Trigger

Hi
I have a Custom Object, Content Object and ContentDocumet object. Custom Object is patent and content objects are child. 
My requirement is, In the custom object if the flag is True then conectDocument need to Transfer to Custom object. If the flag is flase then the contentDocument should be InActive.
Each custom Object have associate content Document record.
Please tell me how can we write a trigger? We have to write the trigger on custom object.
Vinit_KumarVinit_Kumar
You need a before update Trigger on Content Object and check whether the flag is true or false and perform your action.

Hope this helps !!
Aniket Supe 6Aniket Supe 6
Hi
Specifications
Write a trigger on Candidate object to do the following -
Name: OnCandidateHireDeactivateJob_Yourname
Job has a field called Active (checkbox), If job is active and Candidate for that Job is being hired, trigger should calculate total number of Candidates hired so far including the current one and check if it exceeds or equals to number of open position on the Job. If it exceeds or equals, the Job's Active fields should be set to false (unchecked) so the Job is taken out from Active Job lists hence Candidates can not apply for it anymore
Job manager should be allowed to hire n number of Candidates. Where n= Number of Open Positions. Throw error when Job Manager Hire Candidates beyond Number of Open Positions limit stating "Sorry, No vacancies available for this Job"

Once Job is deactivated, new Candidates should not be allowed to apply for particular deactivated job. Provide error for such Candidates who are applying for Deactivated Job stating "Sorry, Job does not exist"
If more than one Candidate is being hired for the Job at a time, throw an error for such 
Candidates stating "At a time only one Candidate can be hired for a Job"
not be work in apex trigger
my create trigger
trigger OnCandidate_Aniket on Candidates_Aniket__c (before insert) {
    
    List<Job_Aniket__c> JobsList= [SELECT Hired_Applicants__c,Number_of_Positions__c from Job_Aniket__c];
     for (Candidates_Aniket__c jobAniket : Trigger.new) {
         for (Job_Aniket__c job : JobsList) {
            if(Job.Hired_Applicants__c >= Job.Number_of_Positions__c){
                job.Active__c = false;
                Job.adderror('Sorry, No vacancies available for this Job');
                
                  
             }
         }
    }
    

so plz help me fast