Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://domain.com/services/data/v{{version}}/ui-api/layout/:SOBJECT_API_NAME', @sbResponseBody
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/ui-api/layout/:SOBJECT_API_NAME
Postman Collection Item JSON
{
"name": "Get Record Layout Metadata",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/layout/:SOBJECT_API_NAME",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"ui-api",
"layout",
":SOBJECT_API_NAME"
],
"query": [
{
"key": "formFactor",
"value": "",
"description": "The layout display size for the record. One of these values:\nLarge—(Default) Use this value to get a layout for desktop display size.\nMedium—Use this value to get a layout for tablet display size.\nSmall—Use this value to get a layout for phone display size.",
"disabled": true
},
{
"key": "layoutTypes",
"value": "",
"description": "The layout type for the record. A collection of any of these values:\nCompact—Use this value to get a layout that contains a record’s key fields.\nFull—(Default) Use this value to get a full layout.",
"disabled": true
},
{
"key": "modes",
"value": "",
"description": "The access mode for the record. This value determines which fields to get from a layout. Layouts have different fields for create, edit, and view modes. For example, formula fields are rendered in view mode, but not in create mode because they’re calculated at run time, like formulas in a spreadsheet. A collection of any of these values:\nCreate—Use this mode if you intend to build UI that lets a user create a record. This mode is used by the /ui-api/record-defaults/create/<SOBJECT_API_NAME> resource.\nEdit—Use this mode if you intend to build UI that lets a user edit a record. This mode is used by the /ui-api/record-defaults/clone/<RECORD_ID> resource.\nView—(Default) Use this mode if you intend to build UI that displays a record.",
"disabled": true
},
{
"key": "recordTypeId",
"value": "",
"description": "The ID of the record type (RecordType object) for the new record. If not provided, the default record type is used.",
"disabled": true
}
],
"variable": [
{
"key": "SOBJECT_API_NAME",
"value": ""
}
]
},
"description": "Get metadata about page layouts for the specified object type."
},
"response": [
{
"name": "Get Record Layout Metadata",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/layout/:SOBJECT_API_NAME",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"ui-api",
"layout",
":SOBJECT_API_NAME"
],
"query": [
{
"key": "formFactor",
"value": "",
"description": "The layout display size for the record. One of these values:\nLarge—(Default) Use this value to get a layout for desktop display size.\nMedium—Use this value to get a layout for tablet display size.\nSmall—Use this value to get a layout for phone display size.",
"disabled": true
},
{
"key": "layoutTypes",
"value": "",
"description": "The layout type for the record. A collection of any of these values:\nCompact—Use this value to get a layout that contains a record’s key fields.\nFull—(Default) Use this value to get a full layout.",
"disabled": true
},
{
"key": "modes",
"value": "",
"description": "The access mode for the record. This value determines which fields to get from a layout. Layouts have different fields for create, edit, and view modes. For example, formula fields are rendered in view mode, but not in create mode because they’re calculated at run time, like formulas in a spreadsheet. A collection of any of these values:\nCreate—Use this mode if you intend to build UI that lets a user create a record. This mode is used by the /ui-api/record-defaults/create/<SOBJECT_API_NAME> resource.\nEdit—Use this mode if you intend to build UI that lets a user edit a record. This mode is used by the /ui-api/record-defaults/clone/<RECORD_ID> resource.\nView—(Default) Use this mode if you intend to build UI that displays a record.",
"disabled": true
},
{
"key": "recordTypeId",
"value": "",
"description": "The ID of the record type (RecordType object) for the new record. If not provided, the default record type is used.",
"disabled": true
}
],
"variable": [
{
"key": "SOBJECT_API_NAME",
"value": "Account"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 27 Sep 2023 15:54:02 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": "ETag",
"value": "\"07ce091fdbe7461d6b2a8813c63d3124--gzip\""
},
{
"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 \"eTag\": \"07ce091fdbe7461d6b2a8813c63d3124\",\n \"id\": \"00hB0000000JrBIIA0\",\n \"layoutType\": \"Full\",\n \"mode\": \"View\",\n \"objectApiName\": \"Account\",\n \"recordTypeId\": \"012000000000000AAA\",\n \"saveOptions\": [],\n \"sections\": [\n {\n \"collapsible\": false,\n \"columns\": 2,\n \"heading\": \"Account Information\",\n \"id\": \"01BB0000002rP1oMAE\",\n \"layoutRows\": [\n {\n \"layoutItems\": [\n {\n \"editableForNew\": false,\n \"editableForUpdate\": false,\n \"label\": \"Account Owner\",\n \"layoutComponents\": [\n {\n \"apiName\": \"OwnerId\",\n \"componentType\": \"Field\",\n \"label\": \"Owner ID\"\n }\n ],\n \"lookupIdApiName\": \"OwnerId\",\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Rating\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Rating\",\n \"componentType\": \"Field\",\n \"label\": \"Account Rating\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Account Name\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Name\",\n \"componentType\": \"Field\",\n \"label\": \"Account Name\"\n }\n ],\n \"lookupIdApiName\": \"Id\",\n \"required\": true,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Phone\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Phone\",\n \"componentType\": \"Field\",\n \"label\": \"Account Phone\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Parent Account\",\n \"layoutComponents\": [\n {\n \"apiName\": \"ParentId\",\n \"componentType\": \"Field\",\n \"label\": \"Parent Account ID\"\n }\n ],\n \"lookupIdApiName\": \"ParentId\",\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Fax\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Fax\",\n \"componentType\": \"Field\",\n \"label\": \"Account Fax\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Account Number\",\n \"layoutComponents\": [\n {\n \"apiName\": \"AccountNumber\",\n \"componentType\": \"Field\",\n \"label\": \"Account Number\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Website\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Website\",\n \"componentType\": \"Field\",\n \"label\": \"Website\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Account Site\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Site\",\n \"componentType\": \"Field\",\n \"label\": \"Account Site\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Ticker Symbol\",\n \"layoutComponents\": [\n {\n \"apiName\": \"TickerSymbol\",\n \"componentType\": \"Field\",\n \"label\": \"Ticker Symbol\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Type\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Type\",\n \"componentType\": \"Field\",\n \"label\": \"Account Type\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Ownership\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Ownership\",\n \"componentType\": \"Field\",\n \"label\": \"Ownership\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Industry\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Industry\",\n \"componentType\": \"Field\",\n \"label\": \"Industry\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Employees\",\n \"layoutComponents\": [\n {\n \"apiName\": \"NumberOfEmployees\",\n \"componentType\": \"Field\",\n \"label\": \"Employees\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Annual Revenue\",\n \"layoutComponents\": [\n {\n \"apiName\": \"AnnualRevenue\",\n \"componentType\": \"Field\",\n \"label\": \"Annual Revenue\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"SIC Code\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Sic\",\n \"componentType\": \"Field\",\n \"label\": \"SIC Code\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n }\n ],\n \"rows\": 8,\n \"useHeading\": false\n },\n {\n \"collapsible\": false,\n \"columns\": 2,\n \"heading\": \"Address Information\",\n \"id\": \"01BB0000002rP1sMAE\",\n \"layoutRows\": [\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Billing Address\",\n \"layoutComponents\": [\n {\n \"apiName\": \"BillingStreet\",\n \"componentType\": \"Field\",\n \"label\": \"Billing Street\"\n },\n {\n \"apiName\": \"BillingPostalCode\",\n \"componentType\": \"Field\",\n \"label\": \"Billing Zip/Postal Code\"\n },\n {\n \"apiName\": \"BillingCity\",\n \"componentType\": \"Field\",\n \"label\": \"Billing City\"\n },\n {\n \"apiName\": \"BillingState\",\n \"componentType\": \"Field\",\n \"label\": \"Billing State/Province\"\n },\n {\n \"apiName\": \"BillingCountry\",\n \"componentType\": \"Field\",\n \"label\": \"Billing Country\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Shipping Address\",\n \"layoutComponents\": [\n {\n \"apiName\": \"ShippingStreet\",\n \"componentType\": \"Field\",\n \"label\": \"Shipping Street\"\n },\n {\n \"apiName\": \"ShippingPostalCode\",\n \"componentType\": \"Field\",\n \"label\": \"Shipping Zip/Postal Code\"\n },\n {\n \"apiName\": \"ShippingCity\",\n \"componentType\": \"Field\",\n \"label\": \"Shipping City\"\n },\n {\n \"apiName\": \"ShippingState\",\n \"componentType\": \"Field\",\n \"label\": \"Shipping State/Province\"\n },\n {\n \"apiName\": \"ShippingCountry\",\n \"componentType\": \"Field\",\n \"label\": \"Shipping Country\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n }\n ],\n \"rows\": 1,\n \"useHeading\": false\n },\n {\n \"collapsible\": false,\n \"columns\": 2,\n \"heading\": \"Additional Information\",\n \"id\": \"01BB0000002rP1pMAE\",\n \"layoutRows\": [\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Customer Priority\",\n \"layoutComponents\": [\n {\n \"apiName\": \"CustomerPriority__c\",\n \"componentType\": \"Field\",\n \"label\": \"Customer Priority\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"SLA\",\n \"layoutComponents\": [\n {\n \"apiName\": \"SLA__c\",\n \"componentType\": \"Field\",\n \"label\": \"SLA\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"SLA Expiration Date\",\n \"layoutComponents\": [\n {\n \"apiName\": \"SLAExpirationDate__c\",\n \"componentType\": \"Field\",\n \"label\": \"SLA Expiration Date\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"SLA Serial Number\",\n \"layoutComponents\": [\n {\n \"apiName\": \"SLASerialNumber__c\",\n \"componentType\": \"Field\",\n \"label\": \"SLA Serial Number\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Number of Locations\",\n \"layoutComponents\": [\n {\n \"apiName\": \"NumberofLocations__c\",\n \"componentType\": \"Field\",\n \"label\": \"Number of Locations\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Upsell Opportunity\",\n \"layoutComponents\": [\n {\n \"apiName\": \"UpsellOpportunity__c\",\n \"componentType\": \"Field\",\n \"label\": \"Upsell Opportunity\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n },\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Active\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Active__c\",\n \"componentType\": \"Field\",\n \"label\": \"Active\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": false,\n \"editableForUpdate\": false,\n \"label\": \"\",\n \"layoutComponents\": [\n {\n \"apiName\": null,\n \"componentType\": \"EmptySpace\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n }\n ],\n \"rows\": 4,\n \"useHeading\": false\n },\n {\n \"collapsible\": false,\n \"columns\": 2,\n \"heading\": \"System Information\",\n \"id\": \"01BB0000002rP1rMAE\",\n \"layoutRows\": [\n {\n \"layoutItems\": [\n {\n \"editableForNew\": false,\n \"editableForUpdate\": false,\n \"label\": \"Created By\",\n \"layoutComponents\": [\n {\n \"apiName\": \"CreatedById\",\n \"componentType\": \"Field\",\n \"label\": \"Created By ID\"\n },\n {\n \"apiName\": \"CreatedDate\",\n \"componentType\": \"Field\",\n \"label\": \"Created Date\"\n }\n ],\n \"lookupIdApiName\": \"CreatedById\",\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": false,\n \"editableForUpdate\": false,\n \"label\": \"Last Modified By\",\n \"layoutComponents\": [\n {\n \"apiName\": \"LastModifiedById\",\n \"componentType\": \"Field\",\n \"label\": \"Last Modified By ID\"\n },\n {\n \"apiName\": \"LastModifiedDate\",\n \"componentType\": \"Field\",\n \"label\": \"Last Modified Date\"\n }\n ],\n \"lookupIdApiName\": \"LastModifiedById\",\n \"required\": false,\n \"sortable\": false\n }\n ]\n }\n ],\n \"rows\": 1,\n \"useHeading\": false\n },\n {\n \"collapsible\": false,\n \"columns\": 1,\n \"heading\": \"Description Information\",\n \"id\": \"01BB0000002rP1tMAE\",\n \"layoutRows\": [\n {\n \"layoutItems\": [\n {\n \"editableForNew\": true,\n \"editableForUpdate\": true,\n \"label\": \"Description\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Description\",\n \"componentType\": \"Field\",\n \"label\": \"Account Description\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n }\n ],\n \"rows\": 1,\n \"useHeading\": false\n },\n {\n \"collapsible\": false,\n \"columns\": 3,\n \"heading\": \"Custom Links\",\n \"id\": \"01BB0000002rP1nMAE\",\n \"layoutRows\": [\n {\n \"layoutItems\": [\n {\n \"editableForNew\": false,\n \"editableForUpdate\": false,\n \"label\": \"\",\n \"layoutComponents\": [\n {\n \"apiName\": \"Billing\",\n \"behavior\": \"NewWindow\",\n \"componentType\": \"CustomLink\",\n \"customLinkUrl\": \"/servlet/servlet.Integration?lid=00bB0000000Dr7e&eid=ENTITY_ID&ic=1\",\n \"label\": \"Billing\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": false,\n \"editableForUpdate\": false,\n \"label\": \"\",\n \"layoutComponents\": [\n {\n \"apiName\": null,\n \"componentType\": \"EmptySpace\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n },\n {\n \"editableForNew\": false,\n \"editableForUpdate\": false,\n \"label\": \"\",\n \"layoutComponents\": [\n {\n \"apiName\": null,\n \"componentType\": \"EmptySpace\"\n }\n ],\n \"lookupIdApiName\": null,\n \"required\": false,\n \"sortable\": false\n }\n ]\n }\n ],\n \"rows\": 1,\n \"useHeading\": false\n }\n ]\n}"
}
]
}