Using an Infoplus Script to perform a custom Bulk Edit

Using an Infoplus Script to perform a custom Bulk Edit

The Bulk Edit function in Infoplus allows you to edit several records at once, but it requires that you put the same values in all records that you're editing at the same time.  


However, you can use an Infoplus Script to perform a custom Bulk Edit, where you can set different values in each record.


Due to the ever-changing nature of writing and maintaining scripts, Infoplus does not provide support in this area. We recommend someone in your IT Department handles scripting requests internally so that you keep all control over the process.


The general idea is:

  1. Create a data structure in your script (a simple javascript object) where you create a mapping between record identifiers (typically Id, or maybe SKU on Items, for example) and the values you want for those records.  
  2. When the script is executed, it will be working on a single record at a time - so you will check if the record in the script is defined in your data structure, then get the value from the data structure, put it in the record, and use the infoplusApi object to update the record.
  3. To perform the bulk edit - go to the Table in Infoplus, find the records you want to edit, select them all (with the checkbox), and use Actions -> Bulk Run Script.

Here's an example of a script doing this, where we are updating UPC values on the Item table:


As an alternative, you may define your data structure as a JSON style object, as in:

var upcMapping = { 
"BASIC1": "123456789012",
"BASIC2": "234567890123",
"BASIC3": "345678901234",
"BASIC4": "456789012345",
"BASIC5": "567890123456"
}

For another alternative approach, you may try Using data from a Google Sheet, where we describe directly accessing the data from a Google Sheet, rather than using a javascript data structure.  


If you are attempting to update a custom field, you will need to use the following:  record.customFields.put("customFieldName", customFieldVariable);  - if you're not sure what the custom field name is, you can run the following code and log the response: var customFieldNames = ${record.customFields}     utils.log("Custom Fields are: " +customFieldNames);