Marc
10/31/2024, 1:15 PMdepartment
field on a currency revaluation record using SuiteScript 2.0. I am using the record.submitFields
method in a scheduled script to update this field, but it does not seem to apply the change. Other fields, such as smemo
, are updating successfully, so it appears there might be a restriction specific to department
on this type of record.Marc
10/31/2024, 1:15 PM```define(['N/search', 'N/record'], function (search, record) {
function myScript(context) {
try {
var useSearch = search.load({ id: 'customsearch_testing_cr' }); // Saved Search ID
var mResultsSet = useSearch.run();
var useSearchResult = mResultsSet.getRange({ start: 0, end: 1000 });
for (var abc = 0; abc < useSearchResult.length; abc++) {
try {
var results = useSearchResult[abc];
var useId = results.id;
var useRecType = results.recordType;
record.submitFields({
type: useRecType,
id: useId,
values: { department: 1 } // Updating 'department'
});
} catch (exp2) {
log.error({ title: 'Loop Error:', details: exp2 });
}
}
} catch (exp) {
log.error({ title: 'Script Error:', details: exp });
}
}
return { execute: myScript };
});```
verikott
10/31/2024, 1:55 PMMarc
10/31/2024, 1:57 PMMarc
10/31/2024, 1:58 PM