• Karthik keyan
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 2
    Replies

  I have created another trigger on the same kind of coding on others 2 objects,the trigger coding seems to fine but seems not creating child records when insert or update event changes on parent record.Why manipulation was not happening i dont know .Please send your suggestion on this trigger too.

trigger CreateInterviewoofPositionUpdate on Warehouse_14__Position__c  (after insert,after update){
    
    List<Warehouse_14__Interviews__c> interview =new List<Warehouse_14__Interviews__c>();
    //Warehouse_14__Interviews__c inte = new Warehouse_14__Interviews__c();

    if(Trigger.isInsert)
    {
        for(Warehouse_14__Position__c posi:[ select id,Name,Warehouse_14__Type__c ,Warehouse_14__Functional_Area__c,  (select id, Warehouse_14__Rounds__c,Warehouse_14__Status__c,Warehouse_14__Types__c,Warehouse_14__Name__c 
                                          from Warehouse_14__Interviews__r ) from Warehouse_14__Position__c where id IN : trigger.new]){
        for(Warehouse_14__Interviews__c inte:posi.Warehouse_14__Interviews__r)  {      
            if(posi.Warehouse_14__Type__c == 'High Level' || posi.Warehouse_14__Functional_Area__c =='Project Management' || posi.Warehouse_14__Functional_Area__c == 'Infrastructure Architect' 
           || posi.Warehouse_14__Functional_Area__c == 'Domain Expert'){
             
             inte.Warehouse_14__Rounds__c ='Managerial';
             inte.Warehouse_14__Status__c ='N/A';
             inte.Warehouse_14__Types__c ='Telephonic';
             inte.Warehouse_14__Name__c = posi.Id;             
           } else if(posi.Warehouse_14__Type__c == 'Low Level' || posi.Warehouse_14__Functional_Area__c =='Developer' || posi.Warehouse_14__Functional_Area__c == 'DB Admin' 
           || posi.Warehouse_14__Functional_Area__c == 'Telecom Division'){
             
             inte.Warehouse_14__Rounds__c ='Technical';
             inte.Warehouse_14__Status__c ='N/A';
             inte.Warehouse_14__Types__c ='Skype';
             inte.Warehouse_14__Name__c = posi.Id;             
           }   else if(posi.Warehouse_14__Type__c == 'Middle Level' || posi.Warehouse_14__Functional_Area__c =='Banking' || posi.Warehouse_14__Functional_Area__c == 'Insurance' 
           || posi.Warehouse_14__Functional_Area__c == 'Product Inside Sales'){
             
             inte.Warehouse_14__Rounds__c ='Human Resources';
             inte.Warehouse_14__Status__c ='N/A';
             inte.Warehouse_14__Types__c ='Face To Face';
             inte.Warehouse_14__Name__c = posi.Id;             
           }   
             interview.add(inte);
        }
 }                                                                                                             
    insert interview;
    } else {
        for(Warehouse_14__Position__c posi:[ select id,Name,Warehouse_14__Type__c ,Warehouse_14__Functional_Area__c,  (select id, Warehouse_14__Rounds__c,Warehouse_14__Status__c,Warehouse_14__Types__c,Warehouse_14__Name__c 
                                            from Warehouse_14__Interviews__r ) from Warehouse_14__Position__c where id IN : trigger.new]){
        for(Warehouse_14__Interviews__c inte:posi.Warehouse_14__Interviews__r)  { 
        if(posi.Warehouse_14__Type__c == 'High Level' || posi.Warehouse_14__Functional_Area__c =='Project Management' || posi.Warehouse_14__Functional_Area__c == 'Infrastructure Architect' 
           || posi.Warehouse_14__Functional_Area__c == 'Domain Expert'){
             
             inte.Warehouse_14__Rounds__c ='Managerial';
             inte.Warehouse_14__Status__c ='N/A';
             inte.Warehouse_14__Types__c ='Telephonic';
             inte.Warehouse_14__Name__c = posi.Id;             
           } 
         else if(posi.Warehouse_14__Type__c == 'Low Level' || posi.Warehouse_14__Functional_Area__c =='Developer' || posi.Warehouse_14__Functional_Area__c == 'DB Admin' 
           || posi.Warehouse_14__Functional_Area__c == 'Telecom Division'){
             
             inte.Warehouse_14__Rounds__c ='Technical';
             inte.Warehouse_14__Status__c ='N/A';
             inte.Warehouse_14__Types__c ='Skype';
             inte.Warehouse_14__Name__c = posi.Id;             
           }   
          else if(posi.Warehouse_14__Type__c == 'Middle Level' || posi.Warehouse_14__Functional_Area__c =='Banking' || posi.Warehouse_14__Functional_Area__c == 'Insurance' 
           || posi.Warehouse_14__Functional_Area__c == 'Product Inside Sales'){
             
             inte.Warehouse_14__Rounds__c ='Human Resources';
             inte.Warehouse_14__Status__c ='N/A';
             inte.Warehouse_14__Types__c ='Face To Face';
             inte.Warehouse_14__Name__c = posi.Id;             
           }    
       
             interview.add(inte);
        }
      }                                          
    update interview;
    }
}

