• Sunil_sfcd803
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
I need help.I'm trying query records from three objects which are releted and use on particular field in if().See below code Im getting error 
Error: Compile Error: Variable does not exist: Product2 at line 39 column 86..Please help.
Map<id,Quote> QuoteProductMap=new Map<Id,Quote>([Select id,recordTypeId,Status,(Selectid,Product2.Name,Product2.Additional_Spe__c FROM QuoteLineItems)from Quote where Id in:newItems.keyset()]);
 
          for(Quote quoteToProduct:newItems.values()){
if(QuoteProductMap.get(quoteToProduct.id).QuoteLineItems.Product2.Additional_Spe__c== listProductAttribute[0].Additional_spe__c)
                            {
                              quoteToProduct.sp_Products__c=true;
                               listQuoteProduct.add(quoteToProduct);       
                            }
}

 

Hi All,

I'm need to use custom settings in my apex code.
Custom setting- Quote_Status__c
Field- Status__c
values:Approved ,In Progress and Rejected.

Please help me in writing if condintion..Below I did hard codeing need to use custome settings there ..
if(quote.recordTypeId==something && (quote.Status=='In Progress'||quote.Status=='Approved'||quote.Status=='Rejected & ')){
	 
      //code
			}

 
Hi All,

Please help me to write test calss for below trigger.Also it will be helpful if you add basic information as comments for understanding.

trigger UpdateTicketDetails on Ticket_Details__c (before insert,before update) {

    if(Trigger.isInsert){
    
        Id ticketRecordType = Schema.SObjectType.Ticket_Details__c.getRecordTypeInfosByName().get('Service').getRecordTypeId();
      //list<Ticket_Details__c> ticketList = new list<Ticket_Details__c> ();
        for(Ticket_Details__c ticket:Trigger.new){        
            if(ticket.recordTypeId==ticketRecordType){            
                ticket.Incident__c=False;
                ticket.Ticket_Description__c='Ticket is Service Request';
            }else{            
             ticket.Incident__c=True;
             ticket.Ticket_Description__c='Ticket is Incident';    
            }            
            //ticketList.add(ticket);
        }
       // insert ticketList;
    }
    
    if(Trigger.isUpdate){      
       for(Ticket_Details__c ticket:Trigger.new){
            String oldStatus= Trigger.oldMap.get(ticket.Id).Ticket_status__c;
            
          If(ticket.Ticket_status__c!=oldStatus){
              system.debug('Status has been changed');
              ticket.Ticket_Summary__c='Status changed from ' + oldStatus +' to '+ ticket.Ticket_status__c+'.';
          }        
       }       
    }
}
Hi All,

Please help me to write test calss for below trigger.Also it will be helpful if you add basic information as comments for understanding.

trigger UpdateTicketDetails on Ticket_Details__c (before insert,before update) {

    if(Trigger.isInsert){
    
        Id ticketRecordType = Schema.SObjectType.Ticket_Details__c.getRecordTypeInfosByName().get('Service').getRecordTypeId();
      //list<Ticket_Details__c> ticketList = new list<Ticket_Details__c> ();
        for(Ticket_Details__c ticket:Trigger.new){        
            if(ticket.recordTypeId==ticketRecordType){            
                ticket.Incident__c=False;
                ticket.Ticket_Description__c='Ticket is Service Request';
            }else{            
             ticket.Incident__c=True;
             ticket.Ticket_Description__c='Ticket is Incident';    
            }            
            //ticketList.add(ticket);
        }
       // insert ticketList;
    }
    
    if(Trigger.isUpdate){      
       for(Ticket_Details__c ticket:Trigger.new){
            String oldStatus= Trigger.oldMap.get(ticket.Id).Ticket_status__c;
            
          If(ticket.Ticket_status__c!=oldStatus){
              system.debug('Status has been changed');
              ticket.Ticket_Summary__c='Status changed from ' + oldStatus +' to '+ ticket.Ticket_status__c+'.';
          }        
       }       
    }
}