Jira Code: AKS-19
Based on the Inactive field value the Status will be added near to the title.
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
/**
*
* This User Event Script to Display the Status of the Contact.
*
*/
/*******************************************************************************
* AKS-19 UE Add Inactive Status to Contact
*
* NetSuite Name :AKS-19 JJ UE Add Inactive Status
*
********************************************************************************
* Date: 15-10-2018
*
* Author: Jobin & Jismi IT Services LLP
*
******************************************************************************
**/
define(['N/file', 'N/url', 'N/search', 'N/runtime', 'N/record', 'N/https', 'N/ui/serverWidget', 'N/email'],
function(file, url, search, runtime, record, https, serverWidget, email) {
var main = {
beforeLoad: function(scriptContext) {
log.debug("scriptContext.type ", scriptContext.type);
var records = scriptContext.newRecord;
var statusupdate = scriptContext.form.addField({
id: 'custpage_inlinefield',
type: serverWidget.FieldType.INLINEHTML,
label: 'HiddenHTML'
});
var status=records.getValue({
fieldId: 'isinactive'
});
log.debug("status",status)
if (status==true) {
statusupdate.defaultValue = '<script>jQuery(".uir-page-title-secondline").append("<div class=uir-record-status> InActive</div>")</script>';
} else {
statusupdate.defaultValue = '<script>jQuery(".uir-page-title-secondline").append("<div class=uir-record-status> Active</div>")</script>';
}
},
};
for (var key in main) {
if (typeof main[key] === 'function') {
main[key] = trycatch(main[key], key);
}
}
function trycatch(myfunction, key) {
return function() {
try {
return myfunction.apply(this, arguments);
} catch (e) {
log.debug("e in " + key, e);
}
}
};
return main;
});