Each of these Extensibility Framework options works alone. However, the system will only permit one per screen. I do not understand how to blend them together so they both work. My many attempts have failed. Any insight would be greatly appreciated.
EF 1 ---------
Ext.define('EAM.custom.external_wsjobs', {
extend : 'EAM.custom.AbstractExtensibleFramework',
getSelectors : function () {
var me = this;
var vUser = EAM.AppData.getInstallParams().get("user");
var vDate = new Date();
console.log('variables');
return {
'[extensibleFramework] [tabName=HDR][isTabView=true] ' : {
before_eam_beforesaverecord : function (field, lastValues) {
{
var vFormPanel = EAM.Utils.getCurrentTab().getFormPanel();
var vFocus = this,
vFormPanel = vFocus.getFormPanel(),
vStatus = vFormPanel.getFldValue('workorderstatus');
console.log('before_eam_customonblur');
if (vStatus === 'CL') {
console.log('in IF');
vFormPanel.setFldValue('udfchar08', vUser,true); // Completed by
vFormPanel.setFldValue('udfdate03', vDate,true); // Completed Date
}}}}}}});
EF 2 ---------
Ext.define('EAM.custom.external_WSJOBS', {
screenxtype: {
screendesigner: false
},
extend: 'EAM.custom.AbstractExtensibleFramework',
getSelectors: function () {
var efc = this;
var appData = EAM.AppData.getAppData();
var selectors = {
'[extensibleFramework] [tabName=HDR][isTabView=true] [name=workorderstatus]': {
change: function(a,newStatus,oldStatus) {
var p = a.formPanel.getCurrentTab();
var values = p.getFldValues(["workordertype"]);
if (newStatus === 'C' && values.workordertype === 'BRKD') {
EAM.Builder.setFieldState({failurecode: 'required'}, EAM.Utils.getCurrentTab().form.getFieldsAndButtons());
} else if (oldStatus === 'C' && newStatus !== 'CL' && values.workordertype === 'BRKD') {
EAM.Builder.setFieldState({failurecode: 'optional'}, EAM.Utils.getCurrentTab().form.getFieldsAndButtons());
}
}
},
'[extensibleFramework] [tabName=HDR][isTabView=true]': {
beforerender: function(a,b,c){
if (a.xtype === 'sdrecordview') {
return;
}
var saveBtn = this.getScreen().getMainToolbar().getSaveButton();
saveBtn.on('click', function(a, b){
var status = Ext.ComponentQuery.query('[name=workorderstatus]')[0].getValue();
var jobtype = Ext.ComponentQuery.query('[name=workordertype]')[0].getValue();
var failurecode = Ext.ComponentQuery.query('[name=failurecode]')[0].getValue();
if (status === 'C' && jobtype === 'BRKD' && failurecode === '') {
EAM.Messaging.showError(EAM.Utils.String.format("Failure Code is required on completion of Corrective Maintenance work orders."));
return false;
}});
}}}
return selectors;
},
log: function (msg, args) {
// check if we have efc.log available
if (typeof console === "object" && console.log) {
// call the native log call
if (typeof args === 'undefined') {
console.log(msg);
} else {
console.log(msg, args);
}}}});