Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

How to access new SNC.AssessmentCreation() which is in script include to Widget Server script

mrunalnikhi
Tera Contributor

How to access new SNC.AssessmentCreation() which is in script include to Widget Server script which is in Knowledge management Service Portal scope. I am getting empty value in script, unable to fetch script include in widget. 

mrunalnikhi_0-1787288865618.png

 

10 REPLIES 10

Ankur Bawiskar
Tera Patron

@mrunalnikhi 

it's scope issue, AssessmentCreation is in global scope and seems your widget is in another scope

see this

How can I call SNC.AssessmentCreation()).createAssessments in scoped app? 

Workaround

-> create script include in global scope, accessible from ALL Scopes and that will call the Assessment API

-> call this script include of global from your widget

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

I am already creating script include in global and accessible from all scope.
can it be cross-scope application issue

@mrunalnikhi 

so from widget you are calling that global script include?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

yes, I want to fetch assessmentId and surveyID. 

if (input.action == 'createSurvey') {
       
        var util = new CESKBSurveyUtil();
        data.surveyData = util.createSurveyInstance(
            input.article_id,
            input.rating
        )
       
    }

 

Hi @mrunalnikhi ,

Is this widget in another scope like not in global ?. If not in global try to call new global.CESKBSurveyUtil(); and also check the sandbox is unchecked for that script include