- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 05:29 AM
Hi,
I would like to write a script to update a column when a specific subcategory is selected in Incident table.
Could you please assist me with this?
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 10:48 AM - edited 08-16-2024 10:49 AM
Hello @Kalpesh Kalgutk ,
You can put below line of code in your Business Rule ->
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var session = gs.getSession();
var URL = session.getUrlOnStack();
//gs.info(URL);
current.COLUMN_NAME = URL;
})(current, previous);
Reference documentation - https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server/c_GlideSessionScopedAPI
If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 07:09 AM
Hello @Kalpesh Kalgutk ,
I see & understand what is implemented. If interested, you can try my solution so provided in your PDI and we can check why it does not work. Normally, it does.
If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 10:48 AM - edited 08-16-2024 10:49 AM
Hello @Kalpesh Kalgutk ,
You can put below line of code in your Business Rule ->
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var session = gs.getSession();
var URL = session.getUrlOnStack();
//gs.info(URL);
current.COLUMN_NAME = URL;
})(current, previous);
Reference documentation - https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server/c_GlideSessionScopedAPI
If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 01:29 AM
Hello @Kalpesh Kalgutk ,
Have you happened to check my solution to your problem statement?
If my response helps you in any way, kindly mark it as Accepted Solution/Helpful and help in closing this thread.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 02:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 03:00 AM
To help you further, Is it possible for you to share the code you have written?
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 04:42 AM
Hi @ShubhamGarg thank you and sorry.
I removed the code because it wasn't working and I'm exploring alternative methods to complete the task.
But I can provide more details about the requirement. We created a SharePoint form for updating records, and I want to update the link to this form in the `u_sharepoint` column which we created in the incident table. I have created a fixed URL property under the `sys_properties` table with the value `"www.sharepoint.com="`. The updated column should contain the current incident number appended to the URL after the `=` sign, forming a link like `www.sharepoint.com=INC12345`.