Once the Case stage is changed from Rejected to Product manager Approval, The button has to be disabled automatically without refresh
I have a button called "Submit For Approval" in the edit page. The button will be enabled when the case stage is rejected
On click of that button, the case stage will be changed to product manager approval. Now the button should be disabled automatically without clicking the refresh button. Please find the code snippet below. I tried adding this.save(); this._closePage(); this .reloadEntity(); once the stage is changed as highlighted in bold below. But it is not working. Kindly help me resolve the same
isSubmitForApprovalButtonEnabled: function() {
var stage = this.get("UsrConcessionStage") ? this.get("UsrConcessionStage").displayValue : " " ;
if (stage === "Rejected"){
return true;
}
else{
return false;
}
return (stage==="Rejected")?true:false;
},
onSubmitForApprovalButtonClick:function(){
//this.console.log(this.get("UsrConcessionStage"));
var contacttype = this.get("UsrContactType") ? this.get("UsrContactType").displayValue : " ";
window.console.log(contacttype);
if(contacttype=== "TB"){
var value = {
value: "cfc713d1-8228-4c3a-a332-4f446836cc1f",
displayValue: "Product Manager Approval",
primaryImageValue: ""};
this.set("UsrConcessionStage", value);
}
if(contacttype === "RM") {
var stagevalue ={
value: "ea419a2b-886f-4e16-add1-7665899822d7",
displayValue: "Head of Liabilities/Landing",
primaryImageValue: ""};
this.set("UsrConcessionStage", stagevalue);
}
this.save();
this._closePage();
this .reloadEntity();
},
{
"operation": "insert",
"name": "SubmitForApproval",
"values": {
"itemType": 5,
"caption": {
"bindTo": "Resources.Strings.SubmitForApprovalButtonCaption"
},
"enabled": {
"bindTo": "isSubmitForApprovalButtonEnabled"
},
"click": {
"bindTo": "onSubmitForApprovalButtonClick"
},
"visible": {
"bindTo": "IsButtonEnabled"
},
"style": "green"
},
"parentName": "LeftContainer",
"propertyName": "items",
"index": 7
},
Like
Hi Sri Saranya,
Please check the example of how we have implemented such a feature at our demo Creatio:
1. Firstly, you need to create a replacing client module schema for the "CasePage" client module (set "Edit page schema - "Cases" section ( Case )" as a parent object). Please find the information about it in the article by the link below:
https://academy.creatio.com/documents/technic-sdk/7-16/creating-custom-…
2. In a new replacing client schema, please insert the code below:
define("CasePage", [], function() { return { entitySchemaName: "Case", attributes: { "isBtnStatus": { "dataValueType": this.Terrasoft.DataValueType.BOOLEAN, "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": true } }, modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/, details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, messages:{}, businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/, methods: { init: function() { this.callParent(arguments); }, onEntityInitialized: function() { this.callParent(arguments); var caseStatus = this.get("Status").displayValue; if (caseStatus === "TestStatus") { this.set("isBtnStatus", false); } else { this.set("isBtnStatus", true); } }, onOpenPrimaryContactClick: function() { // your code }, isBtnEnabled: function() { if (this.get("isBtnStatus") === true) { return true; } else { return false; } } }, dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/, diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "parentName": "ProfileContainer", "propertyName": "items", "name": "TESTBtn", "values": { itemType: Terrasoft.ViewItemType.BUTTON, caption: { bindTo: "Resources.Strings.TESTBtn" }, click: { bindTo: "onOpenPrimaryContactClick" }, enabled: { bindTo: "isBtnEnabled" }, "layout": { "column": 1, "row": 25, "colSpan": 5 } } } ]/**SCHEMA_DIFF*/ }; });
3. Please create a new localizable string following the instructions by this link:
https://academy.creatio.com/documents/technic-sdk/7-16/how-add-button-s…
4. Save the changes and hard-reload the case page.
Regards,
Anastasiia
Hi Anastasiia ,
I have created the button as per the below link (Combined mode). The button is in edit page. so on click of the button, the status gets changed from "Rejected" to product manager approval" so ideally after the button is clicked it should get disabled
https://academy.creatio.com/documents/technic-sdk/7-16/how-add-button-e…
Sri Saranya,
I checked this button with Anastasiia and the button is disabled upon clicking on it (additional check is performed on case status). So you need to create the logic using the example Anastasiia shared with you.
Best regards,
Oscar