Confirm popup on submit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 03:53 PM
Hello experts,
So I'm trying to get a confirmation pop up to work onSubmit off a referenced field in a SCOPED APP. I want to say get the display value from the 'source' field and put it in the confirm box. I've checked to make sure the display is 'true' for 'name' on source table. trying this following code, but not working for me.
If I do getValue('source'), then I get a sysid back, so that tells me since it's a reference, I need to dot walk it. But can't seem to figure it out. Please help! Thanks.
function onSubmit() {
var source = g_form.getDisplayValue('source.name');
var confirm = confirm("Are you sure "+ source + " is correct?");
if (confirm == false){
return false;
}
}
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 05:47 PM
getting undefined with this code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 06:52 PM
Try Below
function onSubmit() {
var myVal= g_form.getReference('source',
function doAlert(source) {
var confirm = confirm("Are you sure "+ source.name+ " is correct?");
if (confirm == false){
return false;
}
}
);
}
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
‎06-19-2017 05:30 PM
You may want to check out my getReferenceAdvanced solution as it works in Global and Scoped applications and provides an easy way to get reference record data:
getReferenceAdvanced, g_form.getReference and GlideAjax Alternatives
The code is on Share and once installed in your instance, you could simply have a script such as:
function onSubmit() {
var source = getReferenceAdvancedDesktop("source", "name");
var confirm = confirm("Are you sure " + source.name + " is correct?");
if (confirm == false){
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 05:49 PM
Hi Michael,
This did not work for me. Getting errors when clicking submit button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2017 05:24 AM
Kim,
Can you confirm you downloaded the update set from Share and imported that into your instance? The instructions are in the blog post I mentioned. As mentioned by others in this post your options are limited with a scoped application. My solution uses a REST web service call which happens asynchronously so it will definitely solve your requirement. This is how AngularJS works as well.