Inserted Record ID - how to pass between pages

Hi Teodor, could you point me in the right direction on how to do this please.

On page 1 I create a record in the order table. I have read the “how to obtain the inserted record ID” article and I can see that I have {{identity}} available as an action step following the database insert.

I want to pass this ID to page 2 where the detailed items on the order will be created. The ID of the order will then be included in each to the order_detail records.

How should I passing the ID between the pages please ?

How do you want to pass there? On success insert?

Yes that would be fine. On the client side then the record insert gets initiated from a modal which seems to be limiting the available options.

I was therefore using the Database Insert Action Step to capture the {{identity}}

If i understand you right, you insert your record using a modal, right? And you want to redirect to a different page after it’s being inserted?

If that’s the case please do the following:

  • In your server action, enable the output option for the insert step
  • In app connect add the Browser component
  • Select your server connect form, add new dynamic event > server connect > success > browser goto and there you can enter your url with static and dynamic part as:
'static/url.php?id=' + serverconnectform1.data.insert1.identity

the dynamic part you select in the data picker, under form > data > insert > identity …

1 Like

I am having problems building up the expression - what I have is below.

If I use the static URL then the goto works but there are problems when I use the data packer to add the {{identity}} part.

Can you see what is wrong please ?

<form is="dmx-serverconnect-form" id="serverconnectform1" method="post" action="dmxConnect/api/create_order.php" dmx-generator="bootstrap4" dmx-form-type="horizontal" dmx-on:success="browser1.goto('order_build_item.php?ordernum='{{modal_add_order.serverconnectform1.data.insert_order.identity}})">

You have not used the expression as i provided it in my reply.
It must be:

on:success="browser1.goto('order_build_item.php?ordernum=' +  modal_add_order.serverconnectform1.data.insert_order.identity)"

That works :slight_smile:

many thanks

1 Like