Your first calculated attribute script
A calculated attribute evaluates its script when the attribute's value is needed. The current entity is available as subject, and the script's returned value becomes the attribute value.
- Create or edit a calculated attribute for the
Crm.Sales.Customersrepository. - Configure it to return a string and select
JavaScriptas its script language. - Set its script text to:
return subject.Active ? "Active" : "Inactive";
- Save the attribute and read its value for a customer.
Calculated-attribute JavaScript is a function body, so a top-level return is valid. It does not use a managed-script parameter schema or return envelope. Keep calculations efficient: this value may be requested repeatedly in forms, lists, and reports. See configuration and calculated-attribute examples.