Hello,
I would like to implement the same function for the Customer field from Order in Contracts.
I have tried it as described in the link:
Customer lookup on Order section | Community Creatio
But the result is, that the field is empty.
Code:
define("ContractPageV2", [], function() { return { entitySchemaName: "Contract", attributes: { "Client": { "caption": "Client", "dataValueType": this.Terrasoft.DataValueType.LOOKUP, "multiLookupColumns": ["Contact", "Account"], "isRequired": true } }, modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/, details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/, methods: {}, dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/, diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "name": "Client", "values": { "layout": { "colSpan": 12, "rowSpan": 1, "column": 0, "row": 2 }, "tip": { "content": "Test" }, "controlConfig": { "enableLeftIcon": true } }, "parentName": "Header", "propertyName": "items", "index": 4 } ]/**SCHEMA_DIFF*/ }; });
I hope somebody can help me.
Regards,
Oliver
Like
Hello Oliver,
Could you please verify whether the code of the columns is equal to "Account" or "Contact"? If you open the object configuration you will see the code and the display name of the column, this case we need the code. It could be that your columns are called UsrAccount or UsrContact.
Also, could you please share with us the localizable string that you added?
Best regards,
Dariy
Dariy Pavlyk,
thanks for that idea!
But i think the code of the column is correct.
Best regards,
Oliver
Hello Oliver,
The issue seems to be related with the fact that the Contract page does interfer with the loadVocabulary, making it work incorrectly.
Also we would like to add, that even if this is a multilookup field, it would still be needed to indicate an account in the Contract, as it is needed for it to be saved.
Here is an example of code that you can use and which will work properly:
define("ContractPageV2", ["LookupUtilities"], function(LookupUtilities) {
return {
entitySchemaName: "Contract",
attributes: {
"ContractClient": {
"caption": {"bindTo": "Resources.Strings.Client"},
"dataValueType": this.Terrasoft.DataValueType.LOOKUP,
"multiLookupColumns": ["Account", "Contact"],
"isRequired": true
}
},
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
methods: {
loadVocabulary: function(args, tag) {
var multiLookupColumns = this.getMultiLookupColumns(tag);
var config = (Ext.isEmpty(multiLookupColumns))
? this.getLookupPageConfig(args, tag)
: this.getMultiLookupPageConfig(args, tag);
if (tag === "Parent") {
var select = this.Ext.create("Terrasoft.EntitySchemaQuery", {
rootSchemaName: this.entitySchemaName
});
var filterGroup = new this.Terrasoft.createFilterGroup();
filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.OR;
filterGroup.addItem(select.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.NOT_EQUAL,
"Parent", this.get("Id")));
filterGroup.addItem(this.Terrasoft.createColumnIsNullFilter("Parent"));
config.filters.addItem(filterGroup);
config.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "Type.IsSlave", false));
}
LookupUtilities.Open(this.sandbox, config, this.onLookupResult, this, null, false, false);
},
},
dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"parentName": "ContractSumGroup",
"propertyName": "items",
"name": "ContractClient",
"values": {
"bindTo": "ContractClient",
"layout": {"column": 0, "row": 1, "colSpan": 24},
"tip": {
"content": {"bindTo": "Resources.Strings.ClientTip"}
},
"controlWrapConfig": {
"classes": {"wrapClassName": ["client-edit-field"]}
},
"controlConfig": {
"enableLeftIcon": true,
"leftIconConfig": {"bindTo": "getMultiLookupIconConfig"}
}
}
}
]/**SCHEMA_DIFF*/
};
});
Best regards,
Dariy
Dariy Pavlyk,
Thanks for your answer!
With the following code it's working fine for me.
I is not nessesary to implement "loadVocabulary". I don't know why but it is working now.
define("ContractPageV2", [], function() { return { entitySchemaName: "Contract", attributes: { "ContractClient": { "caption": {"bindTo": "Resources.Strings.Client"}, "dataValueType": this.Terrasoft.DataValueType.LOOKUP, "multiLookupColumns": ["Account", "Contact"], "isRequired": true } }, modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/, details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/, methods: { }, dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/, diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "name": "ContractClient", "values": { "bindTo": "ContractClient", "layout": { "colSpan": 12, "rowSpan": 1, "column": 0, "row": 1 }, "controlConfig": { "enableLeftIcon": true, "leftIconConfig": { "bindTo": "getMultiLookupIconConfig" } } }, "parentName": "Header", "propertyName": "items", "index": 1 } ]/**SCHEMA_DIFF*/ }; });