I have added a custom button called "Confirm Audience" to a detail and it's working fine. but in the meantime, I need to disable the button once I click on it. So far I tried to disable it using an attribute, which is mentioned in this article.
https://community.creatio.com/questions/how-can-i-disable-button-once-clicked
While implementing that scenario I am facing an issue which is when we reload the page or go back and come back to the same record, the button behavior will be going back to its default behavior. If there is a way to achieve this please help me on this.
And this is how I added the button to my schema.
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"name": "ConfirmAudienceButton",
"parentName": "Detail",
"propertyName": "tools",
"values": {
"itemType": Terrasoft.ViewItemType.BUTTON,
"caption": {"bindTo": "Resources.Strings.BEACSConfirmButtonCaption"},
"click": {"bindTo": "onConfirmButtonClick"}, //method to trigger the button
"style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
"visible": {"bindTo": "getIsConfirmAudienceEnabled"}
}
}
]/**SCHEMA_DIFF*/,
methods: {
onConfirmButtonClick: function() {
var recordID = this.values.MasterRecordId;
var confirmAudienceBoolean = this.values.MasterRecordId.BEACSConfirmAudience;
var args = {
sysProcessName: "BEACSProcess_1df603c",
parameters: {
ProcessSchemaRecordId:recordID,
}
};
ProcessModuleUtilities.executeProcess(args);
this.set("isConfirmButtonClicked",false);
},
getIsConfirmAudienceEnabled: function() {
return !this.$IsGridEmpty;
},
}