can we use sysparam in put call
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:19 PM
Hi all , i am working on the rest API i want to update the assignment group using sysparam based on the user entry it is dynamically going to update
can someone guide us can i use sysparam in put call
below is the some of the information of my code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 12:20 AM
Yes, you can use sysparm in a PUT call to update the assignment group in ServiceNow. Here's a step-by-step guide:
1. First, you need to identify the sys_id of the assignment group that you want to update. You can do this by navigating to the group record in ServiceNow and copying the sys_id from the URL.
2. Next, you need to construct your REST API endpoint. This will look something like this: https://.service-now.com/api/now/table/sys_user_group/
3. You will then need to construct your JSON payload. This will contain the fields that you want to update and their new values. For example:
json
{
"name": "New Group Name",
"description": "New Group Description"
}
4. You can then make your PUT request using this endpoint and payload. You will need to include your ServiceNow credentials in the request header.
Here's a sample code snippet in JavaScript using the fetch API:
javascript
var url = 'https://.service-now.com/api/now/table/sys_user_group/';
var data = {
"name": "New Group Name",
"description": "New Group Description"
};
fetch(url, {
method: 'PUT',
body: JSON.stringify(data),
headers:{
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('username:password')
}
})
.then(res => res.json())
.then(response => console.log('Success:', JSON.stringify(response)))
.catch(error => console.error('Error:', error));
Remember to replace and with your actual ServiceNow instance name and the sys_id of the group you want to update. Also, replace 'username:password' with your actual ServiceNow credentials.
For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - nowgpt.ai