Hi there,
I apologize in advance for the length of this post and if I don't make sense, it is because I'm trying to do this when no users are in the system, so it is late... or early!
I need to update the item class per line item for some transactions. I created a saved search which gives me all the fields I need, however I still have something wrong.
The search criteria narrows the transaction search to the lines i need. I have type, main line = false, class = unassigned, Item:ItemCat = appropriate cats(these all correspond to the classes, just used to give a little more detail per class and is a custom field) and date = on or after 1/1/2010.
The result columns include: Date, type, Internal id (transaction), LineID (linenumber), then a join from the item record item:class. <this join shows me the value to set the line item class.
Here is my latest script, and I've tried many!!
function updateTransLineClass(type)
{
var searchresults = nlapiSearchRecord('transaction', 318, null,null);
for (var SavedSearchLineItem = 0; searchresults != null && SavedSearchLineItem < searchresults.length; SavedSearchLineItem++)
{
var searchresult = searchresults[SavedSearchLineItem];
var internalid= searchresult.getValue('internalid');
var line = searchresult.getValue('line');
var iclass = searchresult.getText('column4')
var record = nlapiLoadRecord('salesorder', internalid);
{
window.status = "Processing: " + SavedSearchLineItem + " of " + searchresults.length;
record.setLineItemValue('item', 'class', line, 'iclass');
nlapiSubmitRecord(record, true);
}
}
alert("All Done");
}
I get an error with every different try concerning the joined result in my search. I can't figure out how to call it. this last one, i tried to using the column number, since I can see, in the debugger when testing, that the information is there in my search result. It shows it as a joined field. I've tried getting that data by using just ('class'), ('class(item)'), ('item:class'). Can anyone tell me how to get the information using correct terminology?? thanks for your help!