Graphql ServiceNow Integration
Вставка
- Опубліковано 9 лют 2025
- Graphql ServiceNow integration.
What is GraphQL?
GraphQL is a query language for API's and a runtime for fulfilling queries with existing data.
Instrictions to setting up GraphQL with Servicenow:
1. GraphQL API (sys_graphql_schema)
2. GraphQL Scripted Resolvers (sys_graphql_resolver)
3. GraphQL Resolver Mappings (sys_graphql_resolver_mapping)
4. End Point ([my-instance].service-now.com/api/now/graphql)
In this video, we also covered the Advantages/Disadvantages of GraphQL
ServiceNow
Script used in the video:
_____________________________________________________________
1.GraphQL API:
schema {
query: Query
}
type Query {
getIncidentsByCallerID(calledID: ID!): [IncidentData]
}
type IncidentData{
number: DisplaybleString,
short_description: String
}
type DisplaybleString{
value: String,
display_value: String
}
_____________________________________________________________
2. GraphQL Scripted Resolver:
(function process(/*ResolverEnvironment*/ env) {
var grIncident = new GlideRecord('incident');
grIncident.addEncodedQuery("caller_id="+env.getArguments().calledID);
grIncident.query();
return grIncident;
})(env);
_____________________________________________________________
3. Syntax to Test:
{
x200273 {
agineo{
contactRequest(contactID: "6816f79cc0a8016401c5a33be04be441"){
short_description,
number{
value
}
}
}
}
}
If you have any questions please mention them in the comments below.
Please feel free to comment whats the next video you are looking for.
Nice..! you should have done more videos on GraphQL
awesome video. how do we call graphl from server/client side?