It is necessary to configure the filter CreatedBy=CurrentUser
in the mobile application.
The filter is saved in the file UsrMobileNotesModuleConfig
and referenced in the manifest.
The file is specified in the manifest:
},
"UsrMyNotes": {
"RequiredModels": [
"UsrMyNotes"
],
"ModelExtensions": [],
"PagesExtensions": [
"UsrMobileUsrMyNotesActionsSettingsBlyzenkoWS",
"UsrMobileUsrMyNotesGridPageSettingsBlyzenkoWS",
"UsrMobileUsrMyNotesRecordPageSettingsBlyzenkoWS",
"UsrMobileNotesModuleConfig"
]
}
Filter code:
Terrasoft.sdk.Module.addFilter("UsrMyNotes", Ext.create("Terrasoft.Filter", {
type: Terrasoft.FilterTypes.Group,
logicalOperation: Terrasoft.FilterLogicalOperations.And,
subfilters: [
{
property: "CreatedBy",
comparisonType: Terrasoft.ComparisonType.EQUAL,
value: Terrasoft.sdk.CurrentUser.getContactId()
}
]
}));
But it does not work. Please help.
Like
Hello,
The example you provided is relevant for the classic sections of the mobile application; however, it appears that you are using the Freedom UI interface for the mobile section of your object. To implement your task in this case, you need to change the Mobile[Object]GridPageSettings[Workplace] schema. In this schema, inside the array [ ], you need to add a block with the code:
{
"operation": "merge",
"name": "settings",
"values": {
"viewModelConfigDiff": "[{\"operation\":\"merge\",\"name\":\"Attribute_Items_ModelConfig\",\"values\":{\"filterAttributes\":[]}},{\"operation\":\"insert\",\"name\":\"MyFilter\",\"values\":{},\"parentName\":\"Attribute_Items_ModelConfig\",\"propertyName\": \"filterAttributes\"},{\"operation\":\"merge\",\"name\":\"Attributes\",\"values\":{\"MyFilter\":{ YOUR FILTER }}}]"
}
}
To obtain the filter itself, you should use the following method:
- 1) In the Freedom UI designer, add a new list to your object on any page.
- 2) In this list, configure the filter you want to apply in the mobile application.
- 3) Save the filter and the page.
- 4) Open the code of the page and find the complete filter code inside it.
- 5) Insert this code inside the {"MyFilter":{ YOUR FILTER }}.
It's important to escape the " characters with a backslash, like this \", and the filter code should not contain tabs. As a result, your Mobile[Object]GridPageSettings[Workplace] page should look something like this:
[
{
"operation": "merge",
"name": "settings",
"values": {
"viewModelConfigDiff": "[{\"operation\":\"merge\",\"name\":\"Attribute_Items_ModelConfig\",\"values\":{\"filterAttributes\":[]}},{\"operation\":\"insert\",\"name\":\"MyFilter\",\"values\":{},\"parentName\":\"Attribute_Items_ModelConfig\",\"propertyName\": \"filterAttributes\"},{\"operation\":\"merge\",\"name\":\"Attributes\",\"values\":{\"MyFilter\":{\"value\": {\"items\": {\"154ca683-b9f9-4359-88ca-e9dfbd10481a\": {\"filterType\": 4,\"comparisonType\": 3,\"isEnabled\": true,\"trimDateTimeParameterToDate\": false,\"leftExpression\": {\"expressionType\": 0,\"columnPath\": \"Status\"},\"isAggregative\": false,\"dataValueType\": 10,\"referenceSchemaName\": \"CaseStatus\",\"rightExpressions\": [{\"expressionType\": 2,\"parameter\": {\"dataValueType\": 10,\"value\": {\"Name\": \"In progress\",\"IsFinal\": false,\"Id\": \"7e9f1204-f46b-1410-fb9a-0050ba5d6c38\",\"Image\": \"\",\"StatusColor\": \"#FFAC07\",\"value\": \"7e9f1204-f46b-1410-fb9a-0050ba5d6c38\",\"displayValue\": \"In progress\"}}}]},\"d819453a-7122-4f49-92e8-3b0d7e4601f5\": {\"filterType\": 4,\"comparisonType\": 3,\"isEnabled\": true,\"trimDateTimeParameterToDate\": false,\"leftExpression\": {\"expressionType\": 0,\"columnPath\": \"Status\"},\"isAggregative\": false,\"dataValueType\": 10,\"referenceSchemaName\": \"CaseStatus\",\"rightExpressions\": [{\"expressionType\": 2,\"parameter\": {\"dataValueType\": 10,\"value\": {\"Name\": \"New\",\"IsFinal\": false,\"Id\": \"ae5f2f10-f46b-1410-fd9a-0050ba5d6c38\",\"Image\": \"\",\"StatusColor\": \"#0058EF\",\"value\": \"ae5f2f10-f46b-1410-fd9a-0050ba5d6c38\",\"displayValue\": \"New\"}}}]}},\"logicalOperation\": 1,\"isEnabled\": true,\"filterType\": 6,\"rootSchemaName\": \"Case\"}}}}]"}
}
]
After that, save the changes and synchronize the mobile application. As a result, the section should be filtered.