- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 07:36 AM
have a code in a client script On load
function onLoad() {
var category = g_form.getValue('category');
var qaTestingRes = g_form.getValue('u_qa_testing_result');
if (category == 'Software Applications' && qaTestingRes == 'pass') {
var gm = new GlideModal('acknowledgement');
gm.setTitle('Email attachment reminder');
gm.renderWithContent('<div style="padding:15px"><p>Have you attached the email from the QA/UAT Tester approving the change to deploy to production?</p><button style="padding:5px; margin:3px" class="btn btn-primary" onclick="ack(this.innerHTML)">OK</button><button style="padding:5px; margin:3px" class="btn btn-primary" onclick="ack(this.innerHTML)">Cancel</button></div>');
}
function ack(thisButton) {
console.log('vinilogs calling action');
gm.destroy();
if (thisButton == 'OK') {
g_form.addInfoMessage("Do something");
}
}
}
When I hit the button, the console says ACK is not a function, how can I avoid this error?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 08:08 AM
Hello @Vinicius Luz1 , how are you?
You could try to go a more OOTB route and use this article as a basis to make this functionality.
function onLoad() {
var category = g_form.getValue('category'),
qaTestingRes = g_form.getValue('u_qa_testing_result');
if (category == 'Software Applications' && qaTestingRes == 'pass') {
var gm = new GlideModal("glide_confirm_basic", true, 600);
gm.setTitle("Email attachment reminder");
gm.setPreference("title", "Have you attached the email from the QA/UAT Tester approving the change to deploy to production?");
gm.setPreference("onPromptComplete", function() {alert("You clicked on 'Ok'")});
gm.setPreference("onPromptCancel", function() {alert("You clicked on 'Cancel'")});
gm.render();
}
}
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 08:08 AM
Hello @Vinicius Luz1 , how are you?
You could try to go a more OOTB route and use this article as a basis to make this functionality.
function onLoad() {
var category = g_form.getValue('category'),
qaTestingRes = g_form.getValue('u_qa_testing_result');
if (category == 'Software Applications' && qaTestingRes == 'pass') {
var gm = new GlideModal("glide_confirm_basic", true, 600);
gm.setTitle("Email attachment reminder");
gm.setPreference("title", "Have you attached the email from the QA/UAT Tester approving the change to deploy to production?");
gm.setPreference("onPromptComplete", function() {alert("You clicked on 'Ok'")});
gm.setPreference("onPromptCancel", function() {alert("You clicked on 'Cancel'")});
gm.render();
}
}
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 08:44 AM
I am trying to use the same code inside onSubmit Client Script but its not working