Skip to content

Instantly share code, notes, and snippets.

@agrazh
Last active April 7, 2023 18:38
Show Gist options
  • Save agrazh/ede65b65f3a245162d91ee90607b42d2 to your computer and use it in GitHub Desktop.
Save agrazh/ede65b65f3a245162d91ee90607b42d2 to your computer and use it in GitHub Desktop.
[Pre-defined page, with filters on lookup fields, for Creatio CRM]
define("GlbConstants", [], function() {
var accountType = {
OurDepartment: "01d5bbff-8d27-49a5-a338-a3875dd536e3",
OurBranch: "a2f28c3e-0af9-4e66-8550-8b0436d8276a"
};
var account = {
HQ: "e308b781-3c5b-4ecb-89ef-5c1ed4da488e"
};
return {
AccountType: accountType,
Account: account
};
});
define("GlbCustomerInfoUpdateAssigneePage", ["GlbCustomerInfoUpdateAssigneePageResources", "GlbConstants"],
function(resources, GlbConstants) {
return {
entitySchemaName: "",
attributes: {
"GlbAssigneeDepartment": {
"lookupListConfig": {
"filter": function () {
return this.getOurDepartmentFilter();
}
},
"dependencies": [{
"columns": ["GlbAssigneeDepartment"],
"methodName": "onAssigneeDepartmentChange"
}]
},
"GlbAssigneeBranch": {
"lookupListConfig": {
"filter": function () {
return this.getOurBranchFilter();
}
},
"dependencies": [{
"columns": ["GlbAssigneeBranch"],
"methodName": "onAssigneeBranchChange"
}]
},
"GlbNotifyDepartment1": {
"lookupListConfig": {
"filter": function () {
return this.getOurDepartmentFilter();
}
},
"dependencies": [{
"columns": ["GlbNotifyDepartment1"],
"methodName": "onNotifyDepartment1Change"
}]
},
"GlbNotifyBrach1": {
"lookupListConfig": {
"filter": function () {
return this.getOurBranchFilter();
}
},
"dependencies": [{
"columns": ["GlbNotifyBrach1"],
"methodName": "onNotifyBrach1Change"
}]
},
"GlbNotifyDepartment2": {
"lookupListConfig": {
"filter": function () {
return this.getOurDepartmentFilter();
}
},
"dependencies": [{
"columns": ["GlbNotifyDepartment2"],
"methodName": "onNotifyDepartment2Change"
}]
},
"GlbNotifyBranch2": {
"lookupListConfig": {
"filter": function () {
return this.getOurBranchFilter();
}
},
"dependencies": [{
"columns": ["GlbNotifyBranch2"],
"methodName": "onNotifyBranch2Change"
}]
},
"GlbNotifyDepartment3": {
"lookupListConfig": {
"filter": function () {
return this.getOurDepartmentFilter();
}
},
"dependencies": [{
"columns": ["GlbNotifyDepartment3"],
"methodName": "onNotifyDepartment3Change"
}]
},
"GlbNotifyBranch3": {
"lookupListConfig": {
"filter": function () {
return this.getOurBranchFilter();
}
},
"dependencies": [{
"columns": ["GlbNotifyBranch3"],
"methodName": "onNotifyBranch3Change"
}]
}
},
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
methods: {
getOurDepartmentFilter: function() {
var filterGroup = Terrasoft.createFilterGroup();
var ourDepartmentCategoryFilter = Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL,
"Account.Id",
GlbConstants.Account.ByblosHQ);
filterGroup.addItem(ourDepartmentCategoryFilter);
return filterGroup;
},
getOurBranchFilter: function() {
var filterGroup = Terrasoft.createFilterGroup();
var ourBranchCategoryFilter = Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL,
"Type",
GlbConstants.AccountType.OurBranch);
filterGroup.addItem(ourBranchCategoryFilter);
return filterGroup;
},
onAssigneeDepartmentChange: function() {
var department = this.get("GlbAssigneeDepartment");
var branch = this.get("GlbAssigneeBranch");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbAssigneeBranch", null);
}
},
onAssigneeBranchChange: function() {
var department = this.get("GlbAssigneeDepartment");
var branch = this.get("GlbAssigneeBranch");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbAssigneeDepartment", null);
}
},
onNotifyDepartment1Change: function() {
var department = this.get("GlbNotifyDepartment1");
var branch = this.get("GlbNotifyBrach1");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbNotifyBrach1", null);
}
},
onNotifyBrach1Change: function() {
var department = this.get("GlbNotifyDepartment1");
var branch = this.get("GlbNotifyBrach1");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbNotifyDepartment1", null);
}
},
onNotifyDepartment2Change: function() {
var department = this.get("GlbNotifyDepartment2");
var branch = this.get("GlbNotifyBranch2");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbNotifyBranch2", null);
}
},
onNotifyBranch2Change: function() {
var department = this.get("GlbNotifyDepartment2");
var branch = this.get("GlbNotifyBranch2");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbNotifyDepartment2", null);
}
},
onNotifyDepartment3Change: function() {
var department = this.get("GlbNotifyDepartment3");
var branch = this.get("GlbNotifyBranch3");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbNotifyBranch3", null);
}
},
onNotifyBranch3Change: function() {
var department = this.get("GlbNotifyDepartment3");
var branch = this.get("GlbNotifyBranch3");
if (!this.Ext.isEmpty(department) && !this.Ext.isEmpty(branch)) {
this.set("GlbNotifyDepartment3", null);
}
},
asyncValidate: function() {
var department = this.get("GlbAssigneeDepartment");
var branch = this.get("GlbAssigneeBranch");
if (Terrasoft.isEmpty(department) && Terrasoft.isEmpty(branch)) {
this.showInformationDialog(this.get("Resources.Strings.NotValidAssigneeMessage"));
return;
}
this.callParent(arguments);
}
},
dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "merge",
"name": "Button-be6148b819154a0791eaee8f1635d859",
"values": {
"enabled": true
}
},
{
"operation": "insert",
"name": "LOOKUP11f1f548-a2a6-4bcb-862d-99a22c0173c8",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "Header"
},
"bindTo": "GlbContact",
"enabled": false,
"contentType": 5
},
"parentName": "Header",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "LOOKUP8c45e1e6-4b9a-4d64-ba8f-8d90f2c2092d",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 0,
"layoutName": "Header"
},
"bindTo": "GlbSource",
"enabled": false,
"contentType": 5
},
"parentName": "Header",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "LOOKUPf427f60b-6acc-4b3c-bd5b-22e3d36baf5a",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 1,
"layoutName": "Header"
},
"bindTo": "GlbCommunicationType",
"enabled": false,
"contentType": 5
},
"parentName": "Header",
"propertyName": "items",
"index": 2
},
{
"operation": "insert",
"name": "STRINGb1569d60-50ed-438d-983c-e319e2118a68",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 2,
"layoutName": "Header"
},
"bindTo": "GlbCurrentValue",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 3
},
{
"operation": "insert",
"name": "GlbCurrentValue83fb56bd-af48-4342-b061-f58e28e04862",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 2,
"layoutName": "Header"
},
"bindTo": "GlbNewValue",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 4
},
{
"operation": "merge",
"name": "NewTab1",
"values": {
"order": 0
}
},
{
"operation": "insert",
"name": "LOOKUP1e515d64-97e6-40fe-b3e6-259b89d28639",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "NewTab1GridLayout1"
},
"bindTo": "GlbAssigneeDepartment",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout1",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "LOOKUPeacb6b46-2043-4389-90a5-cc6285f76274",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 0,
"layoutName": "NewTab1GridLayout1"
},
"bindTo": "GlbAssigneeBranch",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout1",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "NewTab1Group8b5c16a2",
"values": {
"caption": {
"bindTo": "Resources.Strings.NewTab1Group8b5c16a2GroupCaption"
},
"itemType": 15,
"markerValue": "added-group",
"items": []
},
"parentName": "NewTab1",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "NewTab1GridLayout5c188e6d",
"values": {
"itemType": 0,
"items": []
},
"parentName": "NewTab1Group8b5c16a2",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "GlbNotifyDepartment1eddcd3bb-3c04-4ceb-acb0-00723068ef2d",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "NewTab1GridLayout5c188e6d"
},
"bindTo": "GlbNotifyDepartment1",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout5c188e6d",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "LOOKUP165418a1-30b2-4707-9086-f6efb02f3d32",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 0,
"layoutName": "NewTab1GridLayout5c188e6d"
},
"bindTo": "GlbNotifyBrach1",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout5c188e6d",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "LOOKUP16f46890-f888-4a69-87d2-f7daa927048e",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 1,
"layoutName": "NewTab1GridLayout5c188e6d"
},
"bindTo": "GlbNotifyDepartment2",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout5c188e6d",
"propertyName": "items",
"index": 2
},
{
"operation": "insert",
"name": "LOOKUPff3ee1b0-4f8c-4bb6-938a-23060409146e",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 1,
"layoutName": "NewTab1GridLayout5c188e6d"
},
"bindTo": "GlbNotifyBranch2",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout5c188e6d",
"propertyName": "items",
"index": 3
},
{
"operation": "insert",
"name": "LOOKUPba20dbed-2597-46b8-ac2a-6a6926fb698f",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 2,
"layoutName": "NewTab1GridLayout5c188e6d"
},
"bindTo": "GlbNotifyDepartment3",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout5c188e6d",
"propertyName": "items",
"index": 4
},
{
"operation": "insert",
"name": "LOOKUP9c6c616b-6cb6-46e9-b4b5-44ae6d13f923",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 2,
"layoutName": "NewTab1GridLayout5c188e6d"
},
"bindTo": "GlbNotifyBranch3",
"enabled": true,
"contentType": 5
},
"parentName": "NewTab1GridLayout5c188e6d",
"propertyName": "items",
"index": 5
}
]/**SCHEMA_DIFF*/
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment