Stakeholders

-ooo-
Tera Contributor

Hello Team,

 

I have received below task , please advise on following.

 

1. New button of  stakeholder related list  on demand form should be visible to Demand Manager only

2. When the demand state moves to Screening a notification should get sent to stakeholders having Assessment recipient set to TRUE.

3.Before approving demand there should be at least one resource plan else demand should not get approved, it should pop up an error message.

4. "Create Project" ui action link should be visible for only approved demand.

 

Please advise. 

 

3 ACCEPTED SOLUTIONS

Ratnakar7
Mega Sage
Mega Sage

Hi @-ooo- ,

 

Here are the steps you can take to accomplish the tasks:

  1. To make the "New" button of the stakeholder related list visible only to the Demand Manager, you can use a UI Policy. Create a UI Policy that applies to the "New" button and set its condition to check if the logged-in user is the Demand Manager. If the condition is true, then set the UI Policy action to "Make Visible". Otherwise, set the action to "Make Hidden".

  2. To send a notification to stakeholders when the demand state moves to Screening and their Assessment recipient field is set to true, you can create a Business Rule. The Business Rule should trigger when the demand state is updated to Screening. In the Business Rule, you can use a GlideRecord query to retrieve all the stakeholders whose Assessment recipient field is set to true and send them a notification.

  3. To ensure that there is at least one resource plan before approving a demand, you can use a Client Script. Create a Client Script that runs on the demand approval form and checks if there is at least one resource plan. If there is no resource plan, then show an error message to the user and prevent the demand from being approved.

  4. To make the "Create Project" UI action link visible only for approved demands, you can use a UI Action. Create a UI Action that applies to the "Create Project" link and set its condition to check if the demand is approved. If the condition is true, then set the UI Action to "Make Visible". Otherwise, set the action to "Make Hidden".

I hope this helps! Let me know if you have any questions or need further assistance.

 

If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.

 

Thank you!

Ratnakar

 

View solution in original post

Hi @-ooo- ,

Sure, here's an example code for the Business Rule that sends a notification to stakeholders when the demand state moves to Screening:

// Run the Business Rule when the demand state is updated to Screening
if (current.state.changesTo('screening')) {

  // Retrieve the stakeholders whose Assessment recipient field is set to true
  var gr = new GlideRecord('sc_req_item_stakeholder');
  gr.addQuery('request_item', current.sys_id);
  gr.addQuery('assessment_recipient', true);
  gr.query();

  // Send a notification to each stakeholder
  while (gr.next()) {
    var recipient = gr.getValue('stakeholder');
    var notification = new GlideRecord('sysevent_email_template');
    if (notification.get('name', 'Demand Screening Notification')) {
      gs.eventQueue('email.send', notification, 'request_item', current.sys_id, recipient);
    }
  }
}

 

Thanks,

Ratnakar

View solution in original post

@-ooo- 

In your existing ui action-create Project ,there is a condition box ,you just have to add below line

current.state=approved(here add exact value of approved choice)

 

Thanks,

Manjusha Bangale

View solution in original post

12 REPLIES 12

Ratnakar7
Mega Sage
Mega Sage

Hi @-ooo- ,

 

Here are the steps you can take to accomplish the tasks:

  1. To make the "New" button of the stakeholder related list visible only to the Demand Manager, you can use a UI Policy. Create a UI Policy that applies to the "New" button and set its condition to check if the logged-in user is the Demand Manager. If the condition is true, then set the UI Policy action to "Make Visible". Otherwise, set the action to "Make Hidden".

  2. To send a notification to stakeholders when the demand state moves to Screening and their Assessment recipient field is set to true, you can create a Business Rule. The Business Rule should trigger when the demand state is updated to Screening. In the Business Rule, you can use a GlideRecord query to retrieve all the stakeholders whose Assessment recipient field is set to true and send them a notification.

  3. To ensure that there is at least one resource plan before approving a demand, you can use a Client Script. Create a Client Script that runs on the demand approval form and checks if there is at least one resource plan. If there is no resource plan, then show an error message to the user and prevent the demand from being approved.

  4. To make the "Create Project" UI action link visible only for approved demands, you can use a UI Action. Create a UI Action that applies to the "Create Project" link and set its condition to check if the demand is approved. If the condition is true, then set the UI Action to "Make Visible". Otherwise, set the action to "Make Hidden".

I hope this helps! Let me know if you have any questions or need further assistance.

 

If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.

 

Thank you!

Ratnakar

 

-ooo-
Tera Contributor

The Business Rule should trigger when the demand state is updated to Screening. In the Business Rule, you can use a GlideRecord query to retrieve all the stakeholders whose Assessment recipient field is set to true and send them a notification.  

 

What will be the Business Rule code, can you paste here code . 

Thank you. 

Hi @-ooo- ,

Sure, here's an example code for the Business Rule that sends a notification to stakeholders when the demand state moves to Screening:

// Run the Business Rule when the demand state is updated to Screening
if (current.state.changesTo('screening')) {

  // Retrieve the stakeholders whose Assessment recipient field is set to true
  var gr = new GlideRecord('sc_req_item_stakeholder');
  gr.addQuery('request_item', current.sys_id);
  gr.addQuery('assessment_recipient', true);
  gr.query();

  // Send a notification to each stakeholder
  while (gr.next()) {
    var recipient = gr.getValue('stakeholder');
    var notification = new GlideRecord('sysevent_email_template');
    if (notification.get('name', 'Demand Screening Notification')) {
      gs.eventQueue('email.send', notification, 'request_item', current.sys_id, recipient);
    }
  }
}

 

Thanks,

Ratnakar

-ooo-
Tera Contributor

Hello Ratnakar ,

 

On Which Table we can Write Business rule and In Advanced when to Run Before , after , Async , Query Business Rule ?

 

Please Advise.