how to remove the 'Cancel activity' button from activity mini page for a specific type of case service

Hi, community.

When you click an activity on dashboard within Case, you get mini page where you can complete the activity or cancel it. I need to remove the "cancel activity" button for specific type of case service.

I have found how to remove 'Cancel activity' from all  mini pages,

diff: 
/**SCHEMA_DIFF*/[ 
{ "operation": "remove", "name": "CopyButton" }, 
{ "operation": "remove", "name": "DeleteButton" }, 
{ "operation": "remove", "name": "OpenButton" } }

but need to add extra condition to apply it only for cases with specific Service.

 

Best regards,

Jana

 

Like 0

Like

2 comments

Hello Jana,

 

You can try replace ActivityMiniPage view model by this code. Inside canCancelActivity method You can implement Your logic.

 define("ActivityMiniPage", [], function() {
	return {
		entitySchemaName: "Activity",
		messages:{
				"GetColumnsValues": {
				mode: Terrasoft.MessageMode.PTP,
				direction: Terrasoft.MessageDirectionType.PUBLISH
			},
		},
		methods: {
			canCancelActivity: function() {
				var stage = this.sandbox.publish("GetColumnsValues", ["Stage"], [this.values.MiniPageSourceSandboxId]);
				return stage.Stage.displayValue=='Presentation'? true : false;
			},
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "CancelButton",
				"values": {
					"visible": {"bindTo": "canCancelActivity"},
					"tag": "Cancel"
				}
			}
		]/**SCHEMA_DIFF*/,
		rules: {}
	};
});

Best regards,

Marcin

Marcin Kott,

Thank you!

Show all comments