UI Action in the workspace - Ui Script or custom modal in Workspace Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 12:43 AM
Hi all,
I am trying to make a UI Script working in the Workspace Client Script.
I made the UI Page load inside the modal in the workspace, but there is no functionality on the buttons when loaded.
This is the code in the UI Action.
Script:
function assessRisk () {
ScriptLoader.getScripts(['sn_risk_advanced.AssignFormUtils.jsdbx'], function() {
sn_risk_advanced.AssignFormUtils.assignAssessorApprover();
});
}
Workspace client script
function onClick() {
var ui_page_id = '615212a0532300101bfbddeeff7b12a2';
g_modal.showFrame({
url: '/ui_page.do?sys_id=' + ui_page_id,
title: 'Add Assessor and Approver',
size: 'l',
});
}
This is how it looks in the backend and also what is wanted in the workspace
I also tried to make a custom modal, but this doesn't seem to be working as expected.
See the code for this below.
function onClick(g_form) {
var fields = [
{
type: 'reference',
name: 'name',
label: getMessage('Assessor'),
mandatory: true,
reference: 'sys_user',
value: g_form.getValue('name'),
displayValue: g_form.getDisplayValue('name')
},
{
type: 'reference',
name: 'approver_id',
label: getMessage('Approver'),
mandatory: false,
reference: 'sys_user',
referringTable: 'sn_risk_advanced_event',
referringRecordId: g_form.getUniqueValue(),
value: g_form.getValue('approver_id'),
displayValue: g_form.getDisplayValue('approver_id'),
query : "roles=sn_risk_advanced.ara_approver^active=true^EQ",
}
];
g_modal.showFields({
title: "Add Assessor and Approver",
fields: fields,
size: 'lg'
}).then(function(fieldValues) {
g_form.setValue('assessor_id', fieldValues.updatedFields[0].value);
g_form.setValue('approver_id', fieldValues.updatedFields[2].value);
g_form.save();
});
}
If anybody could help out, would be really appreciated,
Regards,
Jonas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2025 11:29 PM
@Jonas VK Was this resolved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2025 11:46 PM
Don't remember the exact details, but we fixed it by using a GlideAjax script include that did most the work for us.
Regards,
Jonas