# 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. ## Endpoints `POST /dcapi/reports/customReports/formulaColumn` ## Request URL `https://[{serverurl}](https://www.manageengine.com/products/desktop-central/help/api/cloud/oauth-authentication-endpoint-domain.html)/dcapi/reports/customReports/formulaColumn` ## Scope `DesktopCentralCloud.CustomReport.CREATE` ## Header `Authorization: Zoho-oauthtoken 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 curl --request POST \ --url https://appdomains/dcapi/reports/customReports/formulaColumn \ --header 'Accept: application/columnCreationStatus.v1+json' \ --header 'Authorization: Zoho-oauthtoken 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"}' ``` ### Java ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.io.IOException; import java.net.http.HttpTimeoutException; public class Main { public static void main(String[] args) { HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://appdomains/dcapi/reports/customReports/formulaColumn")) .header("Content-Type", "application/formulaColumn.v1+json") .header("Accept", "application/columnCreationStatus.v1+json") .header("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") .method("POST", HttpRequest.BodyPublishers.ofString("{\"defaultValue\":\"NotEligible\",\"columnDetails\":[{\"criteria\":[{\"comparator\":\"equal\",\"logicalOperator\":\"AND\",\"columnID\":\"42\",\"searchValue\":[\"Windows 11\"]}],\"value\":\"Eligible\",\"criteriaPattern\":\"1\"}],\"subModuleName\":\"Computer\",\"columnName\":\"Windows11Eligibility\"}")) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ### Python ```python import http.client conn = http.client.HTTPSConnection("appdomains") payload = "{\"defaultValue\":\"NotEligible\",\"columnDetails\":[{\"criteria\":[{\"comparator\":\"equal\",\"logicalOperator\":\"AND\",\"columnID\":\"42\",\"searchValue\":[\"Windows 11\"]}],\"value\":\"Eligible\",\"criteriaPattern\":\"1\"}],\"subModuleName\":\"Computer\",\"columnName\":\"Windows11Eligibility\"}" headers = { 'Content-Type': "application/formulaColumn.v1+json", 'Accept': "application/columnCreationStatus.v1+json", 'Authorization': "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52" } conn.request("POST", "/dcapi/reports/customReports/formulaColumn", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### Deluge ```javascript headersMap = Map(); headersMap.put("Content-Type", "application/formulaColumn.v1+json"); headersMap.put("Accept", "application/columnCreationStatus.v1+json"); data=Map(); data.put("defaultValue","value"); data_columnDetails=List(); data_columnDetails_item1=Map(); data_columnDetails_item1_criteria=List(); data_columnDetails_item1_criteria_item1=Map(); data_columnDetails_item1_criteria_item1.put("comparator","value"); data_columnDetails_item1_criteria_item1.put("logicalOperator","value"); data_columnDetails_item1_criteria_item1.put("columnID","value"); data_columnDetails_item1_criteria_item1_searchValue=List(); data_columnDetails_item1_criteria_item1.put("searchValue",data_columnDetails_item1_criteria_item1_searchValue); data_columnDetails_item1_criteria.add(data_columnDetails_item1_criteria_item1); data_columnDetails_item1.put("criteria",data_columnDetails_item1_criteria); data_columnDetails_item1.put("value","value"); data_columnDetails_item1.put("criteriaPattern","value"); data_columnDetails.add(data_columnDetails_item1); data.put("columnDetails",data_columnDetails); data.put("subModuleName","value"); data.put("columnName","value"); response = invokeUrl [ url: "https://appDomains/dcapi/reports/customReports/formulaColumn" type: POST headers: headersMap body: data connection: connection_name ] info response; ``` ### PowerShell ```powershell $headers=@{} $headers.Add("Content-Type", "application/formulaColumn.v1+json") $headers.Add("Accept", "application/columnCreationStatus.v1+json") $headers.Add("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") $response = Invoke-WebRequest -Uri 'https://appdomains/dcapi/reports/customReports/formulaColumn' -Method POST -Headers $headers -ContentType 'application/formulaColumn.v1+json' -Body '{"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`: Error code indicating insufficient permissions. - `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 reached threshold. - `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 Response: 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" } ] } ``` ## Sample Response: 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" } ``` ## Sample Response: HTTP 403 ### User does not have the required role ```json { "errorMessage": "User does not have the required role to access this resource", "errorCode": "403" } ``` ## Sample Response: HTTP 412 ### Maximum formula column limit (100) reached ```json { "errorMessage": "Maximum number of formula column limit(100) reached", "errorCode": "412" } ``` ## Sample Response: HTTP 417 ### Custom Report V2 is not enabled ```json { "errorMessage": "Custom Report V2 is not enabled", "errorCode": "417" } ``` ## Sample Response: HTTP 429 ### Rate limit exceeded ```json { "errorMessage": "Rate limit exceeded. Please retry after some time", "errorCode": "429" } ``` ## Sample Response: HTTP 500 ### Unexpected failure during formula column creation ```json { "errorMessage": "Internal server error while creating formula column", "errorCode": "500" } ``` ## Rate Limits **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.