Creating a UI action form link or button on the change form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2020 08:17 AM
On creating a change an assessment is added in the related list. If you open the assessment a command on the form appears UI Action: Take assessment
How can i create another UI action from the change_request to achieve the same. So a command button or form link that can take me directly to the available assessment for the change, without needing to go into the related list?
Please advise.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2020 08:27 AM
Hi,
If are new to UI action look into these resources for creating UI action:-
https://www.learnnowlab.com/UI-Action/
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Thanks
Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2020 08:35 AM
Hi,
Assessments are to be meant to be taken from this table only
why to have UI action on change request table?
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
‎06-16-2020 10:10 AM
Just to save on few clicks for the user, so that he can simply trigger the assessment from where he is in the change form.
Upon submitting the change a customised Info Message comes up generated by a business rule;
------------
(function executeRule(current, previous /*null when async*/) {
var typeID = gs.getProperty('si.change_request.risk_impact.metric_type'); //Change Requests metric type
var assessmentHelper = new SIAssessmentHelper();
assessmentHelper.createChangeAssessments(typeID, current);
action.setRedirectURL(current);
var asmt = new GlideRecord('asmt_assessment_instance');
asmt.addQuery('u_task', current.sys_id);
asmt.addQuery('user', gs.getUserID());
asmt.addQuery('state', 'ready').addOrCondition('state', 'wip');
asmt.query();
if(asmt.next()){
var url = '/assessment_take2.do?sysparm_assessable_sysid=' + asmt.sys_id.toString() + '&sysparm_assessable_type=' + asmt.metric_type.toString();
gs.addInfoMessage("<span><font size=4><a href= '" + url + "'>Assessments have now been generated. You can view your outstanding assessments in the related list at the bottom of this form or click here to fill out now.</a></font></span>");
}
else{
gs.addInfoMessage('Assessments have now been generated. You can view your outstanding assessments in the related list at the bottom of this form.');
}
})(current, previous);
--------
which allows user to go directly to the 'Take Assessment', however that disappears upon change of form, so when user return to the change they are required to go into the related list then click on the assessment,then click take assessment, so not very intuitive.
Where as if a form link or Button existed direct from change to go straight to take assessment that would be easier.