Edit row and set [Status] column value

I am making a calendar form to set a visit schedule. but if a reschedule is needed, I do not know whether to use LINKTOFORM(), Edit this row, or Copy this row and edit the copy. New and updated schedules are on one table.

I plan to set the old schedule's [Status] column to "CANCELLED" if there are changes in [Code], [Date], and/or [Time] and the copy to "RESCHEDULED". I also made an automation where the condition is when there are changes because reschedules need approval. What should I do to make this work?

I have 6 values under [Status]: UPCOMING (for new schedule before the date), HAPPENING (date and time = today), DONE (when today() +1 and time is midnight/reset), CANCELLED (if new date and time set), RESCHEDULED (for approval), and REJECTED (if button/action rejected is selected)

0 2 142
2 REPLIES 2


@eyadiii wrote:

plan to set the old schedule's [Status] column to "CANCELLED" if there are changes in [Code], [Date], and/or [Time] and the copy to "RESCHEDULED". I also made an automation where the condition is when there are changes because reschedules need approval. What should I do to make this work?


You would want to create a GROUPED action. 

The first action would set the original appointment to "CANCELLED".  If you need to add a note as well then a good way to handle that is with the INPUT() function which will open a popup Form to ask for the note.

In the second action I would use the LINKTOFORM() function.  This allows the app to pre-set each field on the Form.  Basically, copy all the fields EXCEPT the status which you would pre-set to "RESCHEDULED".  When the Form opens, the user can then fill in any other details that cannot be pre-set such as a Note.

IF, you do not need ANY user input on the RESCHEDULED appointment row, then you can create the new row silently.  For that you would use the action type of "add a new row to another table using values from this row" instead of the LINKTOFORM() function.

I hope this helps!

 

My [Status] column is now an Enum virtual column, since I do not exactly need it on Gsheets and virtual columns do not get called out on Actions. I just need it as an indication.

App formula of the column:

IFS(
AND([Date] >= TODAY(), [Time] > TIMENOW()), "UPCOMING",
AND([Date] = TODAY(), [Time] = TIMENOW()), "HAPPENING",
[Date] < TODAY(), "DONE",
OR(
[_THISROW_BEFORE].[Route Code] <> [_THISROW_AFTER].[Route Code],
[_THISROW_BEFORE].[Date] <> [_THISROW_AFTER].[Date],
[_THISROW_BEFORE].[Time] <> [_THISROW_AFTER].[Time]
), "RESCHEDULE FOR APPROVAL", TRUE, "REJECTED")