Introduction:
As a developer, one of the key responsibilities is to create intuitive and user-friendly applications and establish efficiencies for the end user wherever possible. One request that we’ve seen come up with different clients is the desire to implement a simple and quick way to track that a document has been revised and to require them to log a note which captures the purpose of the revision in NetSuite and NetSuite tools.
NetSuite has the ability to capture user notes from under the Communications subtab on every document available in the system, however making the entry of a user note mandatory is not available out of the box.
Process Steps:
In order to implement and enforce simple revision notes capture within NetSuite, you can add two custom fields to the main form where revision tracking is required. The first custom field is an integer number type and is used to capture the revision number. The second field is a long text field that is used to capture the revision details which will be used to automatically write a user note to the document when the record is saved.
After you create the custom fields on apply them to the document’s form(s), you can create a simple workflow that includes actions that execute after specific fields are edited.
- Action 1 – Increment the value of the Revision Number field.
- Action 2 – Set the Revision Reason to Mandatory.
Once you have the workflow executing against the document types you want to implement the revision capturing process for, you can add a very basic User Event script that executes afterSubmit to write the new revision note record to the document.
In the below example, we are executing this function using the Quote record in NetSuite, however, you can modify this to work for any transaction or document type where NetSuite contains a user note relationship.
If you are facing any issues in these steps, feel free to contact NetSuite experts, they will be happy to help you in every way possible.
/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
Define (['N/record', 'N/log'], function (record, log) {
function afterSubmit(context) {
var newRecord = context.newRecord;
var quoteId = newRecord.id;
//Load the current record to ensure that you are retrieving the most currently saved values on the document.
var rec = record.load({
type: record.Type.ESTIMATE,
id: quoteId,
isDynamic: true,
});
// Retrieve the values for the Revision Number as well as the Revision Detail
var revision_number = rec.getValue('custbody_revision_number');
var revisionDetail = rec.getValue('custbody_revision_detail');
var entity = rec.getValue('entity');
if(revisionDetail) {
try {
//Create the User Note record
var newUserNote = record.create({
type: record.Type.NOTE,
isDynamic: true
});
// Set field values for the note. Here we are generating a value for the Note’s title that also includes the revision number from the document.
newUserNote.setValue({
fieldId: 'title',
value: 'Revision: ' + revision_number
});
newUserNote.setValue({
fieldId: 'notetype',
value: insert the internal id of the note type you wish to associate to these notes.
});
newUserNote.setValue({
fieldId: 'transaction',
value: quoteId
});
newUserNote.setValue({
fieldId: 'notedate',
value: new Date()
});
newUserNote.setValue({
fieldId: 'entity',
value: entity
});
newUserNote.setValue({
fieldId: 'note',
value: revisionDetail
});
var savedNote = newUserNote.save();
if(savedNote) {
rec.setValue('custbody_revision_detail', null);
rec.save();
}
} catch(error) {
log.debug('error creating project', error);
}
}
}
return {
afterSubmit: afterSubmit
};
});
Benefits of Generating User Notes for Revision Capture:
Implementing an automated user note revision capture process offers several significant benefits, both for users and developers:
- Improved User Experience: By providing users with concise and informative user notes, the overall user experience is greatly enhanced. Users can quickly grasp the essence of a transaction, recent changes, and other vital details without having to delve into complex records or search for information manually. This improves productivity and reduces user frustration.
- Enhanced Data Transparency and Capture: User notes serve as a log of important events and changes within the application. They offer transparency regarding who made a specific change, what the change entailed, and when it occurred. This promotes accountability and helps users understand the context behind data modifications, fostering trust and data integrity.
- Time and Effort Savings: Automating the user note-generation process eliminates the need for manual note creation, saving significant time and effort for users. This process also eliminates several clicks for the end user to enter a standard user note for each transaction.
- Effective Communication and Collaboration: User notes facilitate effective communication and collaboration among users and teams. They act as a shared knowledge base, ensuring everyone stays updated on the latest changes and developments within the application. This promotes seamless teamwork and minimizes confusion or misinterpretation of data modifications.
Conclusion:
Incorporating an automated revision capture system can greatly enhance the usability and efficiency of the application process. By streamlining the process of generating user notes, developers can deliver a seamless user experience, improve data transparency, save time and effort, and foster effective communication and collaboration. Embrace this approach, and watch your application become more user-friendly and productive than ever before!
About Us
We are a NetSuite Solutions Partner and reseller with 30+ years of combined experience. We specialize in implementation, optimization, integration, rapid project recovery and rescue as well as custom development to meet any business need. If you would like more information on NetSuite or are in need of consultation for your project or implementation, feel free to contact NetSuite support.
To Contact Us Click Here