DEVICECYCLE
6 years agoQrew Member
.JS with iol Won't work anymore
Hi,
We are using .js with iol as a part of our application. Now, it doesn't work anymore.
This is a huge part of our application feature that automates our entire system.
under our pages" Tabletmodulev43.js" here is our code
(function() {
var XMLStructuredToObj = function(xml, type) {
var fidToLabel = {};
$("field", xml).each(function() {
var id = $(this).attr("id");
var label = $("label", this).text();
//console.log(id, label);
fidToLabel[id] = label;
});
var data = [];
var record = {};
$("record", xml).each(function() {
record = {};
$("f", this).each(function() {
record[fidToLabel[$(this).attr("id")]] = $(this).text();
});
data.push(record);
});
return {records: data};
};
var dbid = "bkuuybf9b";
var dbidAssetID = "bmuq9d5dj";
var dbidItemDetails = "bpb3hui78";
var apptoken ="t8gsgdut8g28cw2fw7fbek3vw9";
$.ajaxSetup({data: {apptoken: apptoken}});
$.ajax({
url: dbidAssetID,
data: {
act: "API_DoQuery",
query: "{33.EX._fid_19}",
clist: "23.6.19.29.31.30.26",
slist: "23.6.19.29.31.30.26",
fmt: "structured"
},
dataFilter: XMLStructuredToObj
}).then(function(json) {
console.dir(json);
var groups = _.groupBy(json.records, function(record) {
return record["Related Model Numbers"] + "|" + record["V43 - Tier"] + "|" +record["Related Purchase Order / Service Program"] + "|" +record["Asset ID - Item Detail - Related Manufacturer"]+ "|" +record["Asset ID - Item Detail - Related PN ID"]+ "|" +record["Asset ID - Item Detail - Type"]+ "|" +record["Tablet Triage Summary ID"];
});
var csv = _.map(groups, function(item, key) {
return '"' + (key + "|" + item.length).split("|").join('","') + '"';
});
console.log(csv.join("\n"));
$.post(dbidItemDetails, {
act: "API_ImportFromCSV",
clist: "6.7.8.9.10.11.12.13",
records_csv: csv.join("\n")
}).then(function(xml) {
console.dirxml(xml);
document.location.href = "https://tiercycle.quickbase.com/db/bkuuybgji?act=API_RUNIMPORT&id=34&rdr=https%3A%2F%2Ftiercycle.quickbase.com%2Fdb%2Fbkuuybgrq%3Fact%3DAPI_RUNIMPORT%26id%3D16%26rdr%3Dhttps%253A%252F%252Ftiercycle.quickbase.com%252Fdb%252Fbkuz74av2%253Fact%253DAPI_RUNIMPORT%2526id%253D48%2526rdr%253Dhttps%25253A%25252F%25252Ftiercycle.quickbase.com%25252Fdb%25252Fbkuuybgji%25253Fact%25253DAPI_PurgeRecords%252526qid%25253D103%252526rdr%25253Dhttps%2525253A%2525252F%2525252Ftiercycle.quickbase.com%2525252Fdb%2525252Fbkuuybgrq%2525253Fact%2525253DAPI_PurgeRecords%25252526qid%2525253D14%25252526rdr%2525253Dhttps%252525253A%252525252F%252525252Ftiercycle.quickbase.com%252525252Fdb%252525252Fbpb3hui78%252525253Fact%252525253DAPI_PurgeRecords%2525252526qid%252525253D1%2525252526rdr%252525253Dhttps%25252525253A%25252525252F%25252525252Ftiercycle.quickbase.com%25252525252Fdb%25252525252Fbkwue297z%25252525253Fa%25252525253Dq%252525252526qid%25252525253D19";
});
});
})();
We really appreciate if you can help us on this,
------------------------------
Roel David
------------------------------
We are using .js with iol as a part of our application. Now, it doesn't work anymore.
This is a huge part of our application feature that automates our entire system.
under our pages" Tabletmodulev43.js" here is our code
(function() {
var XMLStructuredToObj = function(xml, type) {
var fidToLabel = {};
$("field", xml).each(function() {
var id = $(this).attr("id");
var label = $("label", this).text();
//console.log(id, label);
fidToLabel[id] = label;
});
var data = [];
var record = {};
$("record", xml).each(function() {
record = {};
$("f", this).each(function() {
record[fidToLabel[$(this).attr("id")]] = $(this).text();
});
data.push(record);
});
return {records: data};
};
var dbid = "bkuuybf9b";
var dbidAssetID = "bmuq9d5dj";
var dbidItemDetails = "bpb3hui78";
var apptoken ="t8gsgdut8g28cw2fw7fbek3vw9";
$.ajaxSetup({data: {apptoken: apptoken}});
$.ajax({
url: dbidAssetID,
data: {
act: "API_DoQuery",
query: "{33.EX._fid_19}",
clist: "23.6.19.29.31.30.26",
slist: "23.6.19.29.31.30.26",
fmt: "structured"
},
dataFilter: XMLStructuredToObj
}).then(function(json) {
console.dir(json);
var groups = _.groupBy(json.records, function(record) {
return record["Related Model Numbers"] + "|" + record["V43 - Tier"] + "|" +record["Related Purchase Order / Service Program"] + "|" +record["Asset ID - Item Detail - Related Manufacturer"]+ "|" +record["Asset ID - Item Detail - Related PN ID"]+ "|" +record["Asset ID - Item Detail - Type"]+ "|" +record["Tablet Triage Summary ID"];
});
var csv = _.map(groups, function(item, key) {
return '"' + (key + "|" + item.length).split("|").join('","') + '"';
});
console.log(csv.join("\n"));
$.post(dbidItemDetails, {
act: "API_ImportFromCSV",
clist: "6.7.8.9.10.11.12.13",
records_csv: csv.join("\n")
}).then(function(xml) {
console.dirxml(xml);
document.location.href = "https://tiercycle.quickbase.com/db/bkuuybgji?act=API_RUNIMPORT&id=34&rdr=https%3A%2F%2Ftiercycle.quickbase.com%2Fdb%2Fbkuuybgrq%3Fact%3DAPI_RUNIMPORT%26id%3D16%26rdr%3Dhttps%253A%252F%252Ftiercycle.quickbase.com%252Fdb%252Fbkuz74av2%253Fact%253DAPI_RUNIMPORT%2526id%253D48%2526rdr%253Dhttps%25253A%25252F%25252Ftiercycle.quickbase.com%25252Fdb%25252Fbkuuybgji%25253Fact%25253DAPI_PurgeRecords%252526qid%25253D103%252526rdr%25253Dhttps%2525253A%2525252F%2525252Ftiercycle.quickbase.com%2525252Fdb%2525252Fbkuuybgrq%2525253Fact%2525253DAPI_PurgeRecords%25252526qid%2525253D14%25252526rdr%2525253Dhttps%252525253A%252525252F%252525252Ftiercycle.quickbase.com%252525252Fdb%252525252Fbpb3hui78%252525253Fact%252525253DAPI_PurgeRecords%2525252526qid%252525253D1%2525252526rdr%252525253Dhttps%25252525253A%25252525252F%25252525252Ftiercycle.quickbase.com%25252525252Fdb%25252525252Fbkwue297z%25252525253Fa%25252525253Dq%252525252526qid%25252525253D19";
});
});
})();
We really appreciate if you can help us on this,
------------------------------
Roel David
------------------------------