• Lisa Kattawar
  • NEWBIE
  • 20 Points
  • Member since 2014
  • Salesforce Administrator
  • Asure Software

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
I'm looking for a Trigger to do the following:

On Create Opportunity
Loop through Account Contacts (That's Contacts, NOT Contact Roles)
  If Contact.UserRole__c (a custom field on the contact object) = 'Billing'
      Store Contact ID in Opportunity.Billing_Contact__c (a custom lookup field on the Opportunity object)
  Else
      If Contact.UserRole__c (a custom field on the contact object) = 'Shipping'
          Store Contact ID in Opportunity.Shipping_Contact__c (a custom lookup field on the Opportunity object)
      Else
          ignore and go to next Account Contact

Thanks in advance!!  This is such a great Developer Community!  I'm not a developer but I can usually "modify" code if someone can get me started.
Background:
In our org
Accounts have a Partner related list (this is an account to account relationship with a "role" of "Reseller")
Opportunities have a Partner related list (this is an opportunity to account relationship with a "role" of "Reseller")
I need a trigger, such that when an opportunity is created on an account that has a "Reseller" Partner, the Opportunity gets created with the same "Reseller" Partner

I  believe the Opportunity Trigger will need to do the following:
On Opportunity Create
If Opportunity.Account has a Partner where Role=Reseller
    Add the Partner to the Opportunity with Role=Reseller

I think that's it.  I don't believe there's any "else" logic.

If  you have code that you're willing to share, I will be extremely grateful.  I'm not a developer, but if I can get some code that is close to what I need I can usually modify it for my specific needs.

Thanks in advance, for any assistance!!!
Can someone help me with a trigger that will do the following (hopefully this is just a matter of sharing code you've already written for a similar situation):

If Activity is created by "Marketing" (I know this based on created by user)
   Copy Activity Record to Custom Marketing_Activity__c object
   Delete Activity Record

Thanks in Advance!!
Lisa


Can someone help me with this compile error?  I'm not a developer and this is my first time to try and create a trigger.  I was given some sample code and modified it just a little bit.  For the life of me, I can't see what might possibly be wrong with line 3.

User-added image
Can someone help me with a trigger that will do the following (hopefully this is just a matter of sharing code you've already written for a similar situation):

If Activity is created by "Marketing" (I know this based on created by user)
   Copy Activity Record to Custom Marketing_Activity__c object
   Delete Activity Record

Thanks in Advance!!
Lisa


Can someone help me with this compile error?  I'm not a developer and this is my first time to try and create a trigger.  I was given some sample code and modified it just a little bit.  For the life of me, I can't see what might possibly be wrong with line 3.

User-added image
I've writen a trigger so that when I import an Account record from Data.com or clean one the trigger will use the Parent DUNS on the associated D&B Company record to see if I already have the parent in my org.  If I do, then it sets the parent automatically.  The trigger works great and is bulkified.  But now I'm stuck.  How do I generate mock D&B Company records in a Test Method to test against?  Do I have to 'see all data' in the TestMethod test from a known real D&B Company record?