Back to connectors… Back to Other...

Shopify 4.1PU5 - Issue Reading Qty Available from Shopify Inventory (3 replies)

Sue Herrmannn
5 years ago
Sue Herrmannn 5 years ago

(Note: today is my first foray into JSON & Shopify Queries) I'm building an Iman job to update Shopify's inventory for specific items in a specific location. I would like to first query the Shopify inventory, so I can log what the inventory currently is and what it will be. I used the Shopify Reader variant data to pull the item id's. Then built a customlookup in my map event to use the item id to pull the available qty from Shopify inventory for a specific location. 

The api json query that I used successfully to get the inventory info for a specific location/item (minus my Shopify webstore info at the beginning) is:

admin/inventory_levels.json?location_ids=20063715397&inventory_item_ids=19641620398149

Here is my customlookup formula: (ShopHollis = my system connector, available = the field I want to pull from inventory_levels)

CustomLookup("ShopHollis", "/inventory__levels/available",
("/admin/inventory_levels.json?location_ids=20063715397&inventory_item_ids=" & %inventory_item_id), "", "", False)

And here is my error:

Error whilst evaluating field [LookupShopInvQty] on transaction type [Variant]. Resolved Function - CustomLookup("ShopHollis", "/inventory__levels/available",("/admin/inventory_levels.json?location_ids=20063715397&inventory_item_ids=" & "19641620398149"), "", "", False) Error - Description: Object reference not set to an instance of an object.

I've tried a number of things to fix it, but I'm ready to admit defeat. I have the feeling I am way off on this one... Help?  (A jpg of my json query is attached so you can see the available fields/data for inventory_levels...)

https://www.realisable.co.uk/wp-content/uploads/2020/04/shopify_inventory_call.jpg
Sue Herrmannn
5 years ago
Sue Herrmannn 5 years ago

Any ideas on this? Otherwise, I guess I'll have to start digging into how to use the Json Connector reader for this? 

Sue Herrmannn
5 years ago
Sue Herrmannn 5 years ago

My customlookup function for Shopify works until it comes across an item that does not exist in that inventory location. Even though the customlookup function is set to false - i.e. return nothing if there is nothing to return - it still throws an error. I've used 2 formulas to build the customlookup formula so I can fill in the inventory_item_id for the lookup on the fly...

Formula #1 to pull the "from" section of the custom lookup is called %ShopifyLocItemParam and says:

"/admin/inventory_levels.json?location_ids=20063715397&inventory_item_ids=" & %inventory_item_id

Formula #2 for the actual custom lookup says:

CustomLookup("ShopHollis", "/inventory_levels/available", %ShopifyLocItemParam, "", "", False)

ShopHollis is my system connector. This formula actually reads the qty properly from Shopify until it finds an item that doesn't exist in that inventory location and then it throws an error:

Error whilst evaluating field [LookupShopInvQty] on transaction type [Variant]. Resolved Function - CustomLookup("ShopHollis", "/inventory_levels/available", "/admin/inventory_levels.json?location_ids=20063715397&inventory_item_ids=33050758774846", "", "", False) Error - Description: Object reference not set to an instance of an object.

I've attached two screenshots of the data in my map preview so you can see that it pulled qtys for the items on the first 3 pages and then stopped. I've tried using some form of a conditional formula or another customlookup to get around it, but wherever the item doesn't exist, it errors. So I can't seem to build anything that says: If it doesn't exist in this inventory location, ignore the item or return a blank...

Help? I feel like I'm soooo close...

Support
5 years ago
Support 5 years ago

Sue, apologies we didn't see your original post(s).

I think if you alter the second parameter from:

/inventory_levels/available

to:

/inventory_levels[]/available

Contact

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Request Demo

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Access Downloads

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close