Skip to main content
Version: main

Get table record

Overview

Retrieves a specific record by sys_id from the specified table.

Path parameters

NameDescription
tableThe table name for the operation.
sysIdThe sys id of the table record.

Optional query parameters

NameTypePossible valuesDescription
DisplayValuetableapi.DisplayValueDisplayValueTrue, DisplayValueFalse, or DisplayValueAllDetermines the type of data returned, either the actual values from the database or the display values of the fields.
ExcludeReferenceLinkboolN/AFlag that indicates whether to exclude Table API links for reference fields.
Fields[]string N/AList of fields to include in the response.
QueryNoDomainboolN/AFlag that indicates whether to restrict the record search to only the domains configured for the logged in user.
Viewtableapi.ViewViewDesktop, ViewMobile, or ViewBothUI view for which to render the data.

Required query parameters

N/A

Examples

package main

import (
"context"
"fmt"
"log"

servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go/v2"
tableapi "github.com/michaeldcanady/servicenow-sdk-go/v2/tableapi"
)

func main() {
// Step 1: Create credentials
cred := credentials.NewBasicProvider("{username}", "{password}")
// Step 2: Initialize client
client, err := servicenowsdkgo.NewServiceNowServiceClient(
servicenowsdkgo.WithAuthenticationProvider(cred),
servicenowsdkgo.WithURL("https://{instance}.service-now.com"),
)
if err != nil {
log.Fatal(err)
}
// Step 3: Configure request
getConfig := &tableapi.TableItemRequestBuilderGetRequestConfiguration{
QueryParameters: &tableapi.TableItemRequestBuilderGetQueryParameters{
// Optional configurations
},
}

// Step 4: Execute request
getResponse, err := client.Now().Table("{TableName}").ByID("{SysID}").Get(context.Background(), getConfig)
if err != nil {
log.Fatal(err)
}
}
Was this page helpful?