lrohr
Tera Expert

Hi Devanshi, 

 

probably easiest to create a BR that adds the questionnaire to the INA on creation of the DD (or whenever the trigger suits your needs best). The example below does the trick.

 

lrohr_0-1730470566484.png

 

	// create new INA
	var grIRQ = new GlideRecord("sn_vdr_risk_asmt_internal_assessment");
	grIRQ.initialize();
	grIRQ.dd_request = current.sys_id;
	grIRQ.name = "IRQ";
	grIRQ.short_description = "IRQ";
	grIRQ.tiering_assessment_assessors = current.vendor.vendor_manager.toString();
	grIRQ.assigned_to = current.vendor.vendor_manager.toString();
	grIRQ.vendor = current.vendor;
	irqId = grIRQ.insert();

	// identify your questionnaire template sys_id
	var grQuest = new GlideRecord("asmt_metric_type");
	grQuest.query("name", "Default IRQ");
	if(grQuest.next()) {
		var questId = grQuest.sys_id;
	}

	// insert m2m to add questionnaire to INA
	var grQuestToINA = new GlideRecord("sn_vdr_risk_asmt_m2m_tiering_asmt_questionnaire");
	grQuestToINA.initialize();
	grQuestToINA.metric_type = questId;
	grQuestToINA.vdr_tiering_assessment = irqId;
	grQuestToINA.insert();	

 

View solution in original post