How can we populate the add info message on change form in CSM/FSM workspace

vijay218591
Mega Explorer

How can we display display the addInfo messgae on change form in Workspcae on form load The value has to get from workspac upon ui action click..

 

I tried with below steps.

1)  AFter UI action clicks the we willl be storing set of value in resptecive fiels on change form which is not visible on form level.

2) Now I have written onload client script & calling script inclue by using AJax api to clear the value on dummy field. Populating info message on form load by using g_form form.

3) Able to see info message on native UI but not in workspace level.

 

vijay218591_0-1748972004136.png

 

vijay218591_1-1748972046833.png

 

1 REPLY 1

Abbas_5
Tera Sage
Tera Sage

Hello @vijay218591,

 

To display "add info message" on a change form within the CSM/FSM workspace in ServiceNow, you need to use the g_form.addInfoMessage() method in a client script or business rule, and then trigger it within the appropriate context. Here's a more detailed breakdown: 
 
1. Identify the Trigger:
  • UI Action:
    If you're using a UI action to trigger the message, you'll need to add the g_form.addInfoMessage() method to the UI action's client script or business rule. 
     
  • On Load:
    You can also display the message on form load by using a client script and the g_form.addInfoMessage() method. 
     
  • Other Actions:
    If the message needs to be displayed after a specific action (e.g., submitting a form), you'll need to add the g_form.addInfoMessage() method to the corresponding script. 
     
2. Implement g_form.addInfoMessage():
  • Client Script: In your client script, use the g_form.addInfoMessage() method to display the message. For example: 
     
JavaScript
 
g_form.addInfoMessage("This is an info message on the change form.");
  • Business Rule: In your business rule, use the g_form.addInfoMessage() method to display the message. However, be aware that the message might not be displayed correctly if the business rule is run in a context where the form is not fully rendered. 
     
3. Context Matters:
  • Native UI vs. Workspace:
    The g_form.addInfoMessage() method generally works in the native UI. However, it may not be displayed correctly in the workspace unless you're using a client script or business rule that is specifically designed to work within the workspace environment.
  • Workspace Components:
    If you're using a workspace component like a modal dialog or a related list, you might need to use the appropriate workspace API to display the message within that component. 
     
4. Testing and Debugging:
  • Test in Native UI:
    First, test your implementation in the native UI to ensure that the g_form.addInfoMessage() method works as expected. 
     
  • Debug in Workspace:
    Then, test the implementation in the workspace environment, paying attention to the context in which the message is displayed. 
     
  • Use Debugging Tools:
    If you're having trouble displaying the message in the workspace, use ServiceNow's debugging tools to identify the problem. 
     
Example Scenario:
Let's say you want to display an info message on the change form when a UI action is clicked. Here's how you might do it: 
 
  1. Create a UI Action: Create a UI action on the change form.
  2. Add a Client Script: Add a client script to the UI action.
  3. Use g_form.addInfoMessage()In the client script, use g_form.addInfoMessage() to display the message.
JavaScript
 
// Client script for a UI actionfunction myUIScript(current, template) {  g_form.addInfoMessage("This info message will display on the change form.");}
Important Considerations:
  • Workspace APIs:
    When working with workspaces, consider using the appropriate workspace APIs to display messages, such as the SNEvidence API for displaying evidence messages or the SNC.UI.Dialog API for displaying dialog messages. 
     
  • Custom Workspaces:
    If you're using a custom workspace, you may need to tailor your approach based on how the workspace is configured. 
     
By following these steps and considering the context in which you're displaying the message, you can successfully display "add info message" on your change form within the CSM/FSM workspace in ServiceNow. 
 
If this is helpful, please hit the thumbs up button and accept the correct solution by referring to this solution in future it will be helpful to them.
 
Thanks & Regards,
Abbas Shaik