Hello all,
We get xml shipping notifications for each package of an order. I'd like to take the tracking numbers from each of those xml's and include them in a single email notification to the customer. Not sure how to get started on this one. Any ideas?
Creating a list from multiple xml files
Re: Creating a list from multiple xml files
Have you got an example of the XML format?
My initial thought is that you’d need to use the Assemble job element with a custom assembly scheme so you can trigger a single email
My initial thought is that you’d need to use the Assemble job element with a custom assembly scheme so you can trigger a single email
Re: Creating a list from multiple xml files
Here's a sample of the xml file. Underlined info will change for each package, other info will be common for each order. Number of packages per order will vary.
<?xml version="1.0"?>
<order_status_message>
<internal_order_id>12345678</internal_order_id>
<partner_order_id>OrderID</partner_order_id>
<order_status>Shipped</order_status>
<status_datetime>20230424104520</status_datetime>
<carrier_name>UPS</carrier_name>
<tracking_number>1ZV7V9670399999999</tracking_number>
<ship_method>UG</ship_method>
<merchant_number>55555</merchant_number>
<cobrand_id>Generic</cobrand_id>
</order_status_message>
<?xml version="1.0"?>
<order_status_message>
<internal_order_id>12345678</internal_order_id>
<partner_order_id>OrderID</partner_order_id>
<order_status>Shipped</order_status>
<status_datetime>20230424104520</status_datetime>
<carrier_name>UPS</carrier_name>
<tracking_number>1ZV7V9670399999999</tracking_number>
<ship_method>UG</ship_method>
<merchant_number>55555</merchant_number>
<cobrand_id>Generic</cobrand_id>
</order_status_message>
Re: Creating a list from multiple xml files
I would second mkayyyy but you would probably need to know the number of items in the order as well so Switch know exactly when to stop waiting for additional xml files and moves to sending email.
Re: Creating a list from multiple xml files
Thanks for the input. The number of items will vary. Sometimes it's one box, sometimes it's 20. But they'll all be done at the same time, so I figure waiting for 10-15 minutes should give enough time for all items to process. I can filter by the Order ID so that part is pretty straight forward.
I'm going to make a text file template and use string replace to add the tracking numbers. I think I can get that to work. I was hoping someone had run into this type of thing before and had a better idea.
I'll post a sample of my idea when I get it put together...
I'm going to make a text file template and use string replace to add the tracking numbers. I think I can get that to work. I was hoping someone had run into this type of thing before and had a better idea.
I'll post a sample of my idea when I get it put together...
Re: Creating a list from multiple xml files
I was able to get this working by spreading out the xml files, grabbing an html template, and using string replace to add in the tracking links. After a few minute wait, I use the html template to send the email, then delete it. If anyone has a similar need, PM me and I'll send you a copy of the flow.
- Attachments
-
- Shipping Email.jpg (45.36 KiB) Viewed 7166 times
Re: Creating a list from multiple xml files
Use XML Pickup, then add a row to a Google Sheet, using the Google Sheets Connect app, for each XML file.
Add at least these columns: internal_order_id and tracking_number
Use assemble job to assemble all your XML files into one job
• Scheme: custom
• Job Identifier: internal_order_id (dataset path)
• Number of files: 99999 (something too big)
• Orphan timeout: 15 (or whatever you want)
Then send that job folder to the Google Sheets Connect app and do a lookup values
• Save found line(s) as private data: all with separator
• Selection: use filter
• Condition 1 column name: internal_order_id
• Operator: equal to
• Value: dataset path to internal_order_id
All the tracking numbers will be saved into the private data GSC.tracking_number
Use it in an email or anything you like.
In order to configure Google Sheets Connect, read page 2 of the documentation and follow the movie.
Don’t forget to share your spreadsheet with the client email.
Your flow will be much smaller and simpler! (10 elements including folders)
On top of it, all the job info will be saved into a Google sheet, also available online and from a smartphone or tablet.
You can also share that sheet with your customer.
Sure you can do something with that, and extend the many possibilities to other projects.
Add at least these columns: internal_order_id and tracking_number
Use assemble job to assemble all your XML files into one job
• Scheme: custom
• Job Identifier: internal_order_id (dataset path)
• Number of files: 99999 (something too big)
• Orphan timeout: 15 (or whatever you want)
Then send that job folder to the Google Sheets Connect app and do a lookup values
• Save found line(s) as private data: all with separator
• Selection: use filter
• Condition 1 column name: internal_order_id
• Operator: equal to
• Value: dataset path to internal_order_id
All the tracking numbers will be saved into the private data GSC.tracking_number
Use it in an email or anything you like.
In order to configure Google Sheets Connect, read page 2 of the documentation and follow the movie.
Don’t forget to share your spreadsheet with the client email.
Your flow will be much smaller and simpler! (10 elements including folders)
On top of it, all the job info will be saved into a Google sheet, also available online and from a smartphone or tablet.
You can also share that sheet with your customer.
Sure you can do something with that, and extend the many possibilities to other projects.
Laurent De Wilde, Solution Architect @ Enfocus
Re: Creating a list from multiple xml files
Thanks for the tips Laurent! I'll check it out.laurentd wrote: ↑Wed May 03, 2023 9:19 am Your flow will be much smaller and simpler! (10 elements including folders)
On top of it, all the job info will be saved into a Google sheet, also available online and from a smartphone or tablet.
You can also share that sheet with your customer.
Sure you can do something with that, and extend the many possibilities to other projects.