Adding the "Show Closed Cases" Check Box Filter to the Portal Cases Section
Hello, the Cases section for employee users has a feature where you can toggle the "show closed cases" check box as a quick way to filter out closed or cancelled cases. This is not available one the Portal Cases section for portal users. Is it possible to add this feature to the portal cases section?
Like
Yes. The checkbox is in the CaseSection module. It's called IsActive. You'll need to investigate the functionality and move it to the "PortalCaseSection" module according to the article by the link below.
https://academy.bpmonline.com/documents/technic-sdk/7-13/client-modules
Eugene Podkovka, I tried, and the Portal Cases Section is just a blank white screen now when I log in as a portal user (in a test environment)
Do you see anything incorrect I did? Essentially I tried to add the diff and methods that were in the CaseSection to the replacing client module in the custom package for the PortalCaseSection.
Eugene Podkovka,
Eugene Podkovka,
Mitch Kaschub,
It's very hard to say something by a screenshot. A text would be more clear. If everything is blank, then it's probably missing comma or incorrect syntax. Try to add the code partially and find what's wrong.
Eugene Podkovka,
Sure, here is the source code tab pasted in case that helps. If I click save, the JS Errors Report tab says "Errors not found" and the schema saves correctly. I have compiled the system, but still the blank page.
I'm open to suggestions on what to try next, I am not experienced with development, I only copy pasted code from the regular Case Section schema where it looked like the code would be relevant for adding the filter I want. I don't know if I have properly called all the necessary functions or if this is even possible with the portal cases schema as is. Thank you for any advice!!!
define("PortalCaseSection", ["BaseFiltersGenerateModule", "CheckBoxFixedFilterStyle", "StorageUtilities",
"ServiceDeskConstants", "CasePageUtilitiesV2", "css!CheckBoxFixedFilterStyle"],
function(BaseFiltersGenerateModule, CheckBoxFixedFilterStyle, StorageUtilities, ServiceDeskConstants) {
return {
entitySchemaName: "Case",
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
diff: /**SCHEMA_DIFF*/[{
"operation": "remove",
"name": "SeparateModeAddRecordButton"
},{
"operation": "remove",
"name": "AddFolderButton"
},{
"operation": "insert",
"name": "IsActiveFiltersContainer",
"parentName": "FiltersContainer",
"propertyName": "items",
"index": 0,
"values": {
"itemType": this.Terrasoft.ViewItemType.CONTAINER,
"visible": {"bindTo": "StatusFilterContainerDisplay"},
"wrapClass": ["isActive-filter-container-wrapClass"],
"items": []
}
},{
"operation": "insert",
"parentName": "IsActiveFiltersContainer",
"propertyName": "items",
"name": "IsActive",
"values": {
"caption": {
"bindTo": "Resources.Strings.CheckboxFilterCaption"
},
"bindTo": "IsActive",
"controlConfig": {
"className": "Terrasoft.CheckBoxEdit",
"checkedchanged": {
"bindTo": "onCheckboxChecked"
},
"checked": {
"bindTo": "IsActive"
}
}
}
}]/**SCHEMA_DIFF*/,
methods: {
/**
* Initializes the setting of fixed filters.
* @overridden
*/
initFixedFiltersConfig: function() {
var fixedFilterConfig = {
entitySchema: this.entitySchema,
filters: [
{
name: "Owner",
caption: this.get("Resources.Strings.OwnerFilterCaption"),
dataValueType: this.Terrasoft.DataValueType.LOOKUP,
filter: BaseFiltersGenerateModule.OwnerFilter,
columnName: "Owner",
defValue: {
value: this.Terrasoft.SysValue.CURRENT_USER_CONTACT.value,
displayValue: this.Terrasoft.SysValue.CURRENT_USER_CONTACT.displayValue
}
}
]
};
this.set("FixedFilterConfig", fixedFilterConfig);
},
/**
* Set ID contextual help.
* @protected
*/
initContextHelp: function() {
this.set("ContextHelpId", 1063);
this.callParent(arguments);
},
/**
*@inheritDoc Terrasoft.GridUtilitiesV2#getFilters
*@overriden
*/
getFilters: function() {
var filters = this.callParent(arguments);
var isFinal = this.get("IsActive");
if (!isFinal) {
filters.add("FilterStatus", this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "Status.IsFinal", isFinal));
}
return filters;
}
}
};
});
Eugene Podkovka,
Disregard, I have figured it out.
It turns out, I needed ALL the code from the source code tab in the CaseSection schema. My original mistake was just copying pieces of the code that I thought were relevant. I don't know if I now have more code than I need, but the "show closed cases" check box is now working as I expected on the Portal Case Section page now so I am going to keep it as is.
Thanks for your help!
Here is the code I now have in the PortalCaseSection schema that is working:
define("PortalCaseSection", ["BaseFiltersGenerateModule", "CheckBoxFixedFilterStyle", "StorageUtilities",
"ServiceDeskConstants", "CasePageUtilitiesV2", "css!CheckBoxFixedFilterStyle"],
function(BaseFiltersGenerateModule, CheckBoxFixedFilterStyle, StorageUtilities, ServiceDeskConstants) {
return {
entitySchemaName: "Case",
contextHelpId: "1001",
mixins: {
/**
* @class CasePageUtilitiesV2 CasePageUtilitiesV2 implements quick save cards in one click.
*/
CasePageUtilitiesV2: "Terrasoft.CasePageUtilitiesV2"
},
properties: {
/**
* Property key for 'Show closed cases' button.
*/
showClosedCasesPropertyName: "showClosedCases"
},
attributes: {
/**
* Resolved button menu visibility.
*/
"ResolvedButtonMenuVisible": {
dataValueType: this.Terrasoft.DataValueType.BOOLEAN,
value: false
},
/**
* Caption for ResolvedMenu button.
*/
"ResolvedButtonMenuCaption": {
dataValueType: this.Terrasoft.DataValueType.TEXT,
value: ""
},
/**
* Collection name drop-down menu in the function button.
*/
"ResolvedButtonMenuItems": {
dataValueType: this.Terrasoft.DataValueType.COLLECTION
},
"IsActive": {
dataValueType: this.Terrasoft.DataValueType.BOOLEAN,
type: this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
value: false
},
"StatusFilterContainerDisplay": {
dataValueType: this.Terrasoft.DataValueType.BOOLEAN,
type: this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
value: true
},
/**
* Container for custom case section profile.
*/
"CaseSectionCustomProfile": {
dataValueType: this.Terrasoft.DataValueType.CUSTOM_OBJECT,
value: null
}
},
diff: /**SCHEMA_DIFF*/[{
"operation": "remove",
"name": "SeparateModeAddRecordButton"
},{
"operation": "remove",
"name": "AddFolderButton"
},{
"operation": "insert",
"name": "IsActiveFiltersContainer",
"parentName": "FiltersContainer",
"propertyName": "items",
"index": 0,
"values": {
"itemType": this.Terrasoft.ViewItemType.CONTAINER,
"visible": {"bindTo": "StatusFilterContainerDisplay"},
"wrapClass": ["isActive-filter-container-wrapClass"],
"items": []
}
},{
"operation": "insert",
"parentName": "IsActiveFiltersContainer",
"propertyName": "items",
"name": "IsActive",
"values": {
"caption": {
"bindTo": "Resources.Strings.CheckboxFilterCaption"
},
"bindTo": "IsActive",
"controlConfig": {
"className": "Terrasoft.CheckBoxEdit",
"checkedchanged": {
"bindTo": "onCheckboxChecked"
},
"checked": {
"bindTo": "IsActive"
}
}
}
}]/**SCHEMA_DIFF*/,
messages: {
/**
* @message UpdateResolvedButtonMenu
* It is need to update the collection of menu items quick save button after changing status.
* @param {Object} Id current status.
*/
"UpdateResolvedButtonMenu": {
mode: this.Terrasoft.MessageMode.PTP,
direction: this.Terrasoft.MessageDirectionType.SUBSCRIBE
},
/**
* @message OnResolvedButtonMenuClick
* Event menu selection buttons quick save.
* @param {Object} config menu
*/
"OnResolvedButtonMenuClick": {
mode: this.Terrasoft.MessageMode.PTP,
direction: this.Terrasoft.MessageDirectionType.PUBLISH
}
},
methods: {
/**
* Adds custom values to the profile.
* @param {String} propertyName Property name.
* @param {Object} propertyValue Property value.
* @private
*/
_addPropertyToProfile: function(propertyName, propertyValue) {
var key = this.getCustomProfileKey();
var profile = this.$CaseSectionCustomProfile;
if (!this.Ext.isEmpty(profile)) {
profile[propertyName] = propertyValue;
Terrasoft.utils.saveUserProfile(key, profile, false);
this.$CaseSectionCustomProfile = profile;
}
},
/**
* Returns profile key.
* @returns {string} Profile key.
*/
getCustomProfileKey: function() {
var schemaName = this.name;
return schemaName + "CustomSectionData";
},
/**
* @inheritdoc Terrasoft.BaseSectionV2#loadGridDataView
* @overridden
*/
loadGridDataView: function() {
this.set("StatusFilterContainerDisplay", true);
this.callParent(arguments);
},
/**
* @inheritdoc Terrasoft.BaseSectionV2#loadAnalyticsDataView
* @overridden
*/
loadAnalyticsDataView: function() {
this.set("StatusFilterContainerDisplay", true);
this.callParent(arguments);
},
/**
* Publishes a message to the current state of the registry.
* In the state of zavistimosti - Card or sets the style for a Section SectionFiltersContainer.
*/
onSectionModeChanged: function() {
this.callParent(arguments);
CheckBoxFixedFilterStyle.setFilterContainerStyle(this);
},
/**
* Event menu selection buttons quick save
* @protected
*/
onResolvedButtonMenuClick: function() {
var tagButtonMenu = arguments[0];
if (!tagButtonMenu) {
var resolvedButtonMenuItems = this.get("ResolvedButtonMenuItems");
if (!resolvedButtonMenuItems.isEmpty()) {
tagButtonMenu = resolvedButtonMenuItems.collection.items[0].values.Tag;
}
}
this.sandbox.publish("OnResolvedButtonMenuClick", tagButtonMenu,
[this.sandbox.id + "_CardModuleV2"]);
},
/**
* @inheritdoc Terrasoft.BaseSchemaViewModel#initializeProfile
* @overridden
*/
initializeProfile: function(callback, scope) {
this.callParent([function() {
this.requireCustomProfile(callback, scope);
}, scope || this]);
},
/**
* Loads case section profile.
* @param {Function} callback Callback function.
* @param {Object} scope Callback context.
*/
requireCustomProfile: function(callback, scope) {
var key = this.getCustomProfileKey();
this.requireProfile(function(profile) {
if (profile) {
this.$CaseSectionCustomProfile = profile;
if (!this.Ext.isEmpty(profile[this.showClosedCasesPropertyName])) {
this.set("IsActive", profile[this.showClosedCasesPropertyName]);
}
}
Ext.callback(callback, scope);
}, scope || this, key);
},
/**
* Initializes the initial values of the model.
* @overridden
*/
init: function() {
this.subscribeResolvedButton();
this.initSatisfactionUpdateProcessJob();
this.callParent(arguments);
},
/**
* Subscribes for resolved button events.
* @protected
*/
subscribeResolvedButton: function() {
this.initResolvedButtonCollection();
var resolvedClickSubscriberId = this.sandbox.id + "_CardModuleV2";
this.sandbox.subscribe("UpdateResolvedButtonMenu", function(recordId) {
this.initResolvedButtonCollection(recordId);
}, this, [resolvedClickSubscriberId]);
},
/**
* Sets initial values for SatisfactionUpdateProcessJob
* @protected
*/
initSatisfactionUpdateProcessJob: function() {
this.callSyncJobService(ServiceDeskConstants.SetSatisfactionTaskPeriod,
"SatisfactionUpdateProcessJob", "SatisfactionUpdateProcess");
var wasCheckTermSet = StorageUtilities.getItem("wasCheckTermSet");
if (wasCheckTermSet) {
return;
}
StorageUtilities.setItem(true, "wasCheckTermSet");
this.Terrasoft.SysSettings.querySysSettingsItem("CaseOverduesCheckTerm",
this.callOverdueSetter, this);
},
/**
* Create a scheduler to run the process at intervals.
* @param {Integer} value Value of the period in minutes
* @param {String} jobname Name of the task scheduler
* @param {String} processName The name of the process
*/
callSyncJobService: function(value, jobname, processName) {
var config = {
serviceName: "SyncJobService",
methodName: "CreateSyncJob",
data: {
request: {
JobName: jobname,
ProcessName: processName,
PeriodInMinutes: value
}
}
};
this.callService(config, this.Terrasoft.emptyFn, this);
},
/**
* Create a scheduler start the installation process indicators overdue appeals.
* @param {Integer} value The value of the system setting "Term inspection overdue treatment Minutes".
* @overridden
*/
callOverdueSetter: function(value) {
this.callSyncJobService(value, "CaseOverduesSettingJob", "CaseOverduesSettingProcess");
},
/**
* The change in state CheckBox
* @param {Object} value The new value of the CheckBox after change.
*/
onCheckboxChecked: function(value) {
this.set("IsActive", value);
this._addPropertyToProfile(this.showClosedCasesPropertyName, value);
this.sandbox.publish("FiltersChanged", null, [this.sandbox.id]);
CheckBoxFixedFilterStyle.onClick(value, this);
var activeViewName = this.getActiveViewName();
if (activeViewName === this.get("AnalyticsDataViewName")) {
this.sandbox.publish("SectionUpdateFilter",
null, [this.getQuickFilterModuleId()]);
}
},
/**
* Initializes the setting of fixed filters.
* @overridden
*/
initFixedFiltersConfig: function() {
var fixedFilterConfig = {
entitySchema: this.entitySchema,
filters: [
{
name: "Owner",
caption: this.get("Resources.Strings.OwnerFilterCaption"),
dataValueType: this.Terrasoft.DataValueType.LOOKUP,
filter: BaseFiltersGenerateModule.OwnerFilter,
columnName: "Owner",
defValue: {
value: this.Terrasoft.SysValue.CURRENT_USER_CONTACT.value,
displayValue: this.Terrasoft.SysValue.CURRENT_USER_CONTACT.displayValue
}
}
]
};
this.set("FixedFilterConfig", fixedFilterConfig);
},
/**
* Set ID contextual help.
* @protected
*/
initContextHelp: function() {
this.set("ContextHelpId", 1063);
this.callParent(arguments);
},
/**
*@inheritDoc Terrasoft.GridUtilitiesV2#getFilters
*@overriden
*/
getFilters: function() {
var filters = this.callParent(arguments);
var isFinal = this.get("IsActive");
if (!isFinal) {
filters.add("FilterStatus", this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "Status.IsFinal", isFinal));
}
return filters;
}
}
};
});