Поле Netsuite изменило значение - PullRequest
0 голосов
/ 08 октября 2019

Как я могу определить, когда значение поля изменяется скриптом? На самом деле у нас есть кнопка и мы обновляем значение поля (я не могу редактировать этот скрипт) в счетах

/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @Autor *****
 * @NModuleScope Public
 * @Company ******
 * @NModuleScope Public
 *
*/

define([ 'N/error', 'N/record', 'N/currentRecord', 'N/log', 'N/runtime', 'N/url', 'N/https' ], function( error, record, currentRecord, log, runtime, url, https ) {

    var handler= {};
    handler.fieldChanged = function ( context ) {
        try{
            var currentRecord = context.currentRecord;
            var  field= context.fieldId
            if(campo='custbody_uuid')
            log.error( 'UUID', currentRecord.getValue({ fieldId: 'custbody_uuid' })) ;
                return;

        }catch(e)
        {
            log.error( 'ERROR_fieldChanged', JSON.stringify(e) );

        }
    }

    return handler;
});

Как я могу обнаружитькогда поле изменилось, но не пользователем?

1 Ответ

2 голосов
/ 10 октября 2019

Не требуется модуль времени выполнения:

if (runtime.executionContext !== runtime.ContextType.USER_INTERFACE) {
    //your code here
}
...