HOHR - Scheduled job - add mra records for new powerhouse

PHOTO EMBED

Mon Oct 04 2021 11:57:32 GMT+0000 (UTC)

Saved by @mathiasVDD #javascript

var powerHouse = new GlideRecord('sys_choice');
//Daily check
powerHouse.addEncodedQuery('name=core_company^element=u_powerhouse^language=en^sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
powerHouse.query();
while(powerHouse.next()){
    var mra = new GlideRecord('u_mra');
	var gr = new GlideRecord('u_mra_config');
	gr.addQuery('install_status','!=', '7');
	gr.query();
	while(gr.next()){
		mra.initialize();
		mra.u_software = gr.sys_id;
		mra.u_powerhouse = powerHouse.value;
		mra.u_active = false;
		mra.insert();
	}

}
content_copyCOPY