How to fix Zapier not showing all Dynamic Dropdown options that are presented in a JSON Array GET API Repsonse? - arrays

I'm building a Zapier app for a platform that has dynamic fields that are specific to the individual user.
My API returns this response using a GET request:
[
{
"title": "003 Best Selling Book",
"id": "d86cbdf41be958336f1221a2211c3f65",
"date": "03/25/2021"
},
{
"id": "b844eaa3da5c476ab7337e83775777e0",
"title": "002 Best Selling Book",
"date": "03/26/2021"
}
]
The response is received by Zapier successfully
Response received by Zapier
but it is only showing the first item in the JSON array.
Only one object in my array shown.
When I go to test my trigger, it only shows me the one object in my array and give me a MISSING VALUE! error.
Missing Value Error in Zapier
Does anyone know how to fix this?
I'm trying to setup a Dropdown Type that is Dynamic and uses a Trigger to get the JSON object that populates the trigger.
A screenshot of the settings for the my dropdown from the Form Editor on the Zapier Platform Input Designer
I tried looking for example code in the Zapier Github or elsewhere on Stackoverflow or the web that showed example JSON responses for Zapier Actions, Zapier Triggers and Zapier Dynamic Dropdowns but couldn't find any.

Per the docs, your returned JSON needs name and id properties.

Related

How to create JSON object dynamically in Azure Logic Apps?

I have a workflow in Azure Logic App that execute an API call to get custom fields values from Trello card. Then, I put a 'for each' step to get the definition (field name) of every custom field. This is made by calling another method of Trello API. I want to create a JSON object based in the values I've got from these API calls. The format of JSON is as simple as:
{
"name1": "value1",
"name2": "value2",
...
}
Edit:
I have an initial object with this schema:
{
"Cel": "",
"City": "",
"CreatedOn": "",
"Lead": "",
"Mail": "",
"Brand": "",
"Name": "",
"Salesperson": ""
}
It's a simple json object with key:value pairs.
I want to set the object properties inside a for each loop. I got the values of the fields from Trello API (returns an array like):
[{"id":"5fbdb5da1626b7499d690ebf","value":{"date":"2020-11-09T15:00:00.000Z"},"idCustomField":"5fbdb5cee93a775e4a9405e5","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"},{"id":"5fa946e31680220774095ed9","idValue":"5fa9464bd260145aacba03ed","idCustomField":"5fa9462327f2c331a184a483","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"},{"id":"5fa946e0dafc5b7ead25411a","value":{"text":"Lilia Noemi Cabral"},"idCustomField":"5fa9454303ee497b7b99772a","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"},{"id":"5fa946bf8697d18d58b73ac1","value":{"text":"Tania"},"idCustomField":"5fa94518f410418c57662fd0","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"},{"id":"5fa946c3a2ee2771d26ba30e","value":{"text":"tania#gmail.com"},"idCustomField":"5fa945088fc819708d157c5b","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"},{"id":"5fa946bc38b469081857ea9a","value":{"text":"Asuncion"},"idCustomField":"5fa944fe9d7af62b3806c8b6","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"},{"id":"5fa946b82bbaf938c4c3c341","value":{"number":"098234567"},"idCustomField":"5fa944e59527342399f460e2","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"},{"id":"5fa946b32aad4d323ba0648e","value":{"text":"Tania Cardozo Olivera"},"idCustomField":"5fa944d779089c6ca5cf534b","idModel":"5fa53d647b35d5744fd8b856","modelType":"card"}]
I put a for each step to iterate and parse the field value. I got the field name with another call to Trello API, which return this response:
{"id":"5fa94518f410418c57662fd0","idModel":"5f988b8cb225cc7ac34deae9","modelType":"board","fieldGroup":"53eb88d2e4cde013cb9f03e7500ad1a00a4c82f153f9165f7b1ec554f4cc2d74","display":{"cardFront":true},"name":"Name","pos":81920,"type":"text","limits":{"customFieldOptions":{"perField":{"status":"ok","disableAt":50,"warnAt":45}}},"isSuggestedField":false}
So, I matched the idCustomField to get the field name and field value. Now I want to set the property in the initial declared object (each property name is equal to custom field name in Trello)
I've tried using a compose step with:
setProperty(variables('Object'),body('Parse_JSON')?['name'],body('Parse_JSON2')?['text'])
And later set the variable object to the compose outputs, but doesn't work fine. The result object doesn't have all the properties set. My idea is to set all the object properties inside the for each loop.
What could I be doing wrong?
Is there a way to achieve that in Azure Logic Apps?
Thanks in advance!
You should use
setProperty(variables('object'), body('Parse_JSON')?['name'], body('Parse_JSON_2')?['value']?['text'])
instead of
setProperty(variables('Object'),body('Parse_JSON')?['name'],body('Parse_JSON2')?['text'])
================================Update===================================
Your problem may be caused by the "For each" loop run in parallel, so please try with the steps below (Note: if you do this change, when you want to change back, sometimes it will show error message when you click "Save" of you logic app. So please create another logic app for test or make a backup copy of logic app):
Click the "Settings" of your "For each" loop.
Then enable Concurrency Control and set Degree of Parallelism as 1.

Firebase - Targeting Specific Firestore Document Field with Cloud Functions

