- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 02:00 AM
In Demand table I am customising the Create project UI Action.
I am autopopulating and creating a project from Demand table to Project table. In Project record I am auto filling the details from Demand record.
There is a field type 'glide_list', I am not able to auto fill this field from demand to project.
How to do it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 02:15 AM
Solution (Best Practice)
You must copy the list of sys_ids from the Demand's glide_list field and use .setValue() or .addJoin() logic to populate the glide_list field on the new Project record.
Let’s say your glide list field is called stakeholders on both tables.
Here’s how to handle it in your UI Action script:
// Assuming current is the Demand record
var project = new GlideRecord('pm_project');
project.initialize();
// Fill other fields normally
project.name = current.name;
project.description = current.description;
// etc...
// Now handle glide_list: stakeholders
var stakeholders = current.stakeholders; // this returns a comma-separated sys_id list
if (stakeholders) {
project.stakeholders = stakeholders; // this works only if field is defined on the form
// If you want to ensure saving explicitly
project.setValue('stakeholders', stakeholders);
}
var projectSysId = project.insert();
// Optional: Show message or redirect
gs.addInfoMessage("Project created from Demand: " + projectSysId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 02:15 AM
Solution (Best Practice)
You must copy the list of sys_ids from the Demand's glide_list field and use .setValue() or .addJoin() logic to populate the glide_list field on the new Project record.
Let’s say your glide list field is called stakeholders on both tables.
Here’s how to handle it in your UI Action script:
// Assuming current is the Demand record
var project = new GlideRecord('pm_project');
project.initialize();
// Fill other fields normally
project.name = current.name;
project.description = current.description;
// etc...
// Now handle glide_list: stakeholders
var stakeholders = current.stakeholders; // this returns a comma-separated sys_id list
if (stakeholders) {
project.stakeholders = stakeholders; // this works only if field is defined on the form
// If you want to ensure saving explicitly
project.setValue('stakeholders', stakeholders);
}
var projectSysId = project.insert();
// Optional: Show message or redirect
gs.addInfoMessage("Project created from Demand: " + projectSysId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 02:17 AM
If it's a one-on-one copy and the fields are both referencing the same table, with the same reference qualifier, you should be able to do it with:
project.field = current.field.
Assuming that you tried that: please share more information about the fields, the tables they are referencing and the reference qualifier behind it.
Having a look at your UI action itself would also help.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark