- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello Everyone
I have a code where I use an spModal.
If I click "Approve" the value will be Set to Approve in the variable field.
If I click "Reject" the value will be Set to Rejected in the variable field.
I am having an issue that when I click the "X" in spModal or click outside, I still getting a value "Rejected" my goal is that this should not pass this value and stays the value into "Pending".
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited 3 hours ago
Hello @Jeck Manalo,
Update your code like below
function onLoad() {
var status = g_form.getValue('user_testing');
if (status == 'Pending') {
spModal.open({
title: 'Do you want to approve or reject?',
message: 'Please confirm your decision for this request.',
buttons: [
{
label: 'Approve',
value: 'approved', // replace backend value
primary: true
},
{
label: 'Reject',
value: 'rejected', // replace backend value
primary: false
}
]
}).then(function(result) {
if (result) {
g_form.setValue('user_testing', result);
g_form.save();
}
// No action if modal dismissed
});
}
}
Please Mark Correct ✔️ if this solves your query and also mark Helpful 👍 if you find my response worthy based on the impact.
Regards,
Shruti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited 3 hours ago
Hello @Jeck Manalo,
Update your code like below
function onLoad() {
var status = g_form.getValue('user_testing');
if (status == 'Pending') {
spModal.open({
title: 'Do you want to approve or reject?',
message: 'Please confirm your decision for this request.',
buttons: [
{
label: 'Approve',
value: 'approved', // replace backend value
primary: true
},
{
label: 'Reject',
value: 'rejected', // replace backend value
primary: false
}
]
}).then(function(result) {
if (result) {
g_form.setValue('user_testing', result);
g_form.save();
}
// No action if modal dismissed
});
}
}
Please Mark Correct ✔️ if this solves your query and also mark Helpful 👍 if you find my response worthy based on the impact.
Regards,
Shruti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Thank you! this works properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hello @Jeck Manalo,
Please find the modified code and let me know if it is useful.
function onLoad() {
var status = g_form.getValue('user_testing');
if (status === 'Pending') {
spModal.open({
title: 'Do you want to approve or reject?',
message: 'Please confirm your decision for this request.',
buttons: [
{
label: 'Approve',
value: 'approve',
primary: true
},
{
label: 'Reject',
value: 'reject',
primary: false
}
]
}).then(function(result) {
// Only set value if a button was clicked
if (result === 'approve') {
g_form.setValue('user_testing', 'Approved');
g_form.save();
} else if (result === 'reject') {
g_form.setValue('user_testing', 'Rejected');
g_form.save();
}
// If modal dismissed (X or outside), do nothing
});
}
}
Thanks
Santosh.p
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I have test this code before already and seems not work. yes its not updating to Rejected when i click outside, but when i click the button its not able to update.