I want to use Auto Increment Numbering in ContactMiniPage. I have earlier implemented for Contact edit page but, for Adding a contact I have a Contact Mini Page so I tried below same code in that:
onEntityInitialized: function() {
this.showInformationDialog("on Entity initialization");
// onEntityInitialized method parent realization is called.
this.callParent(arguments);
// The code is generated only in case we create a new element or a copy of the existing element.
if (this.isAddMode()) {
this.showInformationDialog("inside add or copy");
// Call of the Terrasoft.BasePageV2.getIncrementCode base method, that generates the number
// according to the previously set mask.
this.getIncrementCode(function(response) {
// The generated number is stored in [Code] column.
this.set("UsrPatientID", response);
});
}
}
But, I am getting an error like: this.getIncrementCode is not a function.
Please advise.
Like
The getIncrementCode method does not exist in the mini page. You can try to add it on your own. I would do that in the following way.
define("AccountMiniPage", ["AccountMiniPageResources", "AddressHelperV2"],
function() {
return {
entitySchemaName: "Account",
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
messages: {},
mixins: {},
methods: {
getIncrementCode: function(callback, scope) {
var data = {
sysSettingName: this.entitySchemaName + this.getIncrementNumberSuffix(),
sysSettingMaskName: this.entitySchemaName + this.getIncrementMaskSuffix()
};
var config = {
serviceName: "SysSettingsService",
methodName: "GetIncrementValueVsMask",
data: data
};
this.callService(config, function(response) {
callback.call(this, response.GetIncrementValueVsMaskResult);
}, scope || this);
},
getIncrementNumberSuffix: function() {
return "LastNumber";
},
getIncrementMaskSuffix: function() {
return "CodeMask";
},
testMethod: function(){
debugger;
this.getIncrementCode(function(response) {
debugger;
});
},
onEntityInitialized: function() {
this.callParent(arguments);
this.testMethod();
}
},
diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
};
});