Reputation: 13
I wish to do .csv import, and have my suitescript run on that data, as if a user was inputting the data from the UI.
define(['N/currentRecord'],
function(currentRecord) {
function saveRecord (){
var objRecord = currentRecord.get();
var imagescheck = objRecord.getText('custitem_imagescheck');
var live=false;
if (imagescheck=='T' ){
live=true;
}
else {live=false;}
objRecord.setValue({
fieldId: 'custitem_live',
value: live,
});
return true;
}
return {
saveRecord: saveRecord
};
}
);
So if I imported the value "True" to the field custitem_imagescheck, the suitescript should act as if the user checked the checkbox and turn the field "custitem_live" to "True".
At the moment, the above code only work via the UI, not during .csv import.
Upvotes: 0
Views: 3075
Reputation: 5286
When you go through the CSV Import Wizard, on the second page you will see Import Options and under the standard radio button choices you will see Advanced Options. Expand the Advanced Options and look at the bottom right where you will see a check-box for the option to "Run Server SuiteScript and Trigger Workflows". Select this option to run User Event scripts etc when you import.
Upvotes: 3