Required data not found "order_reference" for a custom flow action on Draft order created

Required data not found "order_reference" for a custom flow action on Draft order created

winterpkvtg
Shopify Partner
6 0 0

I followed the tutorial for creating a custom flow action here. I have a custom flow action called THS Flow Apply Discounts that I want to attach to "Draft order created" and it needs the ID of the draft order. I'm getting an error "Required data not found" though when I try to set up the flow (see screenshot).

winterpkvtg_0-1700002392347.png

 

Here's my shopify.extension.toml file where I put the "order_reference" as a required setting field.

 

 

[[extensions]]
name = "THS Flow Apply Discounts"
type = "flow_action"
handle = "ths-flow-action-apply-discount"
description = "Applies THS discounts to a draft order"
runtime_url = "https://voice-span-tomatoes-stable.trycloudflare.com/flow-action/apply-discounts/execute"

[settings]

  [[settings.fields]]
  type = "order_reference"
  required = true

Am I doing this correctly? Is there something else I Need to do to set up the flow so my custom action can get the order reference from a draft order?

 

 

 

 

Replies 3 (3)

Liam
Community Manager
3108 341 879

Hi Winterpkvtg,

 

It looks like your configuration is correct as you set the order_reference as a required field. However, the error you're experiencing may be due to the fact that the draft order ID is not being passed properly to your custom action.

 

The "Draft order created" trigger should pass the ID of the draft order that triggered the workflow. Make sure that your custom action is correctly configured to receive this ID from the trigger. If the custom action is not receiving the ID, it could result in the "Required data not found" error.

 

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

winterpkvtg
Shopify Partner
6 0 0
Make sure that your custom action is correctly configured to receive this ID from the trigger. If the custom action is not receiving the ID, it could result in the "Required data not found" error.

 

Can you please explain this? I thought that was what I was doing with the order_reference setting field.

winterpkvtg
Shopify Partner
6 0 0

To follow up on this I tested by removing "required" in my settings.fields 

winterpkvtg_0-1700607923035.png

It now sends an order_id in the properties with a null value. I think this might be a bug on the Shopify side.

winterpkvtg_1-1700608043520.png