- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 07:46 AM
I've got a UI Action under the 'Related Links' called 'Generate/Continue BIA'. What I'm wanting to do is apply some logic so that it checks if the entries in the 'Divisional Application Owner' or 'Technical Application Owner' are active. If either one of the users are inactive and a user clicks on the 'Generate/Continue BIA' link, it should generate an error message 'The BIA cannot be generated/continued until both role holders are active' and keep them on the same page.
I was just wondering how I would get this applied to the UI action?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 02:57 AM
Hi,
update as this
function invokeAssessment() {
if(g_form.getReference('u_business_owner').active.toString() == 'true' && g_form.getReference('u_custodian').active.toString() == 'true'){
checkCurrentBia();
}
else{
g_form.addErrorMessage('The BIA cannot be generated/continued until both role holders are active');
}
}
function checkCurrentBia(){
var businessApp = g_form.getUniqueValue();
//Access the glide ajax script include with the current sys id as a parameter
var gaAssessment = new GlideAjax('LBGBiaUtils');
gaAssessment.addParam('sysparm_name', 'currentAssessmentAjax');
gaAssessment.addParam('sysparm_bus_app',businessApp);
gaAssessment.getXML(generateAssessment);
function generateAssessment(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var data = answer.evalJSON(true);
if (data.wipBia == 'false') {
//generate pop up of UI page lbg_bia_dialog
var displayValue = g_form.getDisplayValue();
var biaDecisionPage = "lbg_bia_dialog";
var dialogWindow = new GlideModal(biaDecisionPage, false, "modal-md");
dialogWindow.setTitle(getMessage("Type of BIA"));
dialogWindow.setPreference("displayValue", displayValue);
//sysparm_id is the sys id of the current business app
dialogWindow.setPreference("sysparm_id", g_form.getUniqueValue());
dialogWindow.render();
window.g_parentDialog = dialogWindow;
} else {
gsftSubmit(null, g_form.getFormElement(), 'action_bia');
}
}
}
if (typeof window == 'undefined')
openCurrentBia();
function openCurrentBia() {
var util = new LBGBiaUtils();
var data = util.currentAssessment(current.getValue('sys_id'));
var urlArray = [];
urlArray.push(data.environmentUrl);
urlArray.push(data.biaInstance);
urlArray.push(data.biaMetricType);
var instanceUrl = gs.getMessage('lbg.assessment.redirect.url' , urlArray);
action.setRedirectURL(instanceUrl);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 03:20 AM
Glad to know.
Please mark response helpful as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 03:10 AM
Hi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 03:09 AM
Hi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 03:28 AM
for the script to work both the fields should be present on the view the users are seeing.
Also debug if the user has read access to the table being referred by both the fields
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 03:36 AM
The fields are both visible for the users, but i'm not sure about read access.
Is there a way to workaround it? Could it be ran as a business rule?