Demand Stakeholders
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2017 08:02 AM
i have many stakeholders configured for a portfolio but when I create a demand I want the stakeholders auto selected based on the program selected not all the portfolio stakeholders (or) Related to a function that was entered in Portfolio management.
- Labels:
-
Demand Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 11:12 AM
I have created this functionality with a after BR
You can customize the code for your requirement
function deleteStakeholders() {
var gr = new GlideRecord('dmn_stakeholder_register');
gr.addQuery('portfolio', previous.portfolio);
gr.query();
if (gr.hasNext()) {
var m2mGR = new GlideRecord('dmn_m2m_demand_stakeholder');
var stakeHolderList = "";
while(gr.next()) {
stakeHolderList += gr.getUniqueValue();
stakeHolderList += ",";
}
m2mGR.addQuery('stakeholder', 'IN', stakeHolderList);
m2mGR.addQuery('demand', current.sys_id);
m2mGR.addQuery('auto', true);
m2mGR.deleteMultiple();
}
gr = new GlideRecord('dmn_stakeholder_register');
gr.addQuery('portfolio', current.portfolio);
gr.query();
if (gr.hasNext()) {
m2mGR = new GlideRecord('dmn_m2m_demand_stakeholder');
stakeHolderList = "";
while(gr.next()) {
stakeHolderList += gr.getUniqueValue();
stakeHolderList += ",";
}
m2mGR.addQuery('stakeholder', 'IN', stakeHolderList);
m2mGR.addQuery('demand', current.sys_id);
m2mGR.deleteMultiple();
}
}
function addStakeholders() {
// Add new stakeholders for the current portfolio
var gr = new GlideRecord('dmn_stakeholder_register');
gr.addQuery('portfolio', current.portfolio);
gr.query();
while(gr.next()) {
var m2mGR = new GlideRecord('dmn_m2m_demand_stakeholder');
m2mGR.initialize();
m2mGR.demand = current.sys_id;
m2mGR.stakeholder = gr.getUniqueValue();
m2mGR.auto = true;
m2mGR.insert();
}
}
if (!previous.portfolio.nil())
deleteStakeholders();
addStakeholders();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2020 02:27 AM
Hi Venu,
How to restrict/remove autopopulate stakeholders list functionality in Demand.
Thankyou.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 02:48 PM
Hello, Venuk
I do have the same question, I want to be able to autoselect the stakeholders in each demand, based on the portfolio and the program, not only the portfolio, I am wondering if you already identify a way to do that. if yes, can you share it with me?. I think ServiceNow should add this option as part of the OOtB