When using Cloud Functions with the Firebase Realtime Database you are able to target a specific field with a cloud function. For example, given this JSON structure, I could target when user1's email field changed with a ('/user/{userId}/email').onUpdate cloud function.
{
"user": {
"user1": {
"name": "John Doe",
"phone": "555-5555",
"email": "john#gmail.com"
}
}
}
Now with Firestore it seems that I can't target a specific field and can only target documents. If this is the case a Firestore cloud function to target the email field would have to look like this, ('/user/{userId}').onUpdate, and fire every time any document in the user collection changed. This would result in a lot of wasted cloud functions firing. Is this how Firestore works and is there an elegant work around to it?
You are correct, due to the different data models Cloud Firestore only allows you to trigger Cloud Functions on document level events rather than field level.
One method is to store email in a separate document (e.g. in a subcollection called Email), so updating email is tye only change that will fire. This does require you reading an extra document each time you need the email though.
Another similar method is to still have it in the same document, but also write it into the subcollection as a second write to trigger the function. Use email as the doc I'd and have a timestamp field in the document to make it easy to clean up the old document ( select oldest email doc to delete, maybe even in the function)

Firebase master detail while having unique keys ionic

Just started using ionic, angular and firebase. And I'm having an issue creating a master-detail pattern.
What I want to achieve:
Have a list on my page that's being retrieved from firebase database. When clicking on of the listitems it should show the details of the selected listitem.
What I currently have:
I can save data in firebase database through a form. This is my write operation that I want to get and put it in my list. I'm adding the data in the database with push() method of firebase
My problem:
I've flattened the data structured as described in the documentation
MetaData{
2017:{
1x48sdf3617SDf542394:{
name: "someName",
date: "24/01/2017"
}
}
},
fullData{
2017:{
8i89gslsdk617SDf542gsLd:{
name: "someName",
date: "24/01/2017",
comment: "someComment",
required: "true",
...
}
}
}
So in the list, which is the masterpage, I only getting the metaData back. When clicking it should go to the detail page. The detailpage should get the data back from fullData. The problem is how is the mapping between the metadata and the fulldata. because they both have a unique key generated by firebase.
I looked at some other questions, but they don't have this specific issue as they are defining their own unique key. I don't want to do that, would like to use the auto generated key from firebase.
How would I tackle this?
You can achieve your requirement in two possible ways :
Using the same key for metadata and details. You can store the key in a variable and use the same to write the details. your data structure be like
/metadata/someKey/ {your javascript object}
/detail/someKey/ {your detail of metadata}
By referencing it from metadata. In this case your data structure will be
/metadata/someKey/{....., details : someKey1}
/details/someKey1
I found the answer in the documentation. I need to use the update() method. First creating a key, then using that key in multiple places to save the data using the data() method
Check the documentation

Coinbase payment iframe switching api versions

I am setting up my site to use the Coinbase iframe for accepting payments.
I am testing using the sandbox.
Sometimes when I make a payment the callback to my server takes the form:
{
"order": {
"id": "YDWALXJW",
"uuid": "2a6de442-be7b-5517-9b49-f00908460115",
"resource_path": "/v2/orders/2a6de442-be7b-5517-9b49-f00908460115",
"metadata": null,
"created_at": "2015-12-06T16:58:02-08:00",
"status": "completed",
...
and other times it looks like this:
{
"id": "f08d1f11-27f9-5be2-87fd-e086d1b67cab",
"type": "wallet:orders:paid",
"data": {
"resource": {
"id": "309a20df-a8e6-532d-9a2b-3ce5ea754d6d",
"code": "52N6TG58",
"type": "order",
...
I realize this is probably just api v1 vs v2, but I don't understand why it seems to be randomly switching back and forth. Any ideas of how to make it just use v2?
Thanks.
Most likely you've entered the same URL as both a Notifications (v2) and Callback (v1) URL.
This is easy to do, given that there are 3 different places in the UI where you can provide either or both the callback/notifications URL.
Merchant Settings Page
Your API Key's Edit form
The Merchant Tools Generator
You'll receive a POST message for each place you've entered this URL. (I was able to get 5 unique POSTs in my testing!)
The right place to include the URL depends on your situation:
If you just want merchant notifications (paid orders, mispaid orders and payouts), put it in the Merchant settings page.
If you are building an app with functionality beyond merchant tools, and want a broader set of wallet notifications, put it in your API Key's Edit form.
For Merchants I would generally not recommend entering the URL for a button generated via option 3. Based on the title of your question, I'm guessing this is your situation.
You won't be able to view or edit this setting in the future. If you're re-using a static button that you've previously generated, and think that you've included a URL there which you'd like removed, you'll need to replace the button by generating a new one.
I hope that helps!

Customising the JSON generated by EXT-JS

I am using EXT-JS 3.2.0 and I have an Ext.grid.EditorGridPanel backed by a Ext.data.Store object. The store has the restful flag on and uses Ext.data.JsonReader and Ext.data.JsonWriter. It works great for retrieving data and populating the grid. However, when I add or update a record, the JSON produced for the POST/PUT has the data nested under a root field. This is not matching up with what the service I am calling expects. It wants a flat object. For example, when I add or update a record, the JSON produces looks something like this:
{
"data": {
"name": "TEST",
"id": "-1"
}
}
But I need it to be
{
"name": "TEST",
"id": "-1"
}
Any ideas?
Thanks,
John
I don't know if it's the best approach but I ended up creating my own Ext.data.Connection object and making the request where I needed it, for example on the delete. Not the solution I was hoping for but it works.

Resources