1

I am trying to implement a simple Payment Terms functionality for our opptys.

After looking on the appXchange - All solutions are too big for our needs.

What I have in mind is:

  • Create custom fields as follow:
  • Drop Down - payment terms (all types)
  • Date - Payment Date (will get value after save from Payment Terms)
  • Drop Down - Payment Status (Future, partially, complete, Late)

The supportive reports will be based on the fields.

My problem is, that one payment term is called: Current Month + 30. And it's due date is: The last day of the next month.

  • How can I get that in the workflow rule editor ?

The rules should be something like (This throws error - and does not get last day of month):

CASE(1,
IF(ISPICKVAL ( Payment_Terms__c , "Net + 30"),​ 1, 0), Today() + 30,
IF(ISPICKVAL​ ( Payment_Terms__c , "Net + 60"),​ 1, 0), Today() + 60,
IF(ISPICKVAL​ ( Payment_Terms__c , "Net + 90"),​ 1, 0), Today() + 90,
Today()+1)

I had a thought of making a custom object, but it felt like an overkill.

1

This is a great post that I used for this same problem. This helps determine the last day of the month, and even was updated to accommodate for leap years. This should help you accomplish exactly what your looking for with a simple formula field

http://mysalesforcecode.blogspot.com/2010/01/determine-end-of-month-date-or-days.html

The final formula is:

CASE( Payment_Terms__c , 
"Net", DATE(YEAR(TODAY()),MONTH(TODAY()),CASE( MONTH(TODAY())+1,1, 31, 2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28), 3, 31, 4, 30, 5, 1, 6, 30, 7, 31, 8, 31, 9, 30, 10, 31, 11, 30, 12, 31, 0)), 
"Net 30",DATE(YEAR(TODAY()),MONTH(TODAY())+1,CASE( MONTH(TODAY())+1,1, 31, 2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28), 3, 31, 4, 30, 5, 1, 6, 30, 7, 31, 8, 31, 9, 30, 10, 31, 11, 30, 12, 31, 0)), 
"Net 60",DATE(YEAR(TODAY()),MONTH(TODAY())+2,CASE( MONTH(TODAY())+2,1, 31, 2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28), 3, 31, 4, 30, 5, 1, 6, 30, 7, 31, 8, 31, 9, 30, 10, 31, 11, 30, 12, 31, 0)), 
"Net 90",DATE(YEAR(TODAY()),MONTH(TODAY())+3,CASE( MONTH(TODAY())+3,1, 31, 2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28), 3, 31, 4, 30, 5, 1, 6, 30, 7, 31, 8, 31, 9, 30, 10, 31, 11, 30, 12, 31, 0)), 
"Net 120",DATE(YEAR(TODAY()),MONTH(TODAY())+4,CASE( MONTH(TODAY())+4,1, 31, 2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28), 3, 31, 4, 30, 5, 1, 6, 30, 7, 31, 8, 31, 9, 30, 10, 31, 11, 30, 12, 31, 0)), 
"30", TODAY()+30, 
"60", TODAY()+60, 
"90", TODAY()+90, 
TODAY())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.