• DoctorCode
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies

i have a lookup field to contacts in the lead and i want a field up the lookup field base in the name the user select in a pick list, the picklist have the names of some of the contact i have 

for example in the picklist i have kevin johnson if the user select kevin i want the triger to prepopulate the lookup field so the lead relates to that contact

 

is this possible 

 

i was playing with the trigger and this is what i got

 

 

trigger updateAE on Lead (after insert) {
  for (lead l:Trigger.new){
  l.L_RRx_AE__c = l.L_Special_Instructions__c;
    }
  }

 and every time i used it a get and error saying :

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger updateAE caused an unexpected exception, contact your administrator: updateAE: execution of AfterInsert caused by: System.StringException: Invalid id: kevin johnson: Trigger.updateAE: line 3, column 3

 

 

hello all

 

im looking for the best way to bring information to the opportunity from several custom object i have so we can update the stage in the opportunity

 

i think the way to do is create lookups to this custom objects, somehow update this lookup fields with a trigger and just create formula field to bring my data over

 

is this the best way to do it, I’m new to the trigger developing think and i don’t know exactly my options

 

Thanks in advance for the help

 

 

hello all

 

im trying to update a lookup field in the acct with the case id but i keep getting the error variable does not exist, ay help will be appreciate 

 

by the way im new to this apex code and im kind rusty after 10 years i didn’t to programming at all

 

trigger updateAccountWithCase on Case (after insert) {
    set <ID> acc_ids = new set <id> ();
        for (case c : trigger.new)acc_ids.add(c.accountid);
        list<account> acct_to_update = [select id, case__c from account where id in :acc_ids];
            {
            for (account acc: acct_to_update) acc.case__c = caseid;
    update acct_to_update;
    }
}

i have a lookup field to contacts in the lead and i want a field up the lookup field base in the name the user select in a pick list, the picklist have the names of some of the contact i have 

for example in the picklist i have kevin johnson if the user select kevin i want the triger to prepopulate the lookup field so the lead relates to that contact

 

is this possible 

 

i was playing with the trigger and this is what i got

 

 

trigger updateAE on Lead (after insert) {
  for (lead l:Trigger.new){
  l.L_RRx_AE__c = l.L_Special_Instructions__c;
    }
  }

 and every time i used it a get and error saying :

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger updateAE caused an unexpected exception, contact your administrator: updateAE: execution of AfterInsert caused by: System.StringException: Invalid id: kevin johnson: Trigger.updateAE: line 3, column 3

 

 

hello all

 

im looking for the best way to bring information to the opportunity from several custom object i have so we can update the stage in the opportunity

 

i think the way to do is create lookups to this custom objects, somehow update this lookup fields with a trigger and just create formula field to bring my data over

 

is this the best way to do it, I’m new to the trigger developing think and i don’t know exactly my options

 

Thanks in advance for the help

 

 

hello all

 

im trying to update a lookup field in the acct with the case id but i keep getting the error variable does not exist, ay help will be appreciate 

 

by the way im new to this apex code and im kind rusty after 10 years i didn’t to programming at all

 

trigger updateAccountWithCase on Case (after insert) {
    set <ID> acc_ids = new set <id> ();
        for (case c : trigger.new)acc_ids.add(c.accountid);
        list<account> acct_to_update = [select id, case__c from account where id in :acc_ids];
            {
            for (account acc: acct_to_update) acc.case__c = caseid;
    update acct_to_update;
    }
}