Update a field value depending on another field value

Hi,

I need to know if is it possible to change/update the value of a field (“Status” field) on a database conditional to another field (“End Date”) in the same data type? For example, if current date/time is > “End Date”, run a workflow to update the value of “Status” field.

Thank you

2 Likes

If you mean as a conditional in a workflow, yes you can do it just as you outlined above - i.e. run a workflow to change the status, but only when the current date is greater than the End Date value.

If you mean you want the Status to change automatically ‘when’ the current date/time becomes greater than the End date, then schedule a backend workflow to run at the End Date to change the value of the Status field.

Yes, I need it to be automatically so it would have to be a backend workflow. How can I do this? Any idea?

In that case here’s what you need to do…

  1. In backend workflows add a new API endpoint, and uncheck the ‘expose as public endpoint’ box.
    You’ll need to add a parameter of the type ‘whatever datatype it is that you want to change the field in’ - unless it’s a ‘user’ datatype, in which case you don’t need to use any parameters.

  2. Add a single action in the workflow to ‘make changes to a thing’ and select the type of thing to make the changes to…

If its a user just select ‘current user’ and if it’s something else then select the name of the parameter that you added in the first step.

On that action, click to add another field and select the field ‘Status’, and enter that value you want to it change to.

  1. Then you just need to schedule this workflow to run on whatever thing it is you want to change, at the date/time stored in that thing’s ‘End Date’ field.

The most likely way you’d want to do that (although it depends on how your app works and how it’s set up), would be to do that in the same workflow that set the ‘End Date’ in the first place.

So wherever that workflow was, after you set the End Date, in the next action schedule the API workflow to run on that thing, on the date/time of that end date.

Then, once that End Date is reached, the workflow will run and change the status field to whatever value you set in the workflow.

It sounds more complicated than it is, but have a go and see how you get on.

Thank you! It works perfect.

1 Like

In case I have in a Data Type (e.g. Product) the Intemcode and the Item name. How in a from when I select the Itemcode to return the corresponding itemname (e.g. in Product I have Itemcode:1100, Itemname: iPhone. When I choose in a form ‘1100’ in the Item code field I want to return ‘iPhone’ in the relevant field.
Thanks

hello,
I am not able to implement this properly what i want when then current date/time is less than the value stored in database it show all the pages properly but if the condition false the other page i have implemented that will only runs .can you please share a loom video of this.
Thanks