+ Add post
Hi Community,
I have this scenario below, I want to create a business rule that will hide/unhide field if record is in add mode or edit mode. How can I possibly do this?
Like
Hi Community, Any idea on this? Thank you so much
Dear Fulgen,
It is possible to check a mode of a page using the “phantom” property of the “record” object https://prnt.sc/qkxh4q
If the value of the property is equal to “true” it is mean that the page is in the add mode and vice versa. Please see an example of the code below:
Terrasoft.sdk.Model.addBusinessRule("Case", {
ruleType: Terrasoft.RuleTypes.Custom,
position : 2,
triggeredByColumns: ["UsrIncidentType"],
events: [Terrasoft.BusinessRuleEvents.ValueChanged],
executeFn : function(record, rule, column, customData, callbackConfig){
if(record.phantom)
{
// true, when adding a new record (add mode)
alert("New record");
}
else
// edit mode
alert("Old record");
Ext.callback(callbackConfig.success, callbackConfig.scope, [true]);
});
Please find more information about a custom business rules in the article by the link below:
https://academy.creatio.com/documents/technic-sdkmob/7-15/custom-business-rules-mobile-application
Best regards,
Norton