Skip to main content
Version: v2.0

Find an application service

Look up an application service registered in the CSDM model.

When to use this pattern

  • You're mapping deployments or incidents to CSDM application services
  • You need to verify a service exists before registering it

Required values

ValueDescription
Service identifiersSet through the request configuration's query parameters

Example

package main

import (
"context"
"fmt"
"log"

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

func main() {
// Step 1: Authenticate and initialize the client
cred := credentials.NewBasicProvider("{username}", "{password}")

client, err := servicenow.NewServiceNowServiceClient(
servicenow.WithAuthenticationProvider(cred),
servicenow.WithInstance("{instance}"),
)
if err != nil {
log.Fatalf("failed to initialize client: %v", err)
}
ctx := context.Background()

// Step 2: Look up an application service in the CSDM model
found, err := client.Now().Cmdb().AppService().Csdm().FindService().Get(ctx, nil)
if err != nil {
log.Fatalf("find service failed: %v", err)
}

fmt.Printf("service: %+v\n", found)
}

Tips

  • Csdm().RegisterService() registers a service; Create() creates one from scratch.

Next steps

Was this page helpful?