How to update item's custom field using suitescrip...
# suitescript
m
How to update item's custom field using suitescript.
w
Why not do a mass update?
Do you need to update the value in a custom field on all item-records?
Spambot?
m
yes bro exactly this is what i want but i want to do with suitescript.
w
Ok, your options are a map/reduce, scheduled or mass update script.
m
mass update script
There are some good examples there.
m
let me share with you something
define(
[ 'N/search', 'N/record', 'N/cache', 'N/format', 'N/https' ], function (search, record, cache, fmt, http) { function updateRecord(context) { try { const id = context.recordId; const type = context.type; const values = context.values; const options = context.options; return JSON.stringify(record.submitFields({ id: id, type: type, values: values, options: options || {} })); } catch (err) { log.debug({ title: 'PUT', details: JSON.stringify(err) }); return JSON.stringify(err); } } return { post: updateRecord }; });
do you think this will work
calling outside
w
So that is a RESTlet-script.
I'm not skilled enough to just be able to say that it works... but it looks like it could work.
m
Thanks Tomas