Update Last Modified and By fields on Custom Record when a Note is Saved using a Script
Published on
August 31, 2023 at 9:19:03 AM PDT August 31, 2023 at 9:19:03 AM PDTst, August 31, 2023 at 9:19:03 AM PDT
Scenario
On a Custom Record, when a Note is created and saved on the Notes tab, User Notes subtab, the Last Modified Date and By fields do not get updated.
Solution
AScriptmay be used to update theLast ModifiedandByfields to the Date, Time, and User that theNoteon aCustom Recordwas submitted on and by.
TheTypeofScriptthat may be used isUser Eventutilizing theAfter Record Submit Functiondeployed on theNoterecord.
ACustom Field(possibly ofHidden Display Type) can be set up on theCustom Record. This field will be updated on the record when theNoteis submitted and will result in theLast ModifiedandByfields also being updated.
- CreateCustom Field
- Navigate toCustomization>Lists, Records, & Fields>Record Types
- In theEditcolumn, click on the Name of theCustom Record Type
- Notice values for the below fields:
- ID
Example:customrecord_test - Internal ID
Example:123
- On theFieldssubtab, clickNew Field. Once a New Custom field page opens up, enter the following details:
- Label:EnterLabel
Example:Note Saved
- ID:_noteupdated
- Type:Check Box
- Store Value:EnterCheckmark
- Displaytab:
- Display Type:Hidden
- Click Save
- Navigate toCustomization>Scripting>Scripts>New
- ClickPlus-signbutton
- Attach From:Computer
- Folder:EnterFolder
Example:SuiteScripts - Select File:ClickChoose File
- Select JavaScript file saved on your Computer with below sample code (with relevant field IDs)
Example JavaScript filename:updateLastModified_afterSubmit_UE.js - ClickSave
- ClickCreate Script Record
- ClickUser Event
- Name: EnterName
- Example:Update Last Modified after Note Saved
- Scriptstab:
- After Submit Function:updateLastModified_afterSubmit
- Deploymentstab:
- Applies To:Note
- Deployed:EnterCheckmark
- Status:Testing/Released
- ClickAddon the line
- ClickSaveon the Script
Example JavaScript fileupdateLastModified_afterSubmit_UE.js: