RE: In SS2.x, can you set a field value in beforeLoad of a User Event script?

Hello!

 

So in a User Event script in the beforeLoad function I need to set a custom Transaction Body Field value, like this:


var newRecord = context.newRecord;

newRecord.setValue({

fieldId: 'custbody_my_custom_field',

value: true // or false

});

Logging the result of the above, I can see the value change, but it does not persist through the entire page load, and always returns to the default state. I have ‘Store Value’ checked on the field’s setup. So, is it just not possible to set a field value in beforeLoad and have that value persist?

 

Thanks for any help!!

 

mreser Rookie Asked on September 16, 2019 in SuiteScript.
Add Comment
4 Answers

What event mode you want to change the specific custom field.

I tried to change the custom field value in “view” event mode and successfully changed. Using this code block

 

 

var newRecord = context.newRecord;
newRecord.setValue({
fieldId: 'custbody_my_custom_field',
value: true // or false
});

return newRecord.save();

 
Beginner Answered on March 27, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.