Inline Editing (xedit) as a User Event Type

To set a user event script to execute in response to an inline edit field change or a mass update, specify xedit as the type argument in your script. The xedit type can be specified in beforeSubmit or afterSubmit user event scripts.

The following sample shows a user event script that will execute when a user inline edits a record, or the record is updated in a mass update. This script shows how to get all fields that were inline edited on the record or during the mass update.

function getUpdatedFields(type)
{
   // if the record is inline edited or mass updated, run the script
   if (type == ' xedit ')
   {
      // call nlapiGetNewRecord to get the fields that were inline edited/mass updated
      var fields = nlapiGetNewRecord().getAllFields()

      // loop through the returned fields
      for (var i = 0; i < fields.length; i++)
      {
         if (fields[i] == 'phone')
            nlapiSetFieldValue('phone', nlapiGetFieldValue('phone'))
      }
   }
}

Leave a comment

Your email address will not be published. Required fields are marked *