Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Assessment Creation API and Assessment Instance

Loudigi
Kilo Sage

I'm able to create assessable records using the AssessmentCreation API from a business rule. However, this doesn't create the assessment instances with assigned users. You would have to manually assigned the users to each assessable record. Has anyone found a way to use the api to create both the assessable record and assign it automatically through a script or UI action ?

1 REPLY 1

Matt Hernandez
Tera Guru

If you look at the business rule, 'Create OnDemand Assessment' on the dmn_demand table, it shows an example of getting userIds from the many-to-many stakeholders table for the current demand. The list of userIds is passed to createAssessments(), with syntax as follows:

(SNC.AssessmentCreation()).createAssessments(
	'0556fa9a8f12110040f82ab2f0f923f8', //sys_id of metric type Demand.. you could pass any other metric type you wish to create
	current.sys_id, // sys_id of Demand to use
	userIds,  		// comma separated list of user sys_ids
	false,			// check the users authorization before allowing them to take the survey
	""); 			// sys_id of an existing assessment_group to use