- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 01:04 AM
Hi All,
I have a requirement where i need to add an approve and a reject button at the end of a row in the list item. Is there a way to achieve this? I am currently using the list-simple component and am not sure how to add buttons at the end of the row. Any inputs on this will be helpful.
Thanks & Regards,
Sanjay
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 02:06 AM
Dashboards are just to view the data not to take action, so it is not possible on dashboards#
2nd on portal yes, it is OOTB available on Service Portal like this
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 01:10 AM
Yes, you can achieve this by creating a UI Action in ServiceNow. Here are the steps:
1. Navigate to System UI > UI Actions.
2. Click on New to create a new UI Action.
3. Fill in the necessary fields:
- Name: Give a name to your UI Action.
- Table: Select the table where you want to add the buttons.
- Action name: This is automatically populated based on the name.
- List choice: Select this if you want the UI Action to appear in the list choice.
- Form button: Select this if you want the UI Action to appear on the form.
- List banner button: Select this if you want the UI Action to appear on the list banner.
- List context menu: Select this if you want the UI Action to appear in the list context menu.
- Form context menu: Select this if you want the UI Action to appear in the form context menu.
4. In the Script field, add your custom script to perform the approve/reject action.
5. Click on Submit to save the UI Action.
Here is a sample code for an approve button:
javascript
if (current.state == 'pending') {
current.state = 'approved';
current.update();
gs.addInfoMessage('Record approved');
action.setRedirectURL(current);
}
And a sample code for a reject button:
javascript
if (current.state == 'pending') {
current.state = 'rejected';
current.update();
gs.addInfoMessage('Record rejected');
action.setRedirectURL(current);
}
Please note that you need to replace 'state', 'approved', and 'rejected' with your actual field and values. Also, make sure that the 'Show insert' and 'Show update' checkboxes are selected for the UI Action to appear on the list.
nowKB.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 01:32 AM
Thanks Rajdeep for the quick response. Rephrasing my question, I am currently building a dashboard in Service Now using UI builder. In the dashboard I have added a List-Simple widget and I have configured the list to display 4 rows and 5 columns. As a 6th and 7th column i want to see an approve and reject button. Am trying to understand Is this possible?
Thanks & Regards,
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 01:41 AM
Greetings!!
You want t use these button to approve or reject on Dashboards, if this is case, I doubt we can do this in SN. Please provide some screenshot to understand better.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 01:57 AM
Hi Atul,
PFA the snapshot on what am referring to. I have created a dummy table. Next to column 5, i am trying to add an approve and reject button.
For my knowledge, If it is not possible in Dashboard? Can this be achieved in Service portal? Currently am trying this under Experience Portal Dashboard.
Thanks & Regards,
Sanjay Navada