Question

button code

Hello Community,

I followed the steps in the academy.bpmonline.com  to create a button.The button(Primary Contact) which i added was visible on the left container,while clicking the button it was not redirecting to specified section.and also colour of the button is not effecting 

Attaching the code and the button which i created.

Hoping for a quick reply.plz 

Like 0

Like

1 comments

The button is grey probably because it is inactive. Check the isAccountPrimaryContactSet attribute. 

The correct code to add a button on a page

define("ContactPageV2", [], function() {
	return {
		entitySchemaName: "",
		attributes: {},
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		methods: {
			onOpenPrimaryContactClick: function() {
				// Determining the base contact Id.
				var primaryId = this.get("Account") ? this.get("Account").value : null;
				if (primaryId) {
					// Forming the address string.
					var requestUrl = "CardModuleV2/AccountPageV2/edit/" + primaryId;
					// Publishing a message and going to the
					// base contact edit page.
					this.sandbox.publish("PushHistoryState", {
						hash: requestUrl
					});
				}
			}
		},
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				// Indicates that an operation of adding an item to the page is being executed.
				"operation": "insert",
				// Meta-name of the parent control item where the button is added.
				"parentName": "LeftContainer",
				// Indicates that the button is added to the control items collection
				// of the parent item (which name is specified in the parentName).
				"propertyName": "items",
				// Meta-name of the added button. .
				"name": "PrimaryContactButton",
				// Supplementary properties of the item.
				"values": {
					"style": Terrasoft.controls.ButtonEnums.style.BLUE,
					// Type of the added item is button.
					itemType: Terrasoft.ViewItemType.BUTTON,
					// Binding the button title to a localizable string of the schema.
					caption: "test",
					// Binding the button press handler method.
					click: {bindTo: "onOpenPrimaryContactClick"}
				}
			}
		]/**SCHEMA_DIFF*/
	};
});

 

Show all comments