- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 02:34 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 04:06 AM
Hi @Community Alums ,
Here are the steps you can take to accomplish the tasks:
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".
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.
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 05:20 AM
Hi @Community Alums ,
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 11:28 PM - edited 04-02-2023 11:28 PM
@Community Alums
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 04:06 AM
Hi @Community Alums ,
Here are the steps you can take to accomplish the tasks:
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".
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.
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 04:56 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 05:20 AM
Hi @Community Alums ,
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 07:50 AM
Hello Ratnakar ,
On Which Table we can Write Business rule and In Advanced when to Run Before , after , Async , Query Business Rule ?
Please Advise.