# Create a new formula column under a specified sub-module Creates a new formula column under a specified sub-module. A formula column is a computed/derived column that works like a CASE-WHEN expression — it evaluates conditions (criteria) against existing report columns and returns a configured value for each match, with a default fallback value. The response includes the newly created column's ID, resolved data type, groupability, and available aggregation options. ## Endpoint `POST /dcapi/reports/customReports/formulaColumn` ## Request ### Request URL `https://{server-hostname}:8383/dcapi/reports/customReports/formulaColumn` ### Scope `CustomReport.CREATE` ### Header `Authorization: d92d4xxxxxxxxxxxxx15f52` ### Request Parameters #### Request Headers - **Content-Type** (`string`, mandatory): `application/formulaColumn.v1+json` - **Accept** (`string`, mandatory): `application/columnCreationStatus.v1+json` #### Request Body `application/json` - **subModuleName** (`string`, mandatory): Sub-module name the formula column belongs to. Must be one of: Computer, Hardware, Software (case-insensitive). - **columnName** (`string`, mandatory): Unique display name for the formula column. Alphanumeric only (A-Z, a-z, 0-9). Max 20 characters. - **defaultValue** (`string`, mandatory): Default value returned when no condition matches (the ELSE branch). Alphanumeric only. Max 100 characters. - **columnDetails** (`JSON array`, mandatory): Array of condition objects (1-5). Each defines a CASE-WHEN branch with criteria and result value. ### Sample Request ```curl curl --request POST \ --url https://appdomain/dcapi/reports/customReports/formulaColumn \ --header 'Accept: application/columnCreationStatus.v1+json' \ --header 'Authorization: d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/formulaColumn.v1+json' \ --data '{"defaultValue":"NotEligible","columnDetails":[{"criteria":[{"comparator":"equal","logicalOperator":"AND","columnID":"42","searchValue":["Windows 11"]}],"value":"Eligible","criteriaPattern":"1"}],"subModuleName":"Computer","columnName":"Windows11Eligibility"}' ``` ### Sample Request Body #### Create a CHAR-type formula column with one condition ```json { "defaultValue": "NotEligible", "columnDetails": [ { "criteria": [ { "comparator": "equal", "logicalOperator": "AND", "columnID": "42", "searchValue": [ "Windows 11" ] } ], "value": "Eligible", "criteriaPattern": "1" } ], "subModuleName": "Computer", "columnName": "Windows11Eligibility" } ``` #### Create a formula column with multiple CASE-WHEN conditions ```json { "defaultValue": "Other", "columnDetails": [ { "criteria": [ { "comparator": "contains", "logicalOperator": "AND", "columnID": "103", "searchValue": [ "Windows" ] } ], "value": "Windows", "criteriaPattern": "1" }, { "criteria": [ { "comparator": "contains", "logicalOperator": "AND", "columnID": "103", "searchValue": [ "Linux" ] }, { "comparator": "contains", "logicalOperator": "OR", "columnID": "103", "searchValue": [ "Ubuntu" ] } ], "value": "Linux", "criteriaPattern": "1 OR 2" } ], "subModuleName": "Computer", "columnName": "OSCategory" } ``` ## Response Parameters ### HTTP Code 200 Response body: `application/json` - **columnID** (`long`): Unique identifier of the newly created formula column. - **displayName** (`string`): Display name of the formula column (echoed from columnName in the request). - **dataType** (`string`): Resolved data type of the column based on all condition values and the default value. Possible values: CHAR, BIGINT, BOOLEAN. - **groupable** (`boolean`): Whether the column can be used as a group-by column in custom reports. True for CHAR and BIGINT types, false for BOOLEAN. - **aggOptions** (`JSON array`): List of aggregation functions available for this column. Varies by dataType: CHAR gets ACTUAL_VALUE, COUNT, STRING_AGG; BIGINT gets ACTUAL_VALUE, COUNT, SUM, MIN, MAX, AVG. ### HTTP Code 400 Response body: `application/json` - **errorCode** (`string`): Error code for validation failure: 400 = formula column name already exists, condition limit exceeded (max 5), criteria limit exceeded (max 30), or unknown/inaccessible column ID in criteria. - **errorMessage** (`string`): Human-readable message describing the specific validation failure. ### HTTP Code 403 Response body: `application/json` - **errorCode** (`long`): Forbidden error code returned when the authenticated user does not have the required uem-roles (e.g., DataEncryption_Admin or DataEncryptionRecoveryKey_Admin). - **errorMsg** (`string`): Message indicating insufficient privileges to access this resource. ### HTTP Code 412 Response body: `application/json` - **errorCode** (`string`): Precondition failed error code: 412 = maximum formula column limit (100) reached across the organization. - **errorMessage** (`string`): Message indicating the formula column creation limit has been reached. ### HTTP Code 417 Response body: `application/json` - **errorCode** (`string`): Expectation failed error code: Custom Report V2 is not enabled. - **errorMessage** (`string`): Message indicating Custom Report V2 feature is not active. ### HTTP Code 429 Response body: `application/json` - **errorCode** (`long`): Rate limit error code returned when the API call threshold (configured via threshold/duration in security XML) is exceeded; client is locked out for lock-period minutes. - **errorMsg** (`string`): Rate limit exceeded message with retry guidance. ### HTTP Code 500 Response body: `application/json` - **errorCode** (`string`): Internal error code: unexpected failure during formula column creation (e.g., database exception). - **errorMessage** (`string`): Detailed error description for the internal server error during formula column creation. ## Possible Response Codes - `200` HTTP code - `400` HTTP code - `403` HTTP code - `412` HTTP code - `417` HTTP code - `429` HTTP code - `500` HTTP code ## Sample Responses ### HTTP 200 #### Newly created CHAR-type formula column with string aggregation options ```json { "columnID": "1", "displayName": "Windows11Eligibility", "dataType": "CHAR", "groupable": true, "aggOptions": [ { "displayValue": "Actual Value", "method": "ACTUAL_VALUE" }, { "displayValue": "Count", "method": "COUNT" }, { "displayValue": "String Aggregate", "method": "STRING_AGG" } ] } ``` #### Newly created BIGINT-type formula column with numeric aggregation options ```json { "columnID": "2", "displayName": "ScoreCategory", "dataType": "BIGINT", "groupable": true, "aggOptions": [ { "displayValue": "Actual Value", "method": "ACTUAL_VALUE" }, { "displayValue": "Count", "method": "COUNT" }, { "displayValue": "Sum", "method": "SUM" }, { "displayValue": "Minimum", "method": "MIN" }, { "displayValue": "Maximum", "method": "MAX" }, { "displayValue": "Average", "method": "AVG" } ] } ``` ### HTTP 400 #### Formula column name already exists ```json { "errorMessage": "Formula column name already exists", "errorCode": "400" } ``` #### Number of conditions exceeds the maximum limit ```json { "errorMessage": "Number of formula condition limit(5) exceeded", "errorCode": "400" } ``` ### HTTP 403 #### User does not have the required role ```json { "errorMessage": "User does not have the required role to access this resource", "errorCode": "403" } ``` ### HTTP 412 #### Maximum formula column limit (100) reached ```json { "errorMessage": "Maximum number of formula column limit(100) reached", "errorCode": "412" } ``` ### HTTP 417 #### Custom Report V2 is not enabled ```json { "errorMessage": "Custom Report V2 is not enabled", "errorCode": "417" } ``` ### HTTP 429 #### Rate limit exceeded ```json { "errorMessage": "Rate limit exceeded. Please retry after some time", "errorCode": "429" } ``` ### HTTP 500 #### Unexpected failure during formula column creation ```json { "errorMessage": "Internal server error while creating formula column", "errorCode": "500" } ``` ## Rate Limit ![](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 30 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.