Where can i find the code for task number and short description on take_survey widget

Rocking Ravs
Giga Contributor

Where can i find the code for task number and short description on take_survey widget?

1 ACCEPTED SOLUTION

Dear Raveena,


I attempted to implement your requirement and below are the changes needed.


I made a screencast of how the changes look like, url to view the same (ServicePortalSurveyWidget - YouTube )



Test Data : Assignment Group = Service Desk


Caller Name = Abraham Lincoln


Caller Country = Spain ( ES)



** All changes to be made in scope = "Service Portal Surveys" **



Created copy of widget "Take Survey"   and named it as Take Survey 1


Created copy of page take_survey and named it as take_survey_1


Updated widget "My Surveys"



Changes done to the widget "Take Survey"   which are saved as the new widget Take Survey 1




In "Body HTML Template" add below code after


<div ng-if="data.trigger_desc" style="font-size:15px;">


{{::data.trigger_desc}}


</div>


<!-- custom Code Start -->


                                          <div ng-if="data.trigger_table == 'incident' && data.trigger_assignmentgroup != ''" style="font-size:15px;">


{{::data.trigger_assignmentgroup}}


</div>


                                            <div ng-if="data.trigger_table == 'incident' && data.trigger_caller != ''" style="font-size:15px;">


{{::data.trigger_caller}}


</div>


                                                <div ng-if="data.trigger_table == 'incident' && data.trigger_country != ''" style="font-size:15px;">


{{::data.trigger_country}}


</div>


                                          <!-- custom Code End -->


In "Server Script" add below code after sp.loadSurvey(typeId,surveyId, data);


// Custom Code


if(data.trigger_table == 'incident') {


var grInc = new GlideRecord('incident');


grInc.addQuery('sys_id', data.trigger_id);


grInc.query();


if(grInc.next()) {


data.trigger_assignmentgroup = grInc.assignment_group.name.toString();


data.trigger_caller = grInc.caller_id.name.toString();


data.trigger_country = grInc.caller_id.country.toString();


}


}


// Custom Code



Changes to page take_survey which are in the new page take_survey_1


Add the newly created widget in Row 1, Column 1


Changes to Widget "My Surveys"


Body HTML Template section 2 changes are done.


1. Comment out line <a href="?id=take_survey&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}"> and add new line


<a href="?id=take_survey_1&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}">



The updated code should look like below.



<!-- <a href="?id=take_survey&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}"> -->


<a href="?id=take_survey_1&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}">




2. Comment out line <a href="?id=take_survey&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}">


and add new line


<a href="?id=take_survey_1&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}">



The updated code should look like below.



<!-- <a href="?id=take_survey&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}"> -->


<a href="?id=take_survey_1&instance_id={{::instance.sys_id}}" title = "Take {{::instance.evaluation_method_display}}">


View solution in original post

8 REPLIES 8

harishdasari
Tera Guru

Hi Raveena,



go to the particular widget and press CTRL on you keyboard and right click mouse.



You find the options and select the widget editor option and there you can find the code in HTML part of widget.



Hope this might be helpful


Hitake_survey widget html.PNG,



In the HTML part of take_survey widget i can see there is variable 'trigger_desc'.No idea where it is defined.Can someone give me any idea where it is   ?


take_survey widget runs on asmt tables ( like asmt_assessment_instance). Depending on the survey record in the assessment instance table corresponding survey questions get displayed.


To give a short answer, its not specific to task table, hence task description and task number code wont be present.


If you can elaborate more on what you are after. I can provide more help


Hi Anil,



Thanks for your prompt reply. What i exactly want is to populate some more details (eg assignment group, caller,country)from table on which trigger condition of survey is defined(in my case its Incident). it is showing incident number and short description only.