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
kishore64kishore64 

How we can get the current page ID in Trigger

Hi everybody,

      Actually i have checkbox field in my child record Here my requirement is the recent record should be active. For Example:I have 2 records in parent object under that one record have 3 childs and  the 3 child record should be active for that i wrote a trigger that is working fine but my problem is it is taking the overall child records which is recent record then that is activating the checkbox but i need 0ne parent record under 3 childs are there i want 3 rd record should be activate at the same time the second parent record have 3 childs here also the 3rd record should be activte. Totally i need 2 activate child records for that object.


Here i am implemented the trigger i know i am not writing any query on parent object but how to write i don't know that's reason i am posting here


trigger  ActivateSpecificationSheet on Specification_Sheet__c(before insert) {
    if(trigger.isInsert){
    for(Specification_Sheet__c ssh : Trigger.New){
   
        ssh.Is_Active__c = true;
     }
   
     List<Specification_Sheet__c > updssh = New List<Specification_Sheet__c >();
  
   
     List<Specification_Sheet__c > sshlst = [select id,name,Is_Active__c,Sales_Order_LineItem__c from Specification_Sheet__c where Is_Active__c = true ];

        for(Specification_Sheet__c ssh1: sshlst){
      
        ssh1.Is_Active__c=false;
        updssh.add(ssh1);
        }
        update updssh;
      
}

}

Can any one suggest me please help me out......
Ramu_SFDCRamu_SFDC
The following post might help

http://salesforce.stackexchange.com/questions/17194/get-id-of-object-in-trigger