Have time be a comparable criteria in rules

  • 5
  • Idea
  • Updated 1 week ago
We schedule things at specific times, like migrations, or events, or even shifts in responsibility. Is there a way for Bionic rules to know what time it is happening at? Here's my use case:

I have folks that work until 5 PM every day. I also have someone that comes in at five and stays until after midnight. 

I have a rule that creates CTA Groups based on when sales opportunities close. If the opp was closed any time after six o clock, the assignee will have to wait until the next day to get started on the task. If the rule could tell if this was after five PM, then I could reroute the assignment to my afternoon worker. 

Also, I'd like to send out notifications based on if something has happened in a particular time frame, more granular than date. Like, if someone's server changes between 5 PM one day and 9 AM the next, I'd like to be able to notify the person in the morning that it happened. If I can only get as granular as the day, I can't be that discrete with my actions. 
Photo of Scotty

Scotty, Champion

  • 2,182 Points 2k badge 2x thumb

Posted 2 weeks ago

  • 5
Photo of Pele

Pele

  • 2,654 Points 2k badge 2x thumb
Hi Scotty, 

I think it might be possible to get what your after, but you'd have to add a formula/time field to the object using TIMEVALUE(). (TIMEVALUE function currently not available in rules engine)

I tested this out and was able to set a filter for time ≤ 17 and it seems to have worked– although rules engine didn't allow me to do this in the original dataset I created, but if I added a transformation to the rule, I was able to add a filter using this time field:

 


Adding a transformation actually worked out though, in that I could easily compare the 2 datasets, and it looks to work as expected:

Source dataset w/o time filter:




Transformed dataset w/ filter:



I think with some finessing, you should be able to add time fields to objects and use time as a criteria for rules.


Photo of Scotty

Scotty, Champion

  • 2,182 Points 2k badge 2x thumb
Whoa, that looks awesome. Can you show me documentation on that formula? I didn't find anything under timevalue in the GS docs. 
Photo of Pele

Pele

  • 2,654 Points 2k badge 2x thumb
Not sure if different Date and Time functions are in the plans for bionic rules, outside of what's available today, but for the time being, this would have to be a field added to a Salesforce object.

For the example above, you could add a formula field to the opportunity object, with time as the type, and have the formula be:

TIMEVALUE(close_date_time_c) 

**inserting the API field name as it is in you sfdc instance

For reference: Salesforce Date and Time Functions
Photo of Scotty

Scotty, Champion

  • 2,182 Points 2k badge 2x thumb
Ah in SF. So I couldn't apply this to a GS object, like Timeline Activity, say. Or a CTA. 
Photo of Pele

Pele

  • 2,654 Points 2k badge 2x thumb
Unfortunately, yeah :\ 

Call to Action and CSTask are still housed in sfdc, but would be tough to replicate for Timeline Activity.

Came close on solving for this in rules engine, but the string functions in bionic rules are limited to string fields. Sounds silly typing that out, but if it was possible to use on a date/time field, you'd be able to use a calculated field with something like: RIGHT(activity_date, 8), and have exactly what's needed.  

Hopefully more formula field functions (and flexibility) become available in MDA and rules engine. Find myself pushing data to GSRelationship and Customer Info in sfdc to use different formulas.

The new stats functions in bionic rules is really helpful though, and I'll probably use them more going forward. 
Photo of Jitin Mehndiratta

Jitin Mehndiratta, Product Manager

  • 3,264 Points 3k badge 2x thumb
Scotty,
As Pele suggested, Adding a Formula/Time field in Opportunity object should solve the problem and the field can be used in rules filters as well as the action criteria. 
What is the use case for adding this field to a Timeline activity/CTA object or any other GS Object?


Regards,
Jitin
Photo of Scotty

Scotty, Champion

  • 2,182 Points 2k badge 2x thumb
Hey Jitin!

We are looking at ways to express when migrations happen, or when we plan for them to happen. One of the things we looked at was creating a timeline activity for a migration that we planned. Here's what I would like to have happen:

1. On Monday a team member schedules a migration timeline activity for a customer on Wednesday at 10 PM
2. On Tuesday a team member schedules a migration timeline activity for a customer on Thursday at 2 AM
3. On Thursday morning, I want to automatically set a reminder CTA that these events happened and to check in on the customers. 

If I could get at the time values, I could create logic to say "if it was scheduled between 5 PM yesterday and 9 AM today, create a CTA". 

I could also do other stuff, like have programs that can email the customer the day before their evening or early morning migration. 

Let me know if there are follow ups to this, I'm trying to create efficiency with the team and being able to target when things happen will allow me to unlock the power of the timeline for my team. 

Scotty