Created
May 31, 2022 15:46
-
-
Save thisnameissoclever/fda8224b209a39ddae1de04a42b22841 to your computer and use it in GitHub Desktop.
Expanding infomessage with functional components in ServiceNow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var message = ''; | |
message += 'This is an expanding info message. It can even run code! Click "Show more" to see!'; | |
message += '<div>'; | |
message += '<p><a href="#" onclick="javascript: jQuery(this.parentNode).next().toggle(200);">Show more</a></p>'; | |
message += '<div style="display: none;">'; | |
message += '<ul style="list-style: none">'; | |
message += '<li>This is the expanded info in the message.</li>'; | |
message += '<li>You can include any details you like here, including info retreived from a script like the sys_id of the current record: ' + g_form.getUniqueValue() + '</li>'; | |
message += '</ul>'; | |
message += '<p>You can even run a script when an element is clicked <a href="#" onclick="javascript: alert(\'See? ^_^\');">like this</a>. You just have to escape your code in the HTML.</p>'; | |
message += '</div>'; | |
message += '</div>'; | |
g_form.addInfoMessage(message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment