- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2019 09:54 AM
I have the below script that works properly, besides adding the info message.
I am thinking that the info message doesn't have time to run while the page is loading.
Would a setTimeout be a good option, or is there a better way to do this?
function getWarranties() {
//alert("You Clicked Me!");
var ga = new GlideAjax('MoxyiUtils');
ga.addParam('sysparm_name', 'getWarranty');
ga.addParam('sysparm_serial_number', g_form.getValue('serial_number'));
ga.getXML(handleResponse);
}
function handleResponse(response) {
var userAnswer = response.responseXML.documentElement.getAttribute('answer');
location.reload();
alertUser(userAnswer);
}
function alertUser(counter) {
g_form.addInfoMessage(counter + ' ' + 'Alert User Working');
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2019 11:01 AM
You can write an onDisplay Business Rule to query the contracts you added and display.
Though the message will be displayed everytime user opens the asset, it will still be useful.
The other option is to not reload, and show a message that Following contract has been added, please reload the form to see changes in contract tab. The contracts are anyway added in the background.
I am also wondering, why are you using a client script for this? Why not a business rule, which will load the form automatically after saving.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2019 11:01 AM
You can write an onDisplay Business Rule to query the contracts you added and display.
Though the message will be displayed everytime user opens the asset, it will still be useful.
The other option is to not reload, and show a message that Following contract has been added, please reload the form to see changes in contract tab. The contracts are anyway added in the background.
I am also wondering, why are you using a client script for this? Why not a business rule, which will load the form automatically after saving.
Please mark this response as correct or helpful if it assisted you with your question.