How to configure the automatic card expiration in unified workfeeds
Category: Sapho Builder
Audience: Developers building Sapho micro apps
One of the core features of Sapho Modern Portal is our unified workfeed. This workfeed consolidates notifications in the form of cards about important updates, such as pending tasks, important updates, and company-wide announcements. Sometimes, there are cases when a card should be removed from the feed when it is no longer relevant for employees. As of Sapho Modern Portal 4.8, micro app developers can configure card expiration rules in the Feed Card channel editor under the Expiration tab.
Condition-based expiration rules
- Condition-based expiration rules are only supported for the following events: New Records, Changed Records, Matching Records, and Date Reminders.
- When configuring expiration triggers, you can use either OR or AND. However, you cannot use both for a single trigger.
- If an expiration rule triggers, the card for that particular record will expire for all users for which it was created.
For example, let’s imagine you have set up an event in Sapho that monitors for new expense reports that are waiting to be approved by a manager. The event runs after the data sync, monitors for reports whose status becomes Pending, and informs the managers who are set as the approvers of those reports.
Next, let’s assume these new data changes trigger the event, and Sapho sends a feed card to a user called Billy Taylor about a new expense report that requires his approval.
The card will become irrelevant and should be removed from Billy Taylor’s Feed if any of the following occurs:
- The submitter of the expense report recalls it to make changes.
- The report is re-assigned to another user.
- Billy Taylor logs into the source system (e.g. SAP Concur) and approves the expense report from there.
- Billy Taylor approves the report directly from his Sapho feed.
To configure expiration triggers for Scenarios 1 - 3, please set the following condition-based expiration rules in the Expiration tab:
The best practice is to set the parent event to run After Data Sync. This way, the expiration rules will also check for record changes in the source system after the data sync and remove non-relevant cards as soon as possible.
However, as noted in scenario 4, records can also be updated after an employee takes action in Sapho Modern Portal (i.e. clicking the Approve or Reject buttons on an expense report). In this case, you would create a card expiration rule that triggers when one of these buttons is clicked. This means that a card will expire also after an action occurs on these buttons.
To do this, go to the page that contains the Approve and Reject buttons, add a Run Events action for each button, and choose the event that contains the related condition-based expiration rules.
Once you configured this additional setting for each button, the card related to the changed record will be automatically removed from the employee’s feed after a button is clicked.
Finally, let’s take a look at how to configure removing a card when a card needs to be removed from the feed of all employees who received it after at least one person has taken an action.
Let’s say that in your organization, a purchase order can be approved by any user from the “Purchase Agents” security group and only one user needs to approve it. In this case, you would set up an event of type New or Change to monitor for that monitors for new purchase orders pending approval and informs the users from the “Purchase Agents” group.
For instance, if there are 3 users in this group, then all of them will see a card in their feeds any time a new purchase order is created. Therefore, if one person approves a PO, the card will need to be removed from all of their feeds.
To do this, you will configure a rule to trigger when the status of the PO becomes equal to “Released”. (Please note: This rule may vary due to the event types and data structure of the source system.)
Like the previous examples, you will need need to add a Run Events action to each button and select the event that contains the related card expiration rule.
Once you finished these two steps, the card about this PO will be removed from the feed of all three users after at least one users takes an action.
Time-based expiration rules
Time-based card expiration rules are based on the time lapsed since the card was created or based on a date value from the record which generated the event. You can create a trigger with these rules for all event types.
For example, if you send out a company-wide update to your employees, you can automatically dismiss the card after a period of time if it has not been dismissed from an employee’s feed. To do this, you will add an expiration condition like the following: 7 days - after - card creation.
You might also want to send an announcement about a company-wide contest that should expire when the deadline passes. To do this, you will add the following expiration condition: 0 hours - after - due_date.
In the Expiration tab, you will also find an option to delete a card when the underlying record is deleted from the source systems. You can enable this by toggling on the switch for this condition.We decided to let admins to enable this rule on a case-by-case basis because supporting it implicitly for all events will slow down the performance of Sapho Server. Please enable it only when necessary.