Thanks and Regards,
Karthikeyan
I have created the trigger where there a update in the master record status field ,resultant update should be in child record.but am getting the error  of update the child record.Please see the trigger code and please let me know your suggestion.

trigger CreateContoofPositionUpdate on Account  (after insert,after update){    
    List<Contact> Cont =new List<Contact>();
     
  Contact con = [select id, Warehouse_14__Rounds__c, Warehouse_14__Status__c,Warehouse_14__Types__c,Warehouse_14__Name__c from Contact limit 1];
    for (Account posi: trigger.new)
        if(posi.Warehouse_14__Type__c == 'High Level' || posi.Warehouse_14__Functional_Area__c =='Project Management' || posi.Warehouse_14__Functional_Area__c == 'Infrastructure Architect' 
           || posi.Warehouse_14__Functional_Area__c == 'Domain Expert'){
             con.Warehouse_14__Rounds__c ='Managerial';
             con.Warehouse_14__Status__c ='N/A';
             con.Warehouse_14__Types__c ='Skype';
             con.Warehouse_14__Name__c = posi.id;
           }    
       
             Cont.add(con);
    
    update Cont;
}

Error Message as :
Error:Apex trigger Warehouse_14.CreateContoofPositionUpdate caused an unexpected exception, contact your administrator: Warehouse_14.CreateContoofPositionUpdate : execution of AfterUpdate caused by: System.QueryException: List has more than 1 row for assignment to SObject:Trigger.Warehouse_14.CreateContoofPositionUpdate : line 6, column 1

Is there further  changes needed on the above trigger code.

Regards,
Karthik
Hi ,
For case object ,we have activity history which records any completed tasks and mail send from salesforce for the particular case.We have requirement to log a record for inbound email which was send from registered email2 case mail id from gmail mail or Outlook server .But its seems to not creating the  records at Activity History for inbound email .Please suggests your valuable comment to do any confirgration to achieve this goals.

Thanks,
Karthik



Error populated in detail page
hi team,

I am getting this error because of the requestor user while click the submit for approval button and but the status was changed forom inprocess to approval .This error page was not populated in test sandbox envn but its happen in production.What will be the error behind the popup message
Thank,
Karthik
i have developed the javascript to check some if condition and execute some variable assignment,but i have  got undefined identifier as error message in the screen,please check this  error messages for that javascript,i have tried out that which cant able to figure out.


{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")} 
var currentUser = "{!$User.Id}"; 
var profileId = "{!$Profile.Id}"; 
if(ISPICKVAL(!ITPR__c.Status__c, 'All Digital Initials Obtained') 
and ('{!ITPR__c.Wave1_Approved__c == True}' || '{!ITPR__c.Wave2_Approved__c == True}') 
and ('{profileId}' == '{!$Label.ITPR_Finance_Admin}' || '{profileId}' == '{!$Label.ITSES_Legal_Business_Administrator}' || '{profileId}' == '{!$Label.ITSES_Procurement_Business_Administrator}' 
|| '{profileId}' == '{!$Label.ITSES_VendorGovernance_Business_Administrator}'|| '{profileId}' == '{!$Label.ITPR_System_Admin}' || '{currentUser}' == '{!ITPR__c.Primary_Assignee__c}' || '{currentUser}' == '{!ITPR__c.Finance_Assignee__c}')) 

var answer=confirm("Are you sure, you want to add Additional Approvers?"); 
if (answer==true) 

var c = new sforce.SObject("ITPR__c"); 
c.Do_you_want_additional_approver__c = True; 
c.Status__c = 'In Approvals'; 
result = sforce.connection.update([c]); 
window.location.reload(); 


else 

alert ("You are not eligible to add additional approvers."); 
}
Hi All,

    I like get the file name while saving the file name with suffixed with account Id or Oppty id .In my code i have get the appln name with that oppty id to identity was saved from the application.Please assist me to get the pseudo code to implement it.

