I'd like to use SS2.0 and the 'new' N/ui/message module to display warnings or errors when a user views a record. In reality, I'd like to understand how to run any 2.0 client script code on record view.
I managed an example I can run, which works from the console:
require(['N/currentRecord', 'N/ui/message'],
function(curr, mess) {
var rec = curr.get();
var status = rec.getValue('status');
if (status === 'Unapproved Payment') {
var myMsg = mess.create({
title: "PAYMENT ERROR",
message: status,
type: mess.Type.ERROR
}).show({
duration: 500000
});
}});
Runs fine in edit mode(pageInit or wherever) but haven't found a method to load and execute on 'View'. Is this even possible in 2.0? Do I have to use the 1.0 tricks still?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…