Delete table record¶
Overview¶
Deletes the specified record from the table.
Path parameters¶
| Name | Description |
|---|---|
baseurl |
The absolute base URI for the request (this is the same for all requests) including: the schema, the domain, and a path fragment. |
table |
The table name of for the operation. |
sysId |
The sys id of the table record. |
Optional query parameters¶
| Name | Type | Possible values | Description |
|---|---|---|---|
QueryNoDomain |
bool |
N/A | Flag 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"
tableapi "github.com/michaeldcanady/servicenow-sdk-go/table-api"
)
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
delete_config := &tableapi.TableItemRequestBuilder2DeleteRequestConfiguration{
QueryParameters: &tableapi.TableItemRequestBuilder2DeleteQueryParameters{
// Optional configurations
},
}
// Step 4: Execute request
err := client.Now2().TableV2("{TableName}").ById("{SysID}").Delete(context.Background(), delete_config)
if err != nil {
log.Fatal(err)
}
}
package main
import (
"context"
"fmt"
"log"
servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go"
tableapi "github.com/michaeldcanady/servicenow-sdk-go/table-api"
)
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: Define raw URL
rawURL := "https://https://{instance}.service-now.com/api/now/v1/table/{TableName}"
// Step 4: Build request
requestBuilder = tableapi.NewDefaultTableItemRequestBuilder2(rawURL, client.RequestAdapter)
// Step 5: Configure request
delete_std_config := &tableapi.TableItemRequestBuilder2DeleteRequestConfiguration{
QueryParameters: &tableapi.TableItemRequestBuilder2DeleteQueryParameters{
// Optional configurations
},
}
// Step 6: Execute request
err = requestBuilder.Delete(context.Background(), delete_std_config)
if err != nil {
log.Fatal(err)
}
}