With Regards,
Karthik
In account page,the contact is created ,I want to show the number of count of contacts records created that is associated with that account.I have tried to write the trigger for that.But some error getting in that trigger.Please rectify to solve that bugs.    

trigger NoofCountContacts on Account (after insert,after update) {
   List <Account> con = new List <Account>();
   for (contact con1:Trigger.new){
      String Id= Apexpages.currentPage().getParameters().get('Account.Id');
   Integer sum =[SELECT COUNT() FROM contact where accid =:Trigger.old.keyset(Id)];
   con.Number_Of_Contacts= sum;
   }
   update con;
   }
I  written the trigger code that after creating new account the oppty should be created automatically.But the account was created but oppty seems to be not created.Could you please check this code its suitable to create or need to change the code further.
trigger CreateAccountOppty on Account (before insert,before update)
{    List<Opportunity> acc = new List<Opportunity>(); 
       for(Account acc1:Trigger.new)  
    {    
          if(acc1.Rating =='Hot' )   
                {       
                     Opportunity  oppty = new Opportunity ();  
                     oppty.name= acc1.Name;      
                      oppty.Opportunity_Status__c='Active';    
                      oppty.StageName ='Prospecting';
                       oppty.CloseDate= date.today()+1;  
                         acc.add(oppty);       
                      }          
                      insert acc; 
     }       
  }
I have created the trigger where there a update in the master record status field ,resultant update should be in child record.but am getting the error  of update the child record.Please see the trigger code and please let me know your suggestion.

trigger CreateContoofPositionUpdate on Account  (after insert,after update){    
    List<Contact> Cont =new List<Contact>();
     
  Contact con = [select id, Warehouse_14__Rounds__c, Warehouse_14__Status__c,Warehouse_14__Types__c,Warehouse_14__Name__c from Contact limit 1];
    for (Account posi: trigger.new)
        if(posi.Warehouse_14__Type__c == 'High Level' || posi.Warehouse_14__Functional_Area__c =='Project Management' || posi.Warehouse_14__Functional_Area__c == 'Infrastructure Architect' 
           || posi.Warehouse_14__Functional_Area__c == 'Domain Expert'){
             con.Warehouse_14__Rounds__c ='Managerial';
             con.Warehouse_14__Status__c ='N/A';
             con.Warehouse_14__Types__c ='Skype';
             con.Warehouse_14__Name__c = posi.id;
           }    
       
             Cont.add(con);
    
    update Cont;
}

Error Message as :
Error:Apex trigger Warehouse_14.CreateContoofPositionUpdate caused an unexpected exception, contact your administrator: Warehouse_14.CreateContoofPositionUpdate : execution of AfterUpdate caused by: System.QueryException: List has more than 1 row for assignment to SObject:Trigger.Warehouse_14.CreateContoofPositionUpdate : line 6, column 1

Is there further  changes needed on the above trigger code.

Regards,
Karthik
I  written the trigger code that after creating new account the oppty should be created automatically.But the account was created but oppty seems to be not created.Could you please check this code its suitable to create or need to change the code further.
trigger CreateAccountOppty on Account (before insert,before update)
{    List<Opportunity> acc = new List<Opportunity>(); 
       for(Account acc1:Trigger.new)  
    {    
          if(acc1.Rating =='Hot' )   
                {       
                     Opportunity  oppty = new Opportunity ();  
                     oppty.name= acc1.Name;      
                      oppty.Opportunity_Status__c='Active';    
                      oppty.StageName ='Prospecting';
                       oppty.CloseDate= date.today()+1;  
                         acc.add(oppty);       
                      }          
                      insert acc; 
     }       
  }