• William Christ NY
  • NEWBIE
  • 100 Points
  • Member since 2015
  • Senior Programmer / Salesforce Administrator
  • Harris Connect, LLC

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies
Hi There,

I have to assign leads to a queue based on the Campaign 
for example campaign name = 2016 then it should be assinging to the queue on lead

Please help
I am wondering if there is a better way to accomplish what this trigger does... or a cleaner way to write the code. Or am I missing an easier way to get the result?

Thanks!
 
trigger CurrencyUpdates on Account (before update) {


List<Account> acclist = new List<Account>();

    for(Account acc: Trigger.new){
        If(Trigger.oldMap.get(acc.id).Currency_Type__c != acc.Currency_Type__c){
            system.debug('Old= ' +Trigger.oldMap.get(acc.id).Currency_Type__c);
            system.debug('New= ' +acc.Currency_Type__c);            
        if (acc.Currency_Type__c == 'YEN'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0100;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0100;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0100;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0100;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0100;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0100;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0100;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0100;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0100;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0100;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0100;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0100;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0100;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0100;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0100;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0100;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0100;            
        } else if (acc.Currency_Type__c == 'CHF') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9478;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9478;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9478;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9478;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9478;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9478;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9478;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9478;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9478;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9478;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9478;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9478;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9478;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9478;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9478;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9478;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9478;            
        }else if (acc.Currency_Type__c == 'EUR') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.3008;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.3008;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.3008;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.3008;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.3008;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.3008;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.3008;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.3008;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.3008;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.3008;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.3008;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.3008;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.3008;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.3008;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.3008; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.3008;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.3008;
        }else if (acc.Currency_Type__c == 'CAD'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9502;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9502;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9502;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9502;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9502;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9502;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9502;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9502;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9502;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9502;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9502;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9502;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9502;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9502;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9502; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9502;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9502;            
        }else if (acc.Currency_Type__c == 'GBP'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.5279;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.5279;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.5279;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.5279;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.5279;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.5279;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.5279;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.5279;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.5279;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.5279;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.5279;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.5279;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.5279;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.5279;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.5279;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.5279;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.5279;            
        }else if (acc.Currency_Type__c == 'KRW') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0009;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0009;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0009;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0009;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0009;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0009;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0009;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0009;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0009;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0009;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0009;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0009;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0009;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0009;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0009;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0009;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0009;            
        }else if (acc.Currency_Type__c == 'USD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.0;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.0;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.0;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.0;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.0;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.0;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.0;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.0;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.0;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.0;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.0;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.0;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.0;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.0;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.0;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.0;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.0;            
        }else if (acc.Currency_Type__c == 'AUD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.88309;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.88309;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.88309;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.88309;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.88309;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.88309;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.88309;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.88309;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.88309;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.88309;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.88309;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.88309;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.88309;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.88309;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.88309;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.88309;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.88309;            
        }else if (acc.Currency_Type__c == 'SGD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.78499;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.78499;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.78499;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.78499;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.78499;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.78499;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.78499;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.78499;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.78499;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.78499;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.78499;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.78499;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.78499;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.78499;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.78499;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.78499;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.78499;            
        }else if (acc.Currency_Type__c == 'HKD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.12891;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.12891;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.12891;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.12891;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.12891;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.12891;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.12891;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.12891;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.12891;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.12891;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.12891;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.12891;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.12891;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.12891;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.12891;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.12891;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.12891;            
        }else if (acc.Currency_Type__c == 'NZD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.79067;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.79067;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.79067;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.79067;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.79067;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.79067;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.79067;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.79067;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.79067;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.79067;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.79067;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.79067;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.79067;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.79067;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.79067;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.79067;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.79067;            
        }else if (acc.Currency_Type__c == 'THB') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.03078;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.03078;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.03078;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.03078;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.03078;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.03078;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.03078;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.03078;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.03078;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.03078;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.03078;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.03078;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.03078;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.03078;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.03078;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.03078;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.03078;            
        }else (acc.Total_RR_Converted_to_USD__c = null);
                  
        }
    }
update acclist;
}

 
Hello Guys,

I'd like to ask for help on how to resolve this particular issue. I don't get syntax Error but when I execute the trigger, it returns me this Error.

