Skip to main content
Version: main

Delete table record

Overview​

Deletes the specified record from the table.

Path parameters​

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

Optional query parameters​

NameTypePossible valuesDescription
QueryNoDomainboolN/AFlag that indicates whether to restrict the record search to only the domains configured for the logged in user.

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
deleteConfig := &tableapi.TableItemRequestBuilderDeleteRequestConfiguration{
QueryParameters: &tableapi.TableItemRequestBuilderDeleteQueryParameters{
// Optional configurations
},
}

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