Info Messsage with button in Service Operation Workspace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 07:44 PM
Requirement:
Currently in the Incident form there is an infoMessage with a button that sets certain values in the form, which is coded as follows:
<button onclick="g_form.setValue(\'service_offering\', \'' + result[2] + '\'); g_form.clearMessages()">' + Click Here + '</button>
This button works in the Incident form in platform, when I try to replicate the same operation in SOW it does not perform any action.
Reviewing the code of the page, it seems that the "onClick" event is not detected in SOW.
Is there any alternative to replicate this functionality in SOW? The reason why these messages are used is because sometimes it shows up to 2 messages at the same time, so the user has the opportunity to select the appropriate one for his scenario.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 02:40 AM
Hi @Pablo Sanz ,
you may populated info message like below
For Demo:
1. created server type declarative action with below code
Please accept the solution or give a thumbs up if it answers your query.
Thanks,
Haseeb Ahmed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 07:55 PM
Thanks for your suggestion, in my case I need to fill in some information in the Incident form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 10:16 PM
In ServiceNow Workspace (SOW), the traditional client-side scripting methods like g_form, g_user, etc. are not supported. Instead, ServiceNow has introduced a new client-side scripting API called 'now-*' components.
To replicate the functionality of the button in SOW, you can use the 'now-button' component. Here are the steps:
1. Create a new UI Action with the following properties:
- Name: Set Values
- Action name: set_values
- Client callable: true
- Script:
function() {
g_form.setValue('service_offering', result[2]);
g_form.clearMessages();
}
2. In your Workspace view, add a new 'now-button' component with the following properties:
- Label: Click Here
- Action: set_values
3. The 'now-button' component will call the 'set_values' UI Action when clicked, replicating the functionality of the button in the platform view.
Please note that the 'now-*' components are only available in the New York release and later. If you are on an earlier release, you will need to upgrade to use these components.
nowKB.com
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 - https://nowgpt.ai/
For the ServiceNow Certified System Administrator exams try this :
https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER