Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Created April 26, 2023 19:29
Show Gist options
  • Select an option

  • Save cmcdevitt/6a80a90f531eb724b7b9b69dcb061f2a to your computer and use it in GitHub Desktop.

Select an option

Save cmcdevitt/6a80a90f531eb724b7b9b69dcb061f2a to your computer and use it in GitHub Desktop.
GlideOverlay_example.js
/*
GlideOverlay() only works with certin pages like UI Pages(?)
It's not documented so...
Note for the survey part
IMPORTANT:
- The Assessments "Metric type" must match when you build the URL
- The Assessment need to be Ready to take and NOT expired
*/
function pop() {
//GlideDialogWindow.get().destroy();
//alert("Yep");
//var url = 'assessment_take2.do?sysparm_assessable_sysid=' + rowSysId + '&sysparm_assessable_type=' + metricType;
// (1) Find an Assessment Instance [ asmt_assessment_instance] aka 'id'
var AINST0010070 ='b39484488762a1102d0b422e0ebb35c6';
// (2) Fit it's Metric Type / Survey Definition [asmt_metric_type] aka 'type'
var e_q = 'df1459575b4010102d33bff13381c7de';
//IMPORTANT the Assessments "Metric type" must match when you build the URL
// (3) Build the URL
// Read-only: &sysparm_reader_view=true
//var url = 'assessment_take2.do?sysparm_assessable_sysid=' + AINST0010070 + '&sysparm_assessable_type=' + e_q + '&sysparm_reader_view=true';
var url = 'assessment_take2.do?sysparm_assessable_sysid=' + AINST0010070 + '&sysparm_assessable_type=' + e_q;
var options = {
height: '85%',
width: '60%',
title: getMessage('Take Question'),
iframe: url,
onAfterClose: function() {
location.reload();
}
};
var assessmentOverlay = new GlideOverlay(options);
assessmentOverlay.center();
assessmentOverlay.render();
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment