# Create rows in different tables, but grab the rowID of first one and put it into the second row

**URL:** <https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353>\
**Category:** Ask for Help\
**Created:** [July 12, 2022, 8:23pm UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353 "2022-07-12T20:23:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 12, 2022, 8:23pm UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/1 "2022-07-12T20:23:58Z")

</div>

Hi guys,  
When customers push complete order, I would like:  
A row to be create in table XXX

A row to be created in table YYY  
But in this row, grab the ROWID of the row just created in table XXX and add it into this second row to connect the two.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 12, 2022, 9:03pm UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/2 "2022-07-12T21:03:40Z")

</div>

I think what would work better would be to generate a Unique ID when you are navigating to the screen that contains your button. Then when you click on your button you can write that unique ID to your two tables.

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 12, 2022, 10:31pm UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/3 "2022-07-12T22:31:57Z")

</div>

is there a column type that creates a unique ID (like a RowID)? All I see is “random number” but I don’t think it is unique.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 12, 2022, 10:35pm UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/4 "2022-07-12T22:35:18Z")

</div>

> **[Unique identifier](https://docs.glideapps.com/all/topics/values/special-values/unique-identifier)**
>
> Submit a unique id

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 12, 2022, 10:39pm UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/5 "2022-07-12T22:39:43Z")

</div>

It all depends on how you get to the screen that contains your button, but in many cases, you can create a custom action that first uses a set column action to set the unique id, followed by a show detail screen or whichever method you are using to get to the screen with the button.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 12, 2022, 10:41pm UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/6 "2022-07-12T22:41:55Z")

</div>

Something like this.

> [@Create a new row and inmediately open in a new windows](https://community.glideapps.com/t/create-a-new-row-and-inmediately-open-in-a-new-windows/43516/2):
>
> The only way to do it would be to do this set up / custom action: Set up: User specific “Temp ID” column Single relation “Relation to ID” column from the Temp ID column to a ID column in the table where the new row is added Custom Action on the Button: Set column action \> unique value to a user specific column Add row action that adds the Temp ID to the ID column along with any other data you want to prepopulate Show Detail Screen \> Relation to ID

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 13, 2022, 12:05am UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/7 "2022-07-13T00:05:43Z")

</div>

that worked! i knew i saw it somewhere before.

My custom form has a “review order” button so i am able to write the unique value at that time.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [July 14, 2022, 12:05am UTC](https://community.glideapps.com/t/create-rows-in-different-tables-but-grab-the-rowid-of-first-one-and-put-it-into-the-second-row/44353/8 "2022-07-14T00:05:44Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