Error:Apex trigger SkedCreateTasksTrigger caused an unexpected exception, contact your administrator: SkedCreateTasksTrigger: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Name ID: id value of incorrect type: 00528000002rYgOAAU: [WhoId]: Trigger.SkedCreateTasksTrigger: line 30, column 1


Story:
        I have VA Task and a Standard Salesforce Task (Activity) Related List under My JOB object.

        Basically, when I update the Job Status to Complete, I'd like to have a copy of VA Task as a Standard Salesforce Task for each VA Task.

CODE:
trigger SkedCreateTasksTrigger on sked__Job__c (before Update) {
    
    set<id> jobId = new set<id>();
    
    for(sked__Job__c job: trigger.new){
        if(job.sked__Job_Status__c == 'Complete'){
            jobId.add(job.id);
        }
    }
    
    list<Task> newTasks = new list<Task>();
    
    for(VA_Task__c vaTask : [select Job__c, Comments__c,Priority__c,Status__c,Subject__c,Assigned_To__r.id from VA_Task__c where job__c In: jobId]){
        
        Task t = new Task();
        t.WhoId = vaTask.Assigned_To__r.id;
        t.WhatId = vaTask.Job__c;
        t.priority = vaTask.Priority__c;
        t.Status = 'Not Started';
        t.Subject = vaTask.Subject__c;
        t.Description = vaTask.Comments__c;
        
        newTasks.add(t);
    }
    
    for(integer i=0;i<newTasks.size();i++){
        system.debug(newTasks[i].whoId);
    }
    
    insert newTasks;
}

How Can I fix the Error?

Thanks,

Zach
 I am having issues validating the answer.  I used the formula from the help area, and the trail says that the answer is incorrect.  See my answer below.  Anus assitance is appreciated.

CASE(
  MOD( date - DATE( 1900, 1, 8 ), 7 ),
  0, "Monday",
  1, "Tuesday",
  2, "Wednesday",
  3, "Thursday",
  4, "Friday",
  5, "Saturday", 
  "Sunday"
)
Here is what I did.
1. I've selected an account - ABC Labs on a sample org 
2. Then I went down to "Open Activities" Section
3. Clicked on the "New Task" button which took me to the "New Task" page.
4. Did a search and selected a "Contact" for a Task that belonged to ABC Company
5. I was hoping that the "Account" field will be automatically populated and grayed out once I select a "Contact" since the "Contact" belongs to an account, but the "Account" field is still editable. I can still go ahead and change the "Account" field to an "Account" that's totally unrelated to the "Contact" I have selected. I thought there will be some default validation rules already set up. Am I wrong to make that assuption?
Hi all,
         In account object i have a status field (active and inactive),when ever we want to insert a contact to particular accountname in lookup it will show only active accounts.how can be it done,is there any option in UI.thanks in advance

Regards
Vijay
Hi There,

I have to assign leads to a queue based on the Campaign 
for example campaign name = 2016 then it should be assinging to the queue on lead

Please help
I am wondering if there is a better way to accomplish what this trigger does... or a cleaner way to write the code. Or am I missing an easier way to get the result?

Thanks!
 
