Announcement

Collapse
No announcement yet.

Customer Payment Due Dates ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Customer Payment Due Dates ?

    Hello, good luck

    How can I create a field in CRM to enter Customer Payment Due Dates on the customer card and have it calculated automatically based on date?

  • #2
    Hi yakup aycıl,

    First, go to Administration > Entity Manager > Customer (Contact, Lead, etc.) > Fields and create a new field with a Date type named Payment Due Date. More about fields you can find here: https://docs.espocrm.com/administration/fields.

    Then, go to Administration > Entity Manager > Customer (Contact, Lead, etc.) > Formula > Before Save Formula Script and create some formula script for managing and calculating created field value using datetime functions: https://docs.espocrm.com/administrat...rmula/datetime.

    Finally, go to Administration > Entity Manager > Customer (Contact, Lead, etc.) > Layouts and customize where you want your field to be displayed. More about layout management you can find here: https://docs.espocrm.com/administration/layout-manager.

    Comment


    • #3
      Code:
      //calculate due date from invoice-date and payment deadline
      ifThen(
      paymentDeadline == '14',
      dueDate=datetime\addDays(invoiceDate, 14)
      );
      ifThen(
      dueDate == '28',
      dueDate=datetime\addDays(invoiceDate, 28)
      );
      You can also set another enum field, which tells, if invoice is open, overdue or paid​, which you can trigger by another formula.

      Comment


      • #4
        Click image for larger version

Name:	image.png
Views:	48
Size:	8.5 KB
ID:	111707​I opened a field called start and end date. Then I opened a field in the maturity field. The formula that calculates the day between these two dates; entity\set('Maturity', datetime\diff(dateStart, dateBetween, 'days')); I did this but it didn't work. Where am I making a mistake?

        lazovic

        Comment


        • #5
          yakup aycıl,

          You need to use the entity\setAttribute() function instead of the entity\set() one: https://docs.espocrm.com/administrat...tysetattribute.

          Also, please note that the field name in the formula script must be specified with a lowercase letter (not Maturity, but maturity).

          Also, if you want the calculated field to have value for all records, you need to recalculate the formula. Go to the List View of your records, select all records, and, by clicking on the Actions button, select the Recalculate Formula action.​

          Comment

          Working...
          X