I was trying to create new invoice on clicking button on case section
Hi Team
I want to create new invoice from case section while click on button.Here the same functioning is using in order section from there i get the code and re-modified that code after re-modified.I am getting the button but i was not redirecting to new invoice creation page.And also in oderpage pagev2 they are using [this.Terrasoft.SysSettings.querySysSettingsItem("CreateInvoiceFromOrderProcess",] some sys settings here i was also created sys settings
but in there default value what we have to mention.
Can you please help on this issue
Here the code;
define("CasePage", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
return {
entitySchemaName: "Case",
attributes: {},
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
methods: {
/**
* @inheritdoc Terrasoft.BasePageV2#getActions
* @overridden
*/
getActions: function() {
var actionMenuItems = this.callParent(arguments);
actionMenuItems.add("CreateInvoice", this.getButtonMenuItem({
"Caption": this.get("Resources.Strings.CreateInvoiceByCaseCaption1"),
"Tag": "onCreateInvoiceClick",
"Enabled": {"bindTo": "canEntityBeOperated"}
}));
return actionMenuItems;
},
/**
* Event handler "CreateInvoice" button click.
* @protected
*/
onCreateInvoiceClick: function() {
if (this.isChanged()) {
this.save({
isSilent: true,
scope: this,
callback: this.createInvoice
});
} else {
this.createInvoice();
}
},
/**
* Returns ProcessModuleUtilitie.
* @protected
* @return {Terrasoft.ProcessModuleUtilities} ProcessModuleUtilities
*/
getProcessModuleUtilities: function() {
return ProcessModuleUtilities;
},
/**
* Queries create invoice from order process id.
* @protected
* @param {Function} callback Callback f-n.
* @param {Object} scope Callback scope.
*/
queryProcessId: function(callback, scope) {
this.Terrasoft.SysSettings.querySysSettingsItem("CreateInvoiceFromCaseProcess",
function(createInvoiceFromCaseProcessValue) {
var sysProcessId;
if (createInvoiceFromCaseProcessValue &&
createInvoiceFromCaseProcessValue.value) {
sysProcessId = createInvoiceFromCaseProcessValue.value;
}
this.Ext.callback(callback, scope, [sysProcessId]);
}, this);
},
/**
* Starts create invoice from order process.
* @protected
*/
createInvoice: function() {
this._updateHistoryState();
this.queryProcessId(function(sysProcessId) {
if (!sysProcessId) {
throw Terrasoft.ItemNotFoundException(
this.get("Resources.Strings.CreateInvoiceFromCaseProcessNotSet")
);
}
this.getProcessModuleUtilitie().executeProcess({
sysProcessId: sysProcessId,
parameters: {
CurrentOrder: this.get("Id")
}
});
}, this);
},
/**
* Updates current history state object.
* @private
*/
_updateHistoryState: function() {
var historyState = this.sandbox.publish("GetHistoryState");
var state = historyState.state || {};
var cardOperation = this.get("Operation");
var isNewModeInHistoryState = this.getIsNewMode(state.operation);
var isNewModeInCardOperation = this.getIsNewMode(cardOperation);
if (isNewModeInHistoryState && !isNewModeInCardOperation) {
state.operation = cardOperation;
state.primaryColumnValue = this.getPrimaryColumnValue();
this.sandbox.publish("ReplaceHistoryState", {
stateObj: state,
hash: historyState.hash.historyState,
silent: true
});
}
},
/**
* Returns whether the page state in append or copy mode.
* @param {String} operation Card operation.
* @return {Boolean} Page state in append or copy mode.
*/
getIsNewMode: function(operation) {
return operation === this.Terrasoft.ConfigurationEnums.CardOperation.ADD ||
operation === this.Terrasoft.ConfigurationEnums.CardOperation.COPY;
}
},
dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"name": "Statusc8f0f413-a97b-4268-a340-3510f42e32a6",
"values": {
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 12,
"layoutName": "ProfileContainer"
},
"bindTo": "Status"
},
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 12
},
{
"operation": "merge",
"name": "ProcessingTab",
"values": {
"order": 0
}
},
{
"operation": "merge",
"name": "SolutionTab",
"values": {
"order": 1
}
},
{
"operation": "merge",
"name": "SatisfactionLevelComment",
"values": {
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 1
}
}
},
{
"operation": "merge",
"name": "CaseInformationTab",
"values": {
"order": 2
}
},
{
"operation": "merge",
"name": "NotesFilesTab",
"values": {
"order": 4
}
},
{
"operation": "merge",
"name": "ESNTab",
"values": {
"order": 5
}
},
{
"operation": "move",
"name": "ResoluitonContainer",
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 0
},
{
"operation": "move",
"name": "ServiceItem",
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 6
},
{
"operation": "move",
"name": "ConfItem",
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 7
},
{
"operation": "move",
"name": "ServicePact",
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 4
},
{
"operation": "move",
"name": "SolutionCaptionProfile",
"parentName": "ResolutionGridLayout",
"propertyName": "items",
"index": 0
},
{
"operation": "move",
"name": "SolutionFieldContainer",
"parentName": "SolutionTab_gridLayout",
"propertyName": "items",
"index": 3
},
{
"operation": "move",
"name": "FirstSolutionProvidedOn",
"parentName": "TermsControlGroup_GridLayout",
"propertyName": "items",
"index": 3
}
]/**SCHEMA_DIFF*/
};
});
Like
Hello Praveen!
The reason why code is not working is in this part http://prntscr.com/noygqb
No value is passed to the function, so error appears in console.
Please debug OrderPageV2 to find how this value should be passed to the function.
Best regards,
Alex