Populate Demand Stakeholders from Business Unit, Department, and Business Application

Adam Geil
Kilo Sage

Hi All,

 

I'm looking for some guidance on how to execute a business requirement. The requirement is to populate Demand's stakeholders based on the Business Unit, Department, Impacted Business Unit, and Business Application that is selected on the Demand form in addition to the Portfolio's stakeholder registry. We would want to populate the stakeholder list with the respective head/manager for each Business Unit, Department, etc.

 

Has anyone done something similar to this before?

2 REPLIES 2

Namrata Ghorpad
Mega Sage
Mega Sage

Hello,

For this requirement Department and Business unit head should be available in the Stakeholder Register Table.

 

Regards,

Namrata

Namrata Ghorpad
Mega Sage
Mega Sage

Hello,

You can add the below code into existing Business rule "Populate Stakeholders based on Portfolio" and add the conditions like Department changes.

if(current.department!="")
	{
	var dp=new GlideRecord('cmn_department');
		dp.addQuery('sys_id',current.department);
		dp.query();
		if(dp.next())
			{
				var mg=dp.getValue('dept_head');
				gs.addInfoMessage("Department head is "+mg);
				var grst = new GlideRecord('dmn_stakeholder_register');
				grst.addQuery('active', true);
				grst.addQuery('user',mg);		
				grst.query();
				while(grst.next())
				{
					var uname=grst.getUniqueValue();
					gs.addInfoMessage("stakeholder is "+uname);
					var dmnst=new GlideRecord('dmn_m2m_demand_stakeholder');
					dmnst.initialize();
					dmnst.setValue('demand',current.sys_id);
					dmnst.setValue('stakeholder',uname);
					dmnst.insert();
				
				}
				
				
			}
		
}

 

Please mark my answer as helpful/correct if it helps you.

Regards,

Namrata.