- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 05:45 PM - edited 08-30-2024 02:31 AM
SPM: Automatically changing Demand state to Approved
When demand reaches the state “Qualified”, approvals are generated for more than one stakeholders in a related list on the form. When all the stakeholders approve the approvals, the demand field “approval” gets the value “approved” and the demand automatically goes to the state “Approved”.
I would like to change this so that just a single approval is necessary for the state to change to “Approved”.
Does anyone know where I can change this? A business rule that checks for at least one approval doesn’t work because the “When” references the “approval” field mentioned above.
OOTB, which Script include, business rule, flow or workflow sets the Approval field on the demand form to "Approved" when all approving stakeholders approve the demand?
Solved! Go to Solution.
- Labels:
-
Project Portfolio Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 03:14 AM - edited 09-25-2024 03:15 AM
This is how i solved this issue:
Since the approvals are generated in the Approval [sysapproval_approver] table, i created an after business rule on this table. The business rule queries the approvals for the current demand and if there is at least one approval from a stakeholder, it changes the demand field Approval to Approved. See code below.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("dmn_demand");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
gr.approval = 'approved';
gr.state = '8';
gr.update();
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 12:02 AM
Hi @Anthony Okoth ,
I am not sure if this would lead to customization which is not recommended.
But one way to achieve is that you just set one stakeholder to "Assessment Recipient" as yes.
I understand this is not what you are asking for but this is the closest that I can think of hence shared.
If this helps, please mark the response as helpful.
Happy SPM Journey!
Thank You!
Namita Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 01:42 AM - edited 08-30-2024 02:27 AM
Thank you for your input Namita. However, the question is not about Assessments, but rather Approvals.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 10:31 PM
Yes @Anthony Okoth but sorry that i do not have an answer for that one.
Maybe someone else in community can share the configuration.
Happy Weekend !
Namita Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 03:14 AM - edited 09-25-2024 03:15 AM
This is how i solved this issue:
Since the approvals are generated in the Approval [sysapproval_approver] table, i created an after business rule on this table. The business rule queries the approvals for the current demand and if there is at least one approval from a stakeholder, it changes the demand field Approval to Approved. See code below.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("dmn_demand");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
gr.approval = 'approved';
gr.state = '8';
gr.update();
}
})(current, previous);