Skip to main content
Version: 8.0

Generate the activity title in the mobile app

Level: advanced
Example

Implement generating the activity header for the FieldForce solution.

Example implementation

Generating the activity header
Terrasoft.sdk.Model.addBusinessRule("Activity", {
name: "FieldForceActivityTitleRule",
ruleType: Terrasoft.RuleTypes.Custom,
triggeredByColumns: ["Account", "Type"],
events: [Terrasoft.BusinessRuleEvents.ValueChanged, Terrasoft.BusinessRuleEvents.Load],
executeFn: function(record, rule, column, customData, callbackConfig, event) {
if (event === Terrasoft.BusinessRuleEvents.ValueChanged || record.phantom) {
var type = record.get("Type");
var typeId = type ? type.get("Id") : null;
if (typeId !== Terrasoft.Configuration.ActivityTypes.Visit) {
Ext.callback(callbackConfig.success, callbackConfig.scope, [true]);
return;
}
var account = record.get("Account");
var accountName = (account) ? account.getPrimaryDisplayColumnValue() : "";
var title = Ext.String.format("{0}: {1}", Terrasoft.LocalizableStrings.FieldForceTitlePrefix, accountName);
record.set("Title", title, true);
}
Ext.callback(callbackConfig.success, callbackConfig.scope, [true]);
}
});