I am trying to map a json to big query connector but I need subset of fields from json to map to big query so I wrote a javascript to map them. I am getting a syntax error at for loop. I dont understand why. Is for loop available in application integration`s javascript?. I thoroughly read javascript doc for application integration but it provides limited info. Can I know which version of js it is?? IS there a different way of doing it??
Below is my code to extract allowed fields from salesforce json
function executeScript(event) {
const mapped = {};
//bqColumns is string array variable with all required columns
for(const key in event.getParameter("bqColumns")) {
//loadBq is the input json which needs to be filtered
event.setParameter(mapped.key ,event.getParameter("loadBq").key)
}
//ouput to be loaded to bq table
event.setParameter("new", event.getParameter("mapped"));
}
Hi rish
I can see that on line 6, you should access the mapping as `mapped[key]` instead of `mapped.key`. Which could be causing error. Another thing I noticed is you are setting individual parameters within your loop. I am not sure if that is the intended thing you are trying to do.
Can you share error message that you are getting?
I Just implemented the mapped[key] and I read the doc and it mentioned to use setParamater when setting values. I tried mapped[key] =