Skip to main content

Posts

Featured

GlideRecord Pass By Reference Demo

Have you ever needed help understanding why GlideRecord.field_name and GlideRecord.getValue('field_name') can behave differently? This is a simple script that demonstrates why it's important to use getters, especially when working with arrays. Simply run it in your browser console. var obj = {     field : {         value : 0     },     next : function () {         if ( obj . field . value < 10 ) {             obj . field . value ++;             return true ;         }         return false ;     },     getValue : function ( field_name ) {         if ( obj . hasOwnProperty ( field_name ) && obj [ field_name ]. hasOwnProperty ( 'value' )) {             return obj [ field_name ]. value . toString ();         }         else {             return '' ;         }     } }; var refarr = []; var valarr = []; while ( obj . next ()) {     refarr . push ( obj . field );     valarr . push ( obj . getValue ( 'field' )); } console . log

Latest Posts

Advent of Code 2022

Duplicating rows in an MRVS

ACLs are like a lock and key

Welcome!