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" }, ] }, ] }
3 Replies
Baptiste
Baptiste10mo ago
why are you using filter here? Can't you trigger the filter directly with your request parameters?
LuizAlves
LuizAlves10mo ago
@Baptiste Do you mean I´d make the filtering on backend?
Baptiste
Baptiste10mo ago
Yes, that's definitely how it should be done! If possible?
Want results from more Discord servers?
Add your server