Share feedback, ideas and get community help

Updated 3 months ago

Ho to get a value from webhook based on other value.

Hi, I have a webhook returning something as:
I´d like to get the DOCUMENT_ID and DOCUMENTNAME after I collect the COMPANY_ID

I am using the next code to get the and save in a variable, but I get no look:

data.Database.filter((el) => el.COMPANY_ID == {{ r_menu_sel_clube }}).flatMap((item) => item.COMPANYDOCS.flatMap((doc) => doc.DOCUMENT_ID + "-" + doc.DOCUMENTNAME))

{ "Database": [ { "ASSOCIADO_ID": 2494, "COMPANY_ID": 5, "COMPANYDOCS": [ { "LINE": 1, "DOCUMENT_ID": 43, "DOCUMENTNAME": "Declaração LALAL" }, { "LINE": 2, "DOCUMENT_ID": 11, "DOCUMENTNAME": "Declaração PAPAP" }, ] }, { "ASSOCIADO_ID": 14297, "COMPANY_ID": 6, "COMPANYDOCS": [ { "LINE": 1, "DOCUMENT_ID": 43, "DOCUMENTNAME": "Declaração AA" }, { "LINE": 2, "DOCUMENT_ID": 11, "DOCUMENTNAME": "Declaração CC" }, ] }, ] }
B
L
3 comments
why are you using filter here? Can't you trigger the filter directly with your request parameters?
@Baptiste Do you mean I´d make the filtering on backend?
Yes, that's definitely how it should be done! If possible?
Add a reply
Sign up and join the conversation on Discord