Auto assign questionnaire in DDQ

Devanshi Tiwar1
Tera Contributor

Hi All,

 

When the due diligence request is created and moved to 'IRQ in process' state by clicking on the button 'Start Onboarding' a new internal assessment record is created automatically. In the internal assessment record, I want to automatically assign one questionnaire to the internal assessment. 

 

Any suggestions on how to achieve this?

 

thanks in advance

 

1 ACCEPTED SOLUTION

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

1 REPLY 1

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();