Change Fields selection based on current date vs a date in a field

Hello there Bubblers!

So, I have the Thing called policies (contracts). This policies (insurance) are 1 year long. So I created a field for "policies"thing, called “policy_status” which could have only 4 status, but to make it easier for the question, let’s say there are just 2. When it’s OK, and when it’s past due.

So, when I upload a new policy, I set a start date and a finish date

But now, I would like to have one workflow (or system, or whatever) running checking today’s date vs the finish dates. So, when it pasts the finish date, it could change automatically

As you can see in the next image, the status is “ok” because the finish date is still ahead.

And here are policies that are past due, but done by myself. (dates format is different than US because I’m in a spanish speaking country, we switch month and day)


So how could make this happen automatically for every policy?

Thank you all!

When the policy is created (and whenever the end date changes - if it ever changes), schedule an API workflow to set the status to vencida on the end date (schedule date = end date).

ehm… there is any video tutorial on how to do the API workflows?.. (I have no clue what you are talking about)

Let me know where I can read/learn about it and I will try it!

I don’t know of any videos on this, but if you search here on the forums for API Workflow, you should find the information you need. The following should get you started:

  1. Go to the API tab of your app’s settings to enable ‘This app exposes a Workflow API.’ This used to require a paid plan, but I’m not sure if it still does
  2. Go to the API Workflow page of your app and create a new endpoint. Call it set_status_vencida for example. Add a parameter to it of type Policy, let’s call this parameter pPolicy
  3. Add an action to the endpoint to make changes to a policy (pPolicy) - the change is, of course, to set status to Vencida
  4. Now back on your page, in the workflow where a policy is created, after creating the policy, add an action to schedule an API workflow and choose the workflow set_status_vencida. Set pPolicy to the policy you just created (Result of step n create policy).

I hope this helps, but as I said, there is more information here on the forums about this.

Thanks @louisadekoya I did it!

now, just wondering, when I create the policy, I set the API workflow to the expiration date. It’s a common practice in insurance that you extend the expiration date. When I do it, I’m not sure the “workflow schedule date” si binded with the “expiration date”, based it is set only once

How can I auto-bind API Workflow Date and Expiration Date? Or delete and re-schedule the workflow in case there is no possibility?

Thx!!! :slight_smile:

1 Like

Yes, good point. As you say, what you need to do is cancel and reschedule the workflow when the policy is extended before expiration. There is a ‘Cancel a scheduled API workflow’ action for this. You will need to have saved (I suggest on the policy record) the ID for the scheduled instance of the workflow. Don’t forget to update the policy with the new scheduled API instance id. Again, if you search here on the forums, there should be more information on this.

This topic was automatically closed after 70 days. New replies are no longer allowed.