• Ryan Priest
  • 0 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0

Hi SalesForce developers, looking for an easy way to get a formula field to display a due date based on 2 other fields.

Field 1 - called "cd_payment_terms__c" (formula field) | shows payment options which are pulled from a field on a seperate object and presents as text, the following options can be returned.

"In Advance"
"07 Days DOI"
"15 Days DOI"
"30 Days DOI"
"30 Days EOM"
"45 Days EOM"
"60 Days EOM"

Field 2 - called "invoice_date_c" (date field) | manually entered date that shows when an invoice is sent to a customer.

Field 3 - called "CD_Invoice_Due_Date__c" (formula field) | this field should calulate when the invoice is due based on the invoice date + a value from the "cd_payment_terms__c"

I was using the formula:

CD_Invoice_Date__c +
"In Advance", 0,
"07 Days DOI", 07,
"15 Days DOI", 15,
"30 Days DOI", 30,
"30 Days EOM", 30,
"45 Days EOM", 45,
"60 Days EOM", 60,

Which worked for the DOI (date of invoice) which just grabbed the invoice date + the DOI value (eg. 30 Days EOI + Invoice Date), problem is the EOM (End of Month) values are harder to work out as they need to calculate - example for 30 Days EOM (Invoice Date + "last day of the invoice date month" + 30 days" etc. for 30, 45, 60.)

If no payment terms are available it should just show the invoice date, if the term "In Advance" is shown then it should be the invoice date. 

Can anyone help me out there with the formula needed for the "CD_Invoice_Due_Date__c" field?

thanks SalesForce legends!