Need to make Stakeholder Related List Mandatory for Projects
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 09:50 AM
I want to ensure that there is at least one record present in the Stakeholder related list before creating a project.
I've created a Business Rule for this but it doesn't appear to be working, am I pointing the GlideRecord at the correct table?
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var stk = new GlideRecord("dmn_stakeholder_register");
stk.addEncodedQuery("parent=" + current.sys_id);
stk.query();
if(!stk.next())
{
gs.addInfoMessage("Please link a Stakeholder Record at the bottom.");
action.setRedirectURL(current);
current.setAbortAction(true);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 11:26 AM
You can confirm the glideRecord table by checking the existing stakeholder list records.
Also the make sure the business rule should be on before insert on project table.
And in second line of code you are checking incorrect sys_id for parent field. You should be the sys_id of record were this project is creating or the record were the related list is present.
Try: current.parent.sys_id // instead of parent you can also use another field which we give you the sys_id of record from were you wanted to create the project.
Kindly mark my answer as Correct and helpful based on the Impact.
Kindly mark the answer ✔️ Correct or Helpful ✔️ If it addresses your concern.
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 05:47 AM
Hi use below script.