• chpurohit
  • 0 Points
  • Member since 2013

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 3

I was wondering if someone could help a newb to SFDC come up with the code for an apex trigger.


Here's the scenario:


I have a custom object called payments (Payments__c) - a child object  of opportunities - and I would like a payment record to be created after a new opportunity record is created, but only if a checkbox is checked (Create_New_Payment__c).


There are a few fields on the new payment record that need to be pre-populated:

  1. The opportunity field (obviously)
  2. Payment amount (Amount__c) should equal the amount of the opportunity (the payment amount field is not a formula field and can't be, but maybe this can be accomplished with workflow - if Create_New_Payment__c is true, payment amount equals opportunity amount??)
  3. Paid__c checkbox equals true

So is this possible to do?


Thanks for any help.