• KirbySF
  • NEWBIE
  • 0 Points
  • Member since 2012

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

I'm new to developing in general and am trying to create a trigger that updates the custom lookup field Market_lookup__c with the value selected in the field Market_picklist__c. Both fields reside in the standard Opportunity object, and the Market_lookup__c field points to the standard Account object. What I came up with is:

 

1
2
3
4
trigger OpptyMktTrigger on Opportunity (before insert, before update) {
    for (Opportunity a: Trigger.new)
            a.Market_lookup__c = a.Market_picklist__c;
}

 

But running this trigger returns the error: OpptyMktTrigger: execution of BeforeUpdate caused by: System.StringException: Invalid id: Market 1: Trigger.OpptyMktTrigger: line 3, column 1

 

I'm sure it's a simple fix. Can anyone help?

I'm new to developing in general and am trying to create a trigger that updates the custom lookup field Market_lookup__c with the value selected in the field Market_picklist__c. Both fields reside in the standard Opportunity object, and the Market_lookup__c field points to the standard Account object. What I came up with is:

 

1
2
3
4
trigger OpptyMktTrigger on Opportunity (before insert, before update) {
    for (Opportunity a: Trigger.new)
            a.Market_lookup__c = a.Market_picklist__c;
}

 

But running this trigger returns the error: OpptyMktTrigger: execution of BeforeUpdate caused by: System.StringException: Invalid id: Market 1: Trigger.OpptyMktTrigger: line 3, column 1

 

I'm sure it's a simple fix. Can anyone help?