Filter records in lookup

Hello, 



I am trying to filter lookup values in the mobile application based on two columns "UsrStartDate" and "UsrEndDate". These two columns are present in the lookup object. But somehow the rule is not working. Any Comments?

Terrasoft.sdk.Model.addBusinessRule("UsrDisplayImages",
	{
		ruleType:Terrasoft.RuleTypes.Filtration,
		events:	
			[
				Terrasoft.BusinessRuleEvents.Load,
				Terrasoft.BusinessRuleEvents.Insert,
				Terrasoft.BusinessRuleEvents.ValueChanged
			],
		triggeredByColumns:["UsrCurrent_Program"],
		filters:Ext.create("Terrasoft.Filter",
			{
				modelName:"UsrDisplay_img_CurrentProgram",
				property:"UsrEndDate",
				comparisonOperation:Terrasoft.ComparisonTypes.GreaterOrEqual,
				value: new Date() // current date	
			})
	});

this is the rule placed in another module : "UsrMobileFilterModelConfig"

Also attaching the code of manifest file 

{
  "SyncOptions": {
    "SysSettingsImportConfig": [],
    "ModelDataImportConfig": [
      {
        "Name": "UsrDisplayImages",
        "SyncColumns": [
          "UsrName",
          "UsrSales_Rep_Name",
          "UsrCurrent_Program",
          "UsrIncentive",
          "UsrComments",
          "UsrBrand",
          "UsrSpiff_Month",
          "UsrColumn3",
          "UsrCustomer_Name_text",
          "UsrPreview",
          "UsrNewSpiffMonth",
          "UsrAmount",
          "UsrCases_Shipped",
          "UsrCases1_Displayed",
          "UsrSales_Rep",
          "UsrColumn11",
          "UsrCustomer_Name"
        ]
      },
      {
        "Name": "Employee",
        "SyncColumns": [
          "Manager"
        ]
      },
      {
        "Name": "UsrDisplay_img_CurrentProgram",
        "SyncColumns": [],
        "Ignore": false,
        "QueryFilter": {
          "items": {
            "dab489b7-06c4-4f1a-b588-0fe00e965bf7": {
              "filterType": 1,
              "comparisonType": 8,
              "isEnabled": true,
              "trimDateTimeParameterToDate": true,
              "leftExpression": {
                "expressionType": 0,
                "columnPath": "UsrEndDate"
              },
              "isAggregative": false,
              "dataValueType": 8,
              "rightExpression": {
                "expressionType": 1,
                "functionType": 1,
                "macrosType": 4
              }
            },
            "5c38cd37-a1bd-49bb-9cd8-2f11e8b7fbee": {
              "filterType": 1,
              "comparisonType": 6,
              "isEnabled": true,
              "trimDateTimeParameterToDate": true,
              "leftExpression": {
                "expressionType": 0,
                "columnPath": "UsrStartDate"
              },
              "isAggregative": false,
              "dataValueType": 8,
              "rightExpression": {
                "expressionType": 1,
                "functionType": 1,
                "macrosType": 4
              }
            }
          },
          "logicalOperation": 0,
          "isEnabled": false,
          "filterType": 6,
          "rootSchemaName": "UsrDisplay_img_CurrentProgram"
        },
        "SyncFilter": null
      },
      {
        "Name": "UsrDisplay_img_yes_no_lookup",
        "SyncColumns": []
      },
      {
        "Name": "UsrDisplay_Img_Spiff_Month",
        "SyncColumns": []
      },
      {
        "Name": "Contact",
        "SyncColumns": []
      },
      {
        "Name": "SocialMessage",
        "SyncColumns": [
          "EntityId"
        ]
      },
      {
        "Name": "SysFile",
        "SyncColumns": [
          "RecordId",
          "Name",
          "Type",
          "Data",
          "Size",
          "RecordSchemaName"
        ],
        "QueryFilter": {
          "items": {
            "DesignerDefaultRecordSchemaNameFilter": {
              "filterType": 4,
              "comparisonType": 3,
              "isEnabled": true,
              "trimDateTimeParameterToDate": false,
              "leftExpression": {
                "expressionType": 0,
                "columnPath": "RecordSchemaName"
              },
              "rightExpressions": [
                {
                  "expressionType": 2,
                  "parameter": {
                    "dataValueType": 1,
                    "value": "UsrDisplayImages"
                  }
                }
              ]
            }
          },
          "logicalOperation": 0,
          "isEnabled": true,
          "filterType": 6
        }
      },
      {
        "Name": "FileGroup",
        "SyncColumns": []
      },
      {
        "Name": "UsrDisplay_Image_Status",
        "SyncColumns": []
      },
      {
        "Name": "UsrBrand",
        "SyncColumns": []
      },
      {
        "Name": "Account",
        "SyncColumns": []
      }
    ]
  },
  "Modules": {
    "UsrDisplayImages": {
      "Group": "main",
      "Model": "UsrDisplayImages",
      "Position": 0,
      "isStartPage": false,
      "Title": "UsrDisplayImagesSectionTitle",
      "Hidden": false,
      "screens": {
        "start": {
          "schemaName": "UsrMobileUsrDisplayImagesGridPageSettingsDefaultWorkplace"
        },
        "edit": {
          "schemaName": "UsrMobileUsrDisplayImagesRecordPageSettingsDefaultWorkplace"
        }
      }
    }
  },
  "Models": {
    "UsrDisplayImages": {
      "RequiredModels": [
        "UsrDisplayImages",
        "Employee",
        "UsrDisplay_img_CurrentProgram",
        "UsrDisplay_img_yes_no_lookup",
        "UsrDisplay_Img_Spiff_Month",
        "Contact",
        "SocialMessage",
        "SysFile",
        "FileGroup",
        "UsrDisplay_Image_Status",
        "UsrBrand",
        "Account"
      ],
      "ModelExtensions": [],
      "PagesExtensions": [
        "UsrMobileUsrDisplayImagesActionsSettingsDefaultWorkplace",
        "UsrMobileUsrDisplayImagesGridPageSettingsDefaultWorkplace",
        "UsrMobileUsrDisplayImagesRecordPageSettingsDefaultWorkplace",
        "UsrMobileFilterModelConfig"
      ]
    },
    "SocialMessage": {
      "RequiredModels": [],
      "ModelExtensions": [],
      "PagesExtensions": []
    },
    "SysFile": {
      "RequiredModels": [],
      "ModelExtensions": [],
      "PagesExtensions": []
    }
  },
  "ModuleGroups": {
    "main": {}
  },
  "UseUTC": true,
  "Remove": {
    "SyncOptions": {
      "ModelDataImportConfig": [
        {
          "Name": "UsrDisplay_img_CurrentProgram",
          "QueryFilter": null
        }
      ]
    }
  }
}

 

Like 0

Like

1 comments

Hello,

Are these rules configured on a Classic or a Freedom UI page?

If it's a Freedom UI then these types of rules won't work, see this discussion.

Show all comments