How can we change the display visibility of the "Playbook" based on the "ServiceItem" lookup inside "CasePage"?

Hi Community,

 

We've this requirement where we need to change the "PlayBook" component visibility based on the "ServiceItem" lookup value.

 

 

This visibility rule must be defined following the same principle used for the "Estado (Status)", which is located on the "Playbook" detail inside "KnowledgeBasePageV2".

 

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

 

 

 

Like 0

Like

6 comments
Best reply

Hi Pedro,

 

You need to override the logic of the _updatePlaybookData method in the CaseSectionActionsDashboard and also set the value for the IsShowPlaybookButton attribute to false. To get data from the master case entity you can use the this.getMasterEntityParameterValue() method.

 

Best regards,

Oscar

Hi Pedro,

 

You need to override the logic of the _updatePlaybookData method in the CaseSectionActionsDashboard and also set the value for the IsShowPlaybookButton attribute to false. To get data from the master case entity you can use the this.getMasterEntityParameterValue() method.

 

Best regards,

Oscar

Hi Oscar,

 

Thank you for the response.

 

I've managed to solve my problem by overriding the method __getPlaybookEsq which is called by the _updatePlaybookData. I simply added the following code to the CaseSectionActionsDashboard:

 

/**
 * @private
 */
_getPlaybookEsq: function() {
	var serviceItem = this.getMasterEntityParameterValue("ServiceItem");
 
	const esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
		rootSchemaName: "VwSysDcmLib"
	});
	const caseUid = this.$DcmSchema.uId;
	const currentCultureId = Terrasoft.SysValue.CURRENT_USER_CULTURE.value;
	esq.addColumn("=[Playbook:Case:Id].KnowledgeBase", "KnowledgeBase");
	esq.filters.addItem(this.Terrasoft.createExistsFilter("=[Playbook:Case:Id].KnowledgeBase"));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "UId", caseUid));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "=[Playbook:Case:Id].StageId", this.$ActiveActionId));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "=[Playbook:Case:Id].[SysCulture:Language:Culture].Id", currentCultureId));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "=[Playbook:Case:Id].UsrServiceItem", serviceItem.value));
 
	return esq;
}

 

One more thing. Is there a method that I can override or call, in order to reload the DCM automatically after changing my ServiceItem?

 

Thank you.

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

There is a reload method in the SectionActionsDashboard module, try calling it.

 

Best regards,

Oscar

Oscar Dylan,

 

I tried to call the reload method on my CasePage but its returning undefined. How/Where should I call this method?

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

You need to reload the SectionActionsDashboard not the CasePage since you need to reload the DCM (according to your question, correct me if I am wrong). And the reload method is the method of the CaseSectionActionsDashboard.

 

Best regards,

Oscar

Oscar Dylan,

 

Correct, I need to refresh the DCM of the CasePage. However, the reload should happen after I change the value of the field ServiceItem, which is located on my CasePage.

 

Best Regards,

Pedro Pinheiro

Show all comments