Trying to populate an order number in my app directly from a SendGrid email

I’m trying to improve on a part of my app where users (including “Guest Users” who don’t have an account) search for orders. Currently they get an email (Created in SendGrid) that contains an order number then, to see further order details, they have to click a button in that email which takes them to my “Order Search” Page where they have to enter the order number into a SearchBox and then the app will load all the order details. This isn’t ideal from a UX perspective.

I want them to go to be able to click the button in the email and have it navigate directly to the Order Search page and automatically populate the search box with the Order Reference and load the details but I can’t work out how to do this. Just to add a little spice, the User may or may not have an account/be logged in at the time they click the button in the email.

I’ve been trying to edit the link on the button in SendGrid so that it contains a parameter that includes the order number but I don’t really understand how to construct the link address.

Can anyone put me on the right track? I’d be so grateful.

Hey there,

Yep, just add a url parameter to the link in the email like:
website.com/orders?order=31726931876

Then pull that url parameter into your search field on the page :slight_smile:

*edit

Sorry just re-read that second last point. Okay so its more so how to construct the sendgrid side.

How is sendgrid currently set up? where do the order numbers come from? this should be a variable which can be used within the link I believe?

Many thanks for this. I’ll have a play with it and report back if that’s OK.

Regarding SendGrid setup

Currently when an order is made, Order confirmation details are emailed to the user. These include an OrderNumber for which there’s a parameter created in the WorkFlow that sends the email. It’s also possible to nominate someone to go and collect an order however so you can have the order emailed to them. That person might not have a log in so I need them to be able to receive the email (that’s easy) but I would like them to be able to hit the button in the email and have it take them straight to a screen that shows them the Order. Under my app’s present design this will require populating a search box on that page with the Order Number that comes from the parameter in the SendGrid email.

I don’t know if that makes sense. If it doesn’t I apologise and I’m happy to clarify.

Thanks for reading this far though.
All the best

Yep that all makes sense.

So your next steps should be:

  • add order number url param to link in email
  • pull param on page load and display order info

If you’re wanting to make the order info public, just ensure your privacy rules are only exposing data that should be public.

Hope that all makes sense?

Cheers,