How to Auto create a card(record) in viewB when a new card(record) is created in ViewA?

If I create a card in ViewA, is it possible to have an action to auto create a card in another ViewB using or referencing the data from that card in ViewA as a foundation?

For example, Lets say I create a new Task in TasksView. I want a new Log created automatically in the LogsView that corresponds to this new Task. Is this possible?

Yes. You would do this by attaching a custom Action to the TasksView Form so that when you save the row, the action is executed.

The steps would be:

  1. Create your action on the TasksView row that adds a row to the LogsView table
  2. Attach this action to the “Form Saved Behavior” of you TasksView Form (see image below). If you create the action properly, it will automatically and immediately show in the dropdown list.

2 Likes

I think you could create the same action and also apply it from a bot listening any Adds to a certain table

1 Like

Thanks. This works to copy the new data from TaskView to JobView but if I continue to add columns from Logs, I get an error.

This is what I did where TaskView is replaced with Main_Table
a. Behavior menu > create a new action

When I try to add Log Name to the action, I get an error:

Here is the Log Data:

I just removed the Log ID because it is unnecessary as the add action creates one automatically by default. However, any other columns for Logs error out.

My thoughts are that How would the action know what the entry will be for Log Name as it doesnt exist yet. Maybe I have to create another action to edit the row?
As I think about this, I might try to add a button on the Main_Table card that opens up a Log form which becomes populated with that cards data as a base. Maybe even an inline will work. I will have to read more about inlines to understand.

First, I don’t know what you intend as a value for Log ID. Most developers, simply use the UNIQUEID() function in the Initial Value property, then it is automatically set when a new row is created.

Second, expression like Logs[Log ID] are list expressions so you wouldn’t use them like you are in the action. In this example, the expression returns a list of Log ID’s from the Logs table. Certianly not what you want to assign to a single row.

How are these values determined normally?

If they can be derived automatically, then in this action you would implement the expression to do that.

If these are values that need to be inserted by the user, then you would want to change your action to navigate to the Logs Form using the LINKTOFORM() function. With this function you can pre-populate, in a new row, values that are known and then the user completes the other fields and taps Save to insert the new row.

If this is what you want (and I suspect it is) then try this:

  1. If you intend Log ID to be system assigned, Make sure the Log ID column is set as described in the first point above.
  2. Change the action to type “Data: go to another view within this app”.
  3. Set the Target property to be:
LINKTOFORM("Logs_Form", "Task", [_THISROW].[Task])

If you know what the Log Type is then you could pre-set it as well.

Since the action is already set to the Form Save, nothing more needs to be done.

1 Like

That works great, thanks. However, if I try to do an edit (i.e. Change the task name) afterwards, the create form pops up again instead of the edit form. What would be the best way to address this issue?

I also have found that In gSheets, the task data of the Logs_form no longer reference back to the Task data in Main_Table, like it did before.

There is only one Form. It loads as New or Edit depending on how you launch it. For example if you are clicking the “+” button, it will always load as New. If you are clicking on the already created row OR the Edit icon for a row, it will launch in Edit mode.

If you are seeing something different then please describe how you are launching the Form and include images to show the results.

I used [_THISROW].[Task] in the LINKTOFORM() function because that’s what you were showing in your action to create a new row. If the Key column is different in your Tasks table, then change [Task] for [Key Column Name] - obviously to whatever your key column name really is

1 Like

Thanks, Ill look into these suggestions.

1 Like