Browse by Solutions
Browse by Solutions
Updated on May 22, 2020 05:08AM by Admin
Configuring in Master Layout
- In the Contacts App of Apptivo, go to Settings → Customize App → Master Layout.
- To calculate a contact’s age automatically, we have to add two date attributes and one function attribute to the Master Layout.
- The first date attribute should be customized to add today’s date. The second date attribute is to add the date of birth.
- Drag and drop a date attribute. To configure the date attribute to add today’s date click here.
- Now, drag and drop a date attribute to add the birth date of the contact. You can rename the attribute from its Inspector tab. Click on the attribute to see the Inspector tab.
- Once the attributes are set up to calculate today’s date and age, drag and drop the function attribute to the Master Layout.
- Choose the function attribute to view its Inspector tab. In the Inspector tab, you can rename the attribute as the Contact’s Age. Also, set the type as Date Formula.
- Scroll down to Function and select Create Function.
- Select the Arithmetic radio button in the Function Editor. Set the formula to subtract the Date of Creation attribute from Date of Birth attribute by inserting the attributes and using the arithmetic operators.
- In the Inspector tab, scroll down to Standard Behavior. Select the Display as dropdown and select Years Months Days.
- This will ensure that the date is displayed with the exact days, months, and years value. Save the changes in the Master Layout.
Configuring in Triggers
In order for the age to increase every day, it is important to get the date value updated automatically every day. This can be achieved with the help of Time Based Triggers.
- In the Settings page of the Contacts App, select Contacts → Triggers → Time Based Triggers.
- Select Create to create a new trigger in the Time Based Triggers page.
- In the Create Trigger page, add a name for the trigger and enable the enabled toggle to keep it active.
- Since the age has to increase automatically, set the Execution Frequency as Recurring.
- In the Recurring period, set Run(s) every day at a particular time. Here, 12 AM.
- In the Criteria field, set the condition to generate a trigger if Today’s date attribute is not empty.
- Now, configure the actions to update an attribute by selecting Update Attribute.
- In the Create Trigger Action Side Panel, select the Today’s Date attribute and set the value as System Variable → Now.
- Now, the trigger is configured. Select Create to create a new trigger.
Automatic Age Calculation
Consider creating a contact in the Contacts App. The date attributes, Today’s Date is added automatically while Date of Birth is added manually by the employee.
- Once the date of birth is added, the age value is calculated automatically.
- Select Create to create a new contact.
- According to the Time Based Trigger, Today’s Date attribute value changes automatically at 12 AM every day, and hence the age also changes by default.