Im trying to find a solution to updating a key within a JSON. Ill explain my end goal for the flow:
Webhook from Pipedrive Updated Deal
Search our internal DB which returns a JSON
Update ‘deal’ a json key located at pipedrive.deal
Upload new JSON back to our internal DB
The part Im stuck on is getting the JSON put back together. If there was a setIn function like for javascript variables, this would be trivial. I think part of the trouble Im having could be that Im not working with flat arrays, nor is this an option for returning the data to the DB.
Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.
You can upload images here using the Upload icon in the text editor:
2. Scenario blueprint
Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.
(Note: Exporting your scenario will not include private information or keys to your connections)
Please provide the input and output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
A.
Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.
Thanks for the suggestion, but this I feel like I’ve asked a fairly high level question here. If you had some insight, that would be greatly appreciated
You’ll have to provide some examples for us to help you further. What do you mean by JSON put back together?
I would suggest completing the Make Academy before jumping into building a complete scenario.
If you need specific assistance when you are building a scenario it’s easier to help you then, by providing the information requested in my previous post.
Otherwise, you can also hire a professional by posting in the Professional Services category
Links
Here are some useful links and guides to help you get started and learn more on how to use the Make platform, apps, and app modules —
Ive gone through each of the array functions. I have used lodash omit(), to remove the ‘deal’ key, but now I have no idea how to insert / replace the ‘deal’ with the new data.
So the equivalent method in javascript that I would like to use Make for would be similar to this syntax. The line of code with the setIn function, is where im hung up in make. This is what Im referring to putting it back together with new data
High level JS to describe exactly what would do the trick for me.
var updatedDeal = pipedriveWebhook.data.current // incoming webhook from pipedrive
var myData = queryMyInternalDB.data // my results, based on webhook data lookup
jsonData.setValue(myData) // set the variable state
jsonData.setIn([‘pipedrive’, ‘deal’], updatedDeal) // update the json w/ new pipedrive deal
updateMyInternalDB.trigger(jsonData) // send updated json Data back to my DB