trigger CurrencyUpdates on Account (before update) {


List<Account> acclist = new List<Account>();

    for(Account acc: Trigger.new){
        If(Trigger.oldMap.get(acc.id).Currency_Type__c != acc.Currency_Type__c){
            system.debug('Old= ' +Trigger.oldMap.get(acc.id).Currency_Type__c);
            system.debug('New= ' +acc.Currency_Type__c);            
        if (acc.Currency_Type__c == 'YEN'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0100;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0100;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0100;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0100;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0100;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0100;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0100;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0100;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0100;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0100;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0100;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0100;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0100;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0100;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0100;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0100;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0100;            
        } else if (acc.Currency_Type__c == 'CHF') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9478;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9478;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9478;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9478;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9478;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9478;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9478;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9478;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9478;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9478;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9478;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9478;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9478;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9478;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9478;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9478;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9478;            
        }else if (acc.Currency_Type__c == 'EUR') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.3008;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.3008;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.3008;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.3008;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.3008;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.3008;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.3008;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.3008;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.3008;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.3008;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.3008;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.3008;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.3008;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.3008;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.3008; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.3008;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.3008;
        }else if (acc.Currency_Type__c == 'CAD'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9502;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9502;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9502;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9502;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9502;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9502;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9502;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9502;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9502;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9502;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9502;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9502;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9502;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9502;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9502; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9502;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9502;            
        }else if (acc.Currency_Type__c == 'GBP'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.5279;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.5279;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.5279;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.5279;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.5279;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.5279;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.5279;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.5279;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.5279;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.5279;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.5279;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.5279;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.5279;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.5279;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.5279;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.5279;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.5279;            
        }else if (acc.Currency_Type__c == 'KRW') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0009;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0009;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0009;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0009;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0009;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0009;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0009;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0009;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0009;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0009;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0009;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0009;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0009;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0009;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0009;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0009;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0009;            
        }else if (acc.Currency_Type__c == 'USD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.0;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.0;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.0;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.0;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.0;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.0;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.0;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.0;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.0;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.0;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.0;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.0;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.0;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.0;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.0;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.0;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.0;            
        }else if (acc.Currency_Type__c == 'AUD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.88309;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.88309;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.88309;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.88309;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.88309;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.88309;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.88309;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.88309;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.88309;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.88309;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.88309;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.88309;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.88309;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.88309;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.88309;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.88309;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.88309;            
        }else if (acc.Currency_Type__c == 'SGD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.78499;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.78499;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.78499;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.78499;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.78499;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.78499;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.78499;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.78499;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.78499;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.78499;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.78499;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.78499;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.78499;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.78499;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.78499;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.78499;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.78499;            
        }else if (acc.Currency_Type__c == 'HKD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.12891;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.12891;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.12891;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.12891;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.12891;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.12891;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.12891;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.12891;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.12891;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.12891;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.12891;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.12891;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.12891;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.12891;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.12891;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.12891;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.12891;            
        }else if (acc.Currency_Type__c == 'NZD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.79067;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.79067;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.79067;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.79067;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.79067;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.79067;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.79067;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.79067;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.79067;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.79067;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.79067;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.79067;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.79067;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.79067;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.79067;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.79067;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.79067;            
        }else if (acc.Currency_Type__c == 'THB') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.03078;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.03078;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.03078;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.03078;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.03078;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.03078;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.03078;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.03078;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.03078;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.03078;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.03078;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.03078;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.03078;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.03078;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.03078;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.03078;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.03078;            
        }else (acc.Total_RR_Converted_to_USD__c = null);
                  
        }
    }
update acclist;
}

 
Hello Guys,

I'd like to ask for help on how to resolve this particular issue. I don't get syntax Error but when I execute the trigger, it returns me this Error.

Error:Apex trigger SkedCreateTasksTrigger caused an unexpected exception, contact your administrator: SkedCreateTasksTrigger: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Name ID: id value of incorrect type: 00528000002rYgOAAU: [WhoId]: Trigger.SkedCreateTasksTrigger: line 30, column 1


Story:
        I have VA Task and a Standard Salesforce Task (Activity) Related List under My JOB object.

        Basically, when I update the Job Status to Complete, I'd like to have a copy of VA Task as a Standard Salesforce Task for each VA Task.

CODE:
trigger SkedCreateTasksTrigger on sked__Job__c (before Update) {
    
    set<id> jobId = new set<id>();
    
    for(sked__Job__c job: trigger.new){
        if(job.sked__Job_Status__c == 'Complete'){
            jobId.add(job.id);
        }
    }
    
    list<Task> newTasks = new list<Task>();
    
    for(VA_Task__c vaTask : [select Job__c, Comments__c,Priority__c,Status__c,Subject__c,Assigned_To__r.id from VA_Task__c where job__c In: jobId]){
        
        Task t = new Task();
        t.WhoId = vaTask.Assigned_To__r.id;
        t.WhatId = vaTask.Job__c;
        t.priority = vaTask.Priority__c;
        t.Status = 'Not Started';
        t.Subject = vaTask.Subject__c;
        t.Description = vaTask.Comments__c;
        
        newTasks.add(t);
    }
    
    for(integer i=0;i<newTasks.size();i++){
        system.debug(newTasks[i].whoId);
    }
    
    insert newTasks;
}

How Can I fix the Error?

Thanks,

Zach
How do I hide the views when new queues are created?

I am creating a queue and when I go and see that queue is in the view dropdown and when I edit that it has been shared with "All internal Users" How do I avoid that?
I don't want all internal users to see that a new queue is created