Is there a way to do this on submit I want to user to open a url with data passed over from the recordId.
Doing what I did below didn’t work.
My goal is to get to a stripe payment link from a form using the recordId in the url so I know where the payment comes from. If there is another way to do it please let me know :).
I want my user to fill out a form then pay and I know where it comes form.
Hey @Lev Thanks a lot for reaching out! I assume you are sending to a webhook correct?
And your goal is to pass the record ID that is located inside the URL and open a new page with the same record ID in it?
I essentially want to go from a conditional form to a stripe payment. Knowing which record they came from since they need to open that record to fill the form. Which is why I’m using the recordId.
Hey again @Lev I was still thinking about this case and was eager to find a workaround, what I did is that I implemented a custom code that passes the record ID parameter inside the current URL to an external URL.
I am not 100% sure if it would be helpful for your case however here is what I did.
First I navigated from a list to a page where there is a list detail block(so we can have the recordID) plus a form block.
Second I implemented this code on the form page’s custom code header section.
<script>
window.addEventListener('submit-form-success-form1', (e) => {
// Extract the Record ID from the current URL
const currentUrl = window.location.href;
const recordIdMatch = currentUrl.match(/recordId=([a-zA-Z0-9]+)/); // Adjust regex based on your URL structure
const recordId = recordIdMatch ? recordIdMatch[1] : null;
if (recordId) {
// Define the external URL
const externalUrl = 'https://example.com'; // Replace with your external URL
// Append the Record ID as a query parameter
const urlWithRecordId = `${externalUrl}?recordId=${recordId}`;
// Open the external URL
window.open(urlWithRecordId, '_blank'); // Opens in a new tab
console.log('Record ID passed to external URL:', recordId);
} else {
console.error('Record ID not found in the URL.');
}
});
</script>
In the code you need to mention the external URL you need to open and after form submission it will automatically open that URL + paste the recordID next to it.
Thank you so much that actually helped me out a lot!!! @Andranik
I have another question that should be possible with javascript but I can’t crack it.
I want to replace the the recordId in the link with a value from my airtable record the reason for this is because you can only define the recordId as a param when making a rest api call. The recordId won’t give me the call that I want but if I am able to choose a field from my value once I click on the value in the list to replace the value in recordId with this value I think that would be a work around. Could you help me out.
Hey @Lev I am so glad that my previous reply was helpful for your previous case and that was great to hear!
Now regarding this one, do I get it right that you are trying to replace the recordID in the URL with a another value?
And that value is the respective field’s value of an item that you click on from the list block?
Hey @Lev What about creating a concatenate formula on the source and then use the Open URL action of the List block so each Item will have a predefined formula with the value you want to pass and once clicked they will be redirected to those external URLs.