One additional issues I am running into with code to mimic this approach. I have a master table called Opportunity that has children in table Task. For a given opportunity, I want to modify the records in the task table (say delete the completed date for every task related to the opportunity). This technique seems perfect as I planned to grab the record ids for each task after doing a simple API_DoQuery based on related opportunity. Then I will build a csv string and call API_ImportFromCSV. The problem with the code below is that instead of listing each task record id and then a new line, it concatenates all the ids together then does a new line. This is repeated for how ever many tasks I have. The xml returned looks fine, so could it be something with my each loop?
// parentid is the record id of the opportunity
// column 48 is related opportunity
var query2 = "{48.EX." + parentrid + "}";
var clist2 = "3";
// initialize ajax
$.ajaxSetup({data: {apptoken: apptoken}});
// find all task record ids for a certain opportunity
var promise4 = $.get(tbl_tsk,{
act: "API_DoQuery",
query: query2,
clist: clist2
});
// query then build csv string
$.when(promise4).then(function(xml4){
var csv = "";
$(xml4).find('record').each(function() {
csv += $("record_id_",xml4).text() + "/n";
});
console.log(csv);
});