Best answer

Multi-line Filtered Array with Loop

  • 24 October 2023
  • 3 replies
  • 107 views

Badge

Here is what I’m trying to do.  I have created a zap between JotForm and ServiceTitan.  When the customer submits a JotForm and selects the option to do the same as last year, I want to look up last years invoice and have it create a new job.  

I am running into a problem with the step that I update the created job with last years services.  There is an extra step before I can update the invoice where I must define if the charge being added to the invoice is

Service

Material

Equipment

 

Due to this requirement, I need to filter my array by the item type being updated on the newly created job then I was going to create 3 paths based on the item type to update the invoice with the filtered arrays.


I also keep getting an error on the last step that I’m not sure how to resolve. 

 

 

Array Setup - I need to filter this array by Type (Service, Materials, Equipment) but I still need to retain the other 4 properties.

 

 

Here is how the loop is setup.  I need this to be a 3 way path with 3 filters aforementioned filters on the array. 

 

I have to select the Item type before I can populate those actions from the loop.  
I keep getting this error. I assume its because formatter converts number to string and I tried using formatter to convert it back but it didn’t work.  I think its for the Quantity / SKU array properties.
Failed to create an invoice items in ServiceTitan
Bad Request: {"errors":{"id":["Error converting value \"58451537584515389991187876016651193728290712554689265664\" to type 'System.Nullable`1[System.Int64]'. Path 'id', line 1, position 665."],"skuId":["Error converting value \"58451537584515389991187876016651193728290712554689265664\" to type 'System.Nullable`1[System.Int64]'. Path 'skuId', line 1, position 67."],"quantity":["Could not convert string to decimal: 10000000000000000328415624892049260789870125663596116955123134262587470068987879955440013156277274126839495047843224355786484906342114918400. Path 'quantity', line 1, position 601.","Required property 'quantity' not found in JSON. Path '', line 1, position 666."],"itemModel":["The itemModel field is required."]},"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"81b4b4aeb8985b3b-IAD"}
show less

Any help??

icon

Best answer by RichC 24 October 2023, 22:43

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Hi @RichC 

Good question.

The Looping help article states not to use the PREVIEW variables: https://help.zapier.com/hc/en-us/articles/8496106701453-Loop-your-Zap-actions

 

 

 

 

Badge

Thanks @Troy Tessalone.  That got rid of the error at the end.  Any help on creating the array filters? 

Userlevel 7
Badge +14

@RichC 

Try adding Paths within the Looping app.

Each Path has a Filter.