Back to Collection Items
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")
set http = CreateObject("Chilkat.Http")
' Use this online tool to generate code from sample JSON: Generate Code to Create JSON
' The following JSON is sent in the request body.
' {
' "conditions": {
' "conditionsList": [
' {
' "fieldName": "IsDeleted",
' "value": true
' }
' ]
' }
' }
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = CreateObject("Chilkat.JsonObject")
success = json.UpdateString("conditions.conditionsList[0].fieldName","IsDeleted")
success = json.UpdateBool("conditions.conditionsList[0].value",1)
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
' resp is a Chilkat.HttpResponse
Set resp = http.PostJson3("https://domain.com/services/data/v{{version}}/connect/business-rules/decision-table/:decisionTableId","application/json",json)
If (http.LastMethodSuccess = 0) Then
outFile.WriteLine(http.LastErrorText)
WScript.Quit
End If
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbResponseBody = CreateObject("Chilkat.StringBuilder")
success = resp.GetBodySb(sbResponseBody)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set jResp = CreateObject("Chilkat.JsonObject")
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0
outFile.WriteLine("Response Body:")
outFile.WriteLine(jResp.Emit())
respStatusCode = resp.StatusCode
outFile.WriteLine("Response Status Code = " & respStatusCode)
If (respStatusCode >= 400) Then
outFile.WriteLine("Response Header:")
outFile.WriteLine(resp.Header)
outFile.WriteLine("Failed.")
WScript.Quit
End If
' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)
' {
' "errorCode": null,
' "errorMessage": null,
' "outcomeList": [
' ],
' "outcomeType": "No Match",
' "successStatus": true
' }
' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
errorCode = jResp.StringOf("errorCode")
errorMessage = jResp.StringOf("errorMessage")
outcomeType = jResp.StringOf("outcomeType")
successStatus = jResp.BoolOf("successStatus")
i = 0
count_i = jResp.SizeOfArray("outcomeList")
Do While i < count_i
jResp.I = i
i = i + 1
Loop
outFile.Close
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-d '{
"conditions": {
"conditionsList": [
{
"fieldName": "IsDeleted",
"value": true
}
]
}
}'
https://domain.com/services/data/v{{version}}/connect/business-rules/decision-table/:decisionTableId
Postman Collection Item JSON
{
"name": "Lookup Table",
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"conditions\": {\n \"conditionsList\": [\n {\n \"fieldName\": \"IsDeleted\",\n \"value\": true\n }\n ]\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/decision-table/:decisionTableId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"decision-table",
":decisionTableId"
],
"variable": [
{
"key": "decisionTableId",
"value": "0lDHo0000008Pnt",
"description": "Decision Table Id"
}
]
},
"description": "# Decision Table (Lookup Table)\n\nPerforms a lookup on a decision table.Resource\n\n```\n/connect/business-rules/decision-table/${decisionTableId}\n\n ```\n\nResource Example\n\n```\nhttps://yourInstance.salesforce.com/services/data/v55.0/connect\n/decision-table/0lDB0000000TNQzMAO\n\n ```\n\nAvailable version\n\n55.0\n\nRequires Chatter\n\nNo\n\nHTTP methods\n\nPOST\n\nRequest body for POST\n\nJSON example\n\n```\n{\n \"conditions\" : {\n \"conditionsList\" : [\n {\n \"fieldName\": \"state__c\",\n \"value\": \"MH\"\n },\n {\n \"fieldName\": \"validity__c\",\n \"value\": 30\n }\n ]\n }\n}\n\n ```\n\nProperties\n\n| Name | Type | Description | Required or Optional | Available Version |\n| --- | --- | --- | --- | --- |\n| conditions | [Decision Table Condition](https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_requests_decision_table_condition.htm)\\[\\] | The list of decision table conditions on which the decision table executes and provides outcomes. | Required | 55.0 |\n| datasetLinkName | String | The API name of the dataset link provided as an input for the decision table execution. | Optional | 55.0 |\n\nResponse body for POST\n\n[Decision Table Outcome](https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_responses_decision_table_outcome.htm)\n\n# Decision Table Outcome\n\nOutput representation of the decision table execution.JSON example\n\n```\n{\n \"errorCode\" : null,\n \"errorMessage\" : null,\n \"outcomeList\" : [ {\n \"values\" : {\n \"amount__c\" : \"399\",\n \"Name\" : \"MH 005\"\n }\n }, {\n \"values\" : {\n \"amount__c\" : \"499\",\n \"Name\" : \"MH 006\"\n }\n }, {\n \"values\" : {\n \"amount__c\" : \"379\",\n \"Name\" : \"MH 007\"\n }\n }, {\n \"values\" : {\n \"amount__c\" : \"1498\",\n \"Name\" : \"MH 008\"\n }\n }, {\n \"values\" : {\n \"amount__c\" : \"98\",\n \"Name\" : \"MH 009\"\n }\n }, {\n \"values\" : {\n \"amount__c\" : \"251\",\n \"Name\" : \"MH 010\"\n }\n } ],\n \"outcomeType\" : \"Multiple Matches\",\n \"successStatus\" : true\n}\n\n ```\n\n| Property Name | Type | Description | Filter Group and Version | Available Version |\n| --- | --- | --- | --- | --- |\n| errorCode | Integer | The error code if transaction fails for any reason. | Small, 55.0 | 55.0 |\n| errorMessage | String | The error message if transaction fails for any reason. | Small, 55.0 | 55.0 |\n| outcomeList | [Decision Table Outcome Item](https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_responses_decision_table_outcome_item.htm)\\[\\] | Outcome list that stores two or more outcomes provided by the decision table. | Small, 55.0 | 55.0 |\n| outcomeType | String | The outcome type after the request is successful. | Small, 55.0 | 55.0 |\n| successStatus | Boolean | Indicates the status of the decision table execution. | Small, 55.0 | 55.0 |"
},
"response": [
{
"name": "Status400-BadRequest",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"conditions\": {\n \"conditionsList\": [\n {\n \"fieldName\": \"state__c\",\n \"value\": \"MH\"\n },\n {\n \"fieldName\": \"validity__c\",\n \"value\": 30\n }\n ]\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/decision-table/:decisionTableId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"decision-table",
":decisionTableId"
],
"variable": [
{
"key": "decisionTableId",
"value": "0lIHo000000LFC6MAO",
"description": "Decision Table Id"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Tue, 19 Sep 2023 12:16:33 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "[\n {\n \"errorCode\": \"INVALID_ID_FIELD\",\n \"message\": \"Invalid identifier: 0lIHo000000LFC6MAO\"\n }\n]"
},
{
"name": "Status500-UnknownException",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"conditions\": {\n \"conditionsList\": [\n {\n \"fieldName\": \"Comment Count\",\n \"value\": 1\n }\n ]\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/decision-table/:decisionTableId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"decision-table",
":decisionTableId"
],
"variable": [
{
"key": "decisionTableId",
"value": "0lDHo0000008PnjMAE",
"description": "Decision Table Id"
}
]
}
},
"status": "Server Error",
"code": 500,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Tue, 19 Sep 2023 12:31:01 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "[\n {\n \"message\": \"An unexpected error occurred. Please include this ErrorId if you contact support: 1716762391-743375 (1633993601)\",\n \"errorCode\": \"UNKNOWN_EXCEPTION\"\n }\n]"
},
{
"name": "Status201-Success",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"conditions\": {\n \"conditionsList\": [\n {\n \"fieldName\": \"IsDeleted\",\n \"value\": true\n }\n ]\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/decision-table/:decisionTableId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"decision-table",
":decisionTableId"
],
"variable": [
{
"key": "decisionTableId",
"value": "0lDHo0000008Pnt",
"description": "Decision Table Id"
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Tue, 19 Sep 2023 13:22:05 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "{\n \"errorCode\": null,\n \"errorMessage\": null,\n \"outcomeList\": [],\n \"outcomeType\": \"No Match\",\n \"successStatus\": true\n}"
}
]
}