- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 05:50 AM
Hi,
i have created ui action on company table and for a company record, there are assessments stored in related list.
If we open as assessment record, within its related list there is assessment instance of which we can see user responses (by clicking View responses button).
Now, when i click ui action created on company table, for particular record i want to show the responses of last completed assessment on a form.
I was not clear how i can achieve that, can anyone please help?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 02:49 PM
Hi @akshay parekar1 ,
I created a UI action on the incident and click that will give the latest assessment UI page Survey Result.
Please find the below steps:-
1. Created a Client UI action called "View Survey Response" on Incident Table and added the below code in the Script Section.
Code:-
UI action Screenshot:-
Step 2:-
Created a client callable Script Include
Code:-
var CopyRITMWithVariables = Class.create();
CopyRITMWithVariables.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRecentIncAssessmentInstance: function()
{
//sysparm_incID
var TypeID = {};
var inc_id = this.getParameter('sysparm_incID');
var asst_inst_rec = new GlideRecord('asmt_assessment_instance');
asst_inst_rec.addQuery('task_id',inc_id);
asst_inst_rec.orderByDesc('taken_on');
asst_inst_rec.query();
if(asst_inst_rec.next())
{
TypeID.SysID = asst_inst_rec.sys_id.toString();
TypeID.typeID = asst_inst_rec.metric_type.toString();
}
return JSON.stringify(TypeID);
},type: 'CopyRITMWithVariables'
});
Screenshot:-
Result:-
Please mark my answer as helpful and accept it as a solution, if it helps!!
Thanks & Regards,
Suma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 02:49 PM
Hi @akshay parekar1 ,
I created a UI action on the incident and click that will give the latest assessment UI page Survey Result.
Please find the below steps:-
1. Created a Client UI action called "View Survey Response" on Incident Table and added the below code in the Script Section.
Code:-
UI action Screenshot:-
Step 2:-
Created a client callable Script Include
Code:-
var CopyRITMWithVariables = Class.create();
CopyRITMWithVariables.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRecentIncAssessmentInstance: function()
{
//sysparm_incID
var TypeID = {};
var inc_id = this.getParameter('sysparm_incID');
var asst_inst_rec = new GlideRecord('asmt_assessment_instance');
asst_inst_rec.addQuery('task_id',inc_id);
asst_inst_rec.orderByDesc('taken_on');
asst_inst_rec.query();
if(asst_inst_rec.next())
{
TypeID.SysID = asst_inst_rec.sys_id.toString();
TypeID.typeID = asst_inst_rec.metric_type.toString();
}
return JSON.stringify(TypeID);
},type: 'CopyRITMWithVariables'
});
Screenshot:-
Result:-
Please mark my answer as helpful and accept it as a solution, if it helps!!
Thanks & Regards,
Suma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2023 10:41 PM
Thanks @Mallidi Suma for replying!!