- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 08:36 PM
Hi Everyone,
I am trying to display the value on stakeholders table that is currently related list into Project.
Which i want to display the value using client script on this below field.
Can you check this below code ?
function onLoad() {
var PO = new GlideRecord('pm_m2m_project_stakeholder');
PO.addQuery('project');
PO.addQuery('expectationINproject_owner');
PO.query();
if (PO.next()){
g_form.setDisplay('u_project_owner' , PO.stakeholder.user.name.getDisplayValue() );
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 12:31 AM
Hi @Jeck Manalo
Yeah....Its best practice now a days to use flow designer instead of business rule on table....indeed.
Fix script : It is server side script similar to business rule to update records in bulk manner which you can run on demand.
E.g., If you want to update the state of incident to closed which are older that 6 months like wise...
another example with screenshot :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 01:36 AM
I figured out that I just need to reconfigure my works on flow designer.
its now working 🙂 but thank you for those idea it's help a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 08:43 PM
Hello @Jeck Manalo
It is not recommended to use GlideRecord() object in client script...!!!
Can you explain your requirement bit more so we can help you...!!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 09:01 PM
Hello,
I see.
the requirement is I need to display the value in u_project_owner' (Field Form) which is on the Project.
The value will be based on the stakeholders table that is linked to current Project.
If you look this one its linked to Project table, and for this record I need it to display the value of Project Owner into the 2nd pic below.
I need to display it the stakeholder value here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 09:33 PM
You need to create after business rule which run on Insert and Update.
You need to create the business rule on stakeholder table. Then go to Advanced tab and write the script something below
var rec = new GlideRecord('name_of_project_table');
rec.<field_name_on_project table> = current.<field_name_on_stakeholder_table>;
rec.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 10:10 PM
Hi,
In stakeholders table there is difference function which I need to filter only to project owner using this query expectationINproject_owner.
