Hi all,
I follow the Creatio Guiding: https://academy.creatio.com/documents/technic-sdk/7-16/locking-edit-page-fields
to block the detail based on the condition. Here is my code:
isDetailEnabled: function(detailName) {
if ((detailName === "Installment plan") && detailName === "Products") {
var status = this.get("Status");
var condition = !!status && (status.displayValue === "2. Confirmation"
|| status.displayValue === "4. Completed");
return condition;
}
return this.callParent(arguments);
},
But it does not completely block all fields in details
User can change the products, invoice and also open this record.
Please guide me on how to completely block all fields and remove the button open in screenshot.
Best Regards,
Akira Nguyen
Like
Dear Phuong,
The using of the “isDetailEnabled” function allows completely block all fields on the detail. In your case, this solution doesn’t work since you compare the “detailName” argument with a wrong value. You should compare it with the “SupplyPaymentDetailV2” value, since it is the name of the detail schema. Please see the screenshot below:
Please find the example of the correct code below:
define("OrderPageV2", [], function(){ return { methods: { isDetailEnabled: function(detailSchemaName){ if (detailSchemaName === "SupplyPaymentDetailV2") { var status = this.get("Status"); var condition = !!status && (status.displayValue === "2. Confirmation" || status.displayValue === "4. Completed"); return condition; } return this.callParent(arguments); } } }; });
Best regards,
Norton
Dear Norton,
How are you? Thanks for your feedback.
I follow your guide
methods: {
getDisableExclusionsColumnTags: function() {
return ["Status"];
},
setCardLockoutStatus: function() {
var state = this.get("Status");
if (!!state && (state.displayValue === "2. Confirmation" || state.displayValue === "4. Completed")) {
this.set("IsModelItemsEnabled", false);
} else {
this.set("IsModelItemsEnabled", true);
}
},
isDetailEnabled: function(detailSchemaName) {
if ((detailSchemaName === "SupplyPaymentDetailV2") && detailSchemaName === "OrderProductDetailV2"){
var status = this.get("Status");
var condition = !!status && (status.displayValue === "2. Confirmation"
|| status.displayValue === "4. Completed");
return condition;
}
return this.callParent(arguments);
},
onEntityInitialized: function() {
this.callParent(arguments);
this.setCardLockoutStatus();
},
},
But OrderProductDetail & SupplyPaymentDetail are not totally block. Please see the screenshot
User cannot create/edit/delete records. But they can change product and price fields
SupplyPaymentDetail is not completed block, too
User can edit product, create invoice and open edit page when click on record
Please guide me how to fix all these things.
Thanks and Best Regards,
Akira Nguyen
Phuong Akira,
The issue happens because you use a wrong condition in the if-statement from the “isDetailEnabled” method. Please change it to the following:
if (detailSchemaName === "SupplyPaymentDetailV2" || detailSchemaName === "OrderProductDetailV2") {
Best regards,
Norton
Hi Norton,
Thanks for your feedback.
I follow your guide but it does not work. Btw, I use a business rule to set uneditable for invoice columns, but cannot do for products column.
Regards,
Akira Nguyen
Phuong Akira,
I tested the code on my local instance and it worked properly for me. Please consider debugging the client code in order to determine the root cause of the issue. Please find more information about it in the articles by the links below:
https://academy.creatio.com/documents/technic-sdk/7-16/client-code-debugging
https://academy.creatio.com/documents/technic-sdk/7-16/isdebug-mode
Best regards,
Norton
Hi Norton,
I don't know why but I tested with trial site. 2 columns are not block. BTW, I can use business rule to block the INV column. Thanks for your support.
Regards,
Akira Nguyen