Get the ID of a new entry when it's saved Is there a way to save a new entry with a template form, then pass the ID of that new entry along to the redirect location? 

The use case is, I'm interacting with a scheduling service and want to pass along the new craft entry ID in a query string to their API. The service has a webhook that fires on successful scheduling (and provides an appointment ID). 

Currently, I'm getting the user's email address returned from the API, then assuming that user's most recent section/entry in craft is the one I'm looking for. After that, I can unambiguously handle reschedules and cancellations by referencing the appointment ID.

The form has the following inputs

&lt;input type="hidden" name="action" value="entries/saveEntry"&gt;
&lt;input type="hidden" name="redirect" value="/schedule"&gt;


and I'd like the /schedule page to get a entryId passed into it
If you wanted to do this without having to write your own plugin, you can achieve this with a simple custom route and an extra parameter in your template.

Your hidden fields could look like:

&lt;input type="hidden" name="action" value="entries/saveEntry"&gt;
&lt;input type="hidden" name="redirect" value="schedule/{id}"&gt;


And then in config/routes.php put

'schedule/(?P&lt;id&gt;\d+)' =&gt; 'scheduleTemplate',


When craft saves the entry, it will redirect you to schedule with the ID of the entry that was just saved as the last segment. The custom route will pick up any digit on the end of the url and assign it to a variable called id which you can then use in your templates.

Some behind the scenes clearance, based on your comment  

No they aren't twig variables as the replacement is doing through php (although apparently you can use Twig tags).

When you save an entry the new entry object gets passed in redirectToPostedUrl which, if there is an object passed will call the function renderObjectTemplate in the templates service, this will swap out any {single} or {{twig}} tags with the appropriate attribute and you will get the finished URL returned.

Here are two links to the class reference so you can see what I mean.

The redirectToPostedUrl function

The renderObjectTemplate function