UI Action (Pop-up buttons do not appear)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 03:31 PM
Hi All,
I created a topic here before to create a UI action for (Request Info) and the logic is when the agent click the button a pop-up appears with the below:
1- Drop-down list to choose the (Awaiting Info Reason).
2- a text box to but some comments which will be added to the (Additional comments).
3- Two buttons :Ok & Cancel to action this.
A kind mate here provided the script and I used AI to add the (Awaiting Info reason options) but before my update and after the two buttons (Ok - Cancel) do not show as show below:
This is the script: any idea why they are not shown? 😊
function checkawaitingtype() {
if (typeof window === 'undefined') {
updateticket();
} else {
var myModal = new GlideModal('awaiting_info_modal', false);
myModal.setTitle('Provide Awaiting Info Details');
// Fetch options for the dropdown from the u_awaiting_info_reason field
var awaitingReasonOptions = getAwaitingReasonOptions(); // Implement this function
var modalBody = '<div>' +
'<label for="awaiting_reason">Awaiting Info Reason</label>' +
'<select id="awaiting_reason" style="width: 100%;">' +
'<option value="">Select Awaiting Info Reason</option>';
// Populate dropdown options dynamically
awaitingReasonOptions.forEach(function (option) {
modalBody += '<option value="' + option.value + '">' + option.label + '</option>';
});
modalBody += '</select>' +
'<label for="comments" style="margin-top: 10px;">Additional Comments</label>' +
'<textarea id="comments" rows="4" style="width: 100%;"></textarea>' +
'</div>';
myModal.setBody(modalBody, false, false);
myModal.addDecoration({
text: 'OK',
color: 'primary',
id: 'ok_button'
});
myModal.addDecoration({
text: 'Cancel',
color: 'secondary',
id: 'cancel_button'
});
var okFunction = function () {
var awaiting_reason = document.getElementById('awaiting_reason').value;
var comments = document.getElementById('comments').value;
if (awaiting_reason === '') {
alert('Please select an awaiting info reason');
} else if (comments === '') {
alert('Please specify details in comments');
} else {
// Populate the Awaiting Info Reason field
g_form.setValue('u_awaiting_info_reason', awaiting_reason);
g_form.setValue('comments', comments);
g_form.setDisplay('u_awaiting_info_reason', true);
g_form.setMandatory('u_awaiting_info_reason', true);
g_form.setMandatory('comments', true);
gsftSubmit(null, g_form.getFormElement(), 'requestMoreInformation');
myModal.destroy();
}
};
var cancelFunction = function () {
myModal.destroy();
};
document.getElementById('ok_button').onclick = okFunction;
document.getElementById('cancel_button').onclick = cancelFunction;
myModal.render();
}
}
function updateticket() {
new global.StateFlow().processFlow(current, '9a028a63c3123100d6d210c422d3ae11', 'manual');
action.setRedirectURL(current);
}
// Implement this function to fetch options from the u_awaiting_info_reason field
function getAwaitingReasonOptions() {
// Replace with your logic to retrieve options (e.g., from a REST API or predefined list)
return [
{ value: '1', label: 'Awaiting Contact' },
{ value: '2', label: 'Awaiting Change' },
{ value: '3', label: 'Awaiting Problem' },
{ value: '4', label: 'Awaiting Vendor' }
// Add more options as needed
];
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 03:07 AM
Hi All,
If this way is not going to work, is there any other way to configure it? ☹️
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 09:38 AM