We’ve started collecting a second email from our customers at sign-up (think accounting saas emails) and storing it in their profile notes. We did this because some of our customers use two emails and request invoices to be sent directly to their other email, not their primary one.
I’ve managed to pull this second email from the note, but I’m stuck on how to actually send the invoice there. Trying to use this email in the workflow keeps prompting for “get data.” We tried it, but it didn’t work.
So, I simplified it, and it half worked. I used the flow below, and it worked if the Note contains only an email. However, the note will always be like this:
The core problem is that the action requires an order and not a draft order. It will not work with Draft Orders. I think you figured that out in the last post?
The run code problem - the variable outputted is not called “output”. It starts with the step name because you could have 2 steps that output the same variable. Always use “Add a variable” when adding variables via liquid if you want to see the correct syntax. In this case, it’s something like “RunCode.email”
Thanks Paul, yes the draft order wouldn’t work, however I tried using “RunCode.email” with " Order Created" trigger and I ran into this error:
“Run code Value {“email”=>“xxxx@gmail.com”} is of type Hash but should be of type NilClass”
side q: is Run Code the only way to make this workflow function? or is there a more direct method? I mean I tend to overcomplicate things sometimes
Thank you Paul, for your time I really appreciate it. I understand if you decide to leave this post, you’ve already been a great help. I just want to provide an update. I tried matches[0] and got the same error.
Here are two examples I tested all of them got same error as my previous post “Value {…} is of type Hash but should be of type NilClass”"
I use the Run Code to log out the customer tag, and I got the exact same error as shown in the image.
I use the Run code with a Note that has only an email in it, still same exact error in my previous post.
I spent all my GPT-4 tokens on many possible scripts, and I ended up with the same exact error:
Value {“orderId”=>“5749155390000”} is of type Hash but should be of type NilClass
the below images for an example of trying to output the orderID. I thought it should be the most direct task
As for the Log Output step, I believe we are not there yet. We’re still at the Run Code step, although I tried your suggested variable {{ runCode.tag }} and got this error: {“runCode” is invalid. Replace this variable} .. I also tried {{ RunCode.tag }} with the same error.
May I know if Run Code is the only way to make this workflow function using Shopify Flow?
Thanks a TON, Paul, for your patience. I really appreciate your support.
You were right, the problem was using “output” instead of “Output”. The minute I corrected it, everything worked as it should be, even the Run Code process went through without any error
For anyone looking to use the customer profile Note data with their process using Run Code, here is what worked for me: