• Shubham Joge 9
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 6
    Replies
trigger ContentDocumentLinkTrigger on ContentDocumentLink (after insert) {
 String tempParentId;
    Set<Id> setParentId = new Set<Id>();
    List<Lead> Leadlst = new List<Lead>();
    
 for (ContentDocumentLink cdl : trigger.new ) {
            tempParentId = cdl.LinkedEntityId;
     
            if (tempParentId.left(3) =='a0X') {
                System.debug('Debug : found a0X');
                System.debug('Debug : content document id ' + cdl.ContentDocumentId );
                setParentId.add(cdl.LinkedEntityId);
            }
        }
    Leadlst = [select Id , HasAttachment__c from Lead where Id IN :setParentId];
     
     For(Lead L : Leadlst)
     {
        L.HasAttachment__c = True;
     }

     update Leadlst;
}
 
Hello Guys,

I need your help in trigger ,
Trigger on order object where only two future order is aloowed in draft order for one account .
Hi Guys ,
Over ther trigger object i want to write trigger on before insert to check that 1 account have only two future order in the oder draft status.no more that 2 future order should allowed .
Hello Guys ,

Can anyone help me with the vlidation rule on case object .
my condition is :
if the Status =Pending and after it get update to another staus but user cannot update it back to status = pending .
 tecnicall once we updated status from pending it cannot updted back to pending .
Hello Guys i need one help . i am having one component with case fields ,that component called from account over a button click name as traning request ..so i want to add a method in component helper that if traning has completed before 365 then they can create a request else throw an error .So on Account of user there is button from wich we are creating a case.
once the orderd products are added on order ,no one should be allowed to change the price book on order
Hello People.
I want to write one trigger can anyone help me with that.

I am Having 2 custome Object 

1.Interaction .
filed:Inateraction name

2. Movie 
Fileds :1. Name 
            2. Release Date .

Movies object is having interaction lookup.
I want the Movies list (movie record for that interaction record) which displayed on the Interaction object .
Filter should be applied on a release date it should show only latest and updated movie record over the interaction object.
Like i am having movie list for years 2001, 2002, 2003,
It should display only the 2003 record and if i add any other movie to list with further dates 2004 then it must update .&if i add movie with date 1994 still it shows the latest movie  record of 2004 record as per date.
roll-up summary to calculate total amount of child on case parent object 
i am having one standard case object on which case are created .Case object is have one lookup filed ie [parent case]
now i have to write one trigger on case object  parent case should have the cout of no of child object .
can anyone please help me with this trigger?
 
trigger ContentDocumentLinkTrigger on ContentDocumentLink (after insert) {
 String tempParentId;
    Set<Id> setParentId = new Set<Id>();
    List<Lead> Leadlst = new List<Lead>();
    
 for (ContentDocumentLink cdl : trigger.new ) {
            tempParentId = cdl.LinkedEntityId;
     
            if (tempParentId.left(3) =='a0X') {
                System.debug('Debug : found a0X');
                System.debug('Debug : content document id ' + cdl.ContentDocumentId );
                setParentId.add(cdl.LinkedEntityId);
            }
        }
    Leadlst = [select Id , HasAttachment__c from Lead where Id IN :setParentId];
     
     For(Lead L : Leadlst)
     {
        L.HasAttachment__c = True;
     }

     update Leadlst;
}
 
Hello Guys,

I need your help in trigger ,
Trigger on order object where only two future order is aloowed in draft order for one account .
Hello People.
I want to write one trigger can anyone help me with that.

I am Having 2 custome Object 

1.Interaction .
filed:Inateraction name

2. Movie 
Fileds :1. Name 
            2. Release Date .

Movies object is having interaction lookup.
I want the Movies list (movie record for that interaction record) which displayed on the Interaction object .
Filter should be applied on a release date it should show only latest and updated movie record over the interaction object.
Like i am having movie list for years 2001, 2002, 2003,
It should display only the 2003 record and if i add any other movie to list with further dates 2004 then it must update .&if i add movie with date 1994 still it shows the latest movie  record of 2004 record as per date.
I have two Custome Object 1. Students with having field of 
1.StudentName
2.joining
3.Duration
4.TotalAmount
and another object is 2. My Courses with having field of
1.CourseName
2.FeeAmount
3.TeacherName
student object will be perent and other will child how we can calculate sum of FeeAmount to the total amount using triggerd rollup summery..
Please help me for Writing Test Class on Trigger
trigger ParentToCaseClosure on Case (after update,before update) {
  
    
   
    if(trigger.isAfter && trigger.isUpdate) {
     
      

        List<Case> childrenToUpdate = new List<Case>();
        Set<Id> parentIds = new Set<Id>();
        for(Case p:trigger.new) {
        system.debug('******CASE ID ::::'+ p.id);
            case old=trigger.oldMap.get(p.id);
            if(p.IsClosed == TRUE ) {
                    
            
            
                
                parentIds.add(p.Id);
              
                 
               
        }
       
        System.debug('------------- Parent Ids -------- ' + parentIds);
        if(parentIds.size() > 0) {
            for(Case ch : [SELECT Id, Status, Parent.Status FROM Case WHERE Parent.Id IN :parentIds]) {
                 if(ch.Status=='Closed Successful')
                 { system.debug('--no update');}
                ch.Status = ch.Parent.Status;
                childrenToUpdate.add(ch);
            }
           
            System.debug('---------------- Child Case(s) Received : ' + childrenToUpdate.size());           
            try{
                System.debug('---------Going to update the children');
                update childrenToUpdate;
                System.debug('---------Children updated successfully');
            }
            catch(Exception e) {
                System.debug('--------------Exception in updating all the Parents');
            }
        }
        } 
}
    }
Please Write Test Class for Trigger.