This message was deleted.
# suitescript
s
This message was deleted.
d
Hm. Is it context.newRecord.id? Or am I misunderstanding the question?
u
that doesn't seem to work, which is odd considering I've used this exact same pattern in other scripts before. for context, here's how I've applied it:
Copy code
function beforeLoadFunc(context) {

 var idcheck = context.newRecord.id;
 var rec = record.load({
   type:"customrecord_test",
   id: idcheck
 });
 var recfield = rec.getValue({
   fieldId:"custrecord_testbool"
 });

 if(context.type == context.UserEventType.VIEW
      && recfield == true) {
     //button is displayed
 } else {
     //button doesn't show
 }
}
I know I can't use currentRecord as that's a ClientScript-only module. Maybe I'm missing something?
j
Something weird is going on…..
context.newRecord.id
should work in beforeLoad
what happens if you just add a
log.debug({title: 'id', details: idcheck});
in there?