How to bulk populate Planning Item table after adding new custom field mappings

Marlon Dale
Tera Expert

I've added new custom field mappings to the alignment integrations. These fields are already populated in the dmn_demand and pm_project tables, but are not populated in the planning item table. I tried to run a background script to just "touch" those fields hoping the update would populate the planning item table and it didn't work. I then went into an individual project record, changed the existing value, saved, changed it back to the original value, saved, and then saw that the planning item table was populated. What is the best way to do this with 1000s of records? 


The script I used that didn't work:

var grAlignProject = new GlideRecord('sn_align_core_project');
 grAlignProject.query();
 while (grAlignProject.next()) {
     var grProject = new GlideRecord('pm_project');
     if (grProject.get(grAlignProject.getValue('execution_entity_item'))) {
         grProject.setValue('business_unit', grProject.getValue('business_unit'));
         grProject.update();
     }
 }
2 REPLIES 2

SaiShekharP
ServiceNow Employee
ServiceNow Employee

Hi @Marlon Dale 
Can you try replacing the penultimate line with below line (Assuming you want to update the records on alignment side)!

grAlignProject.setValue('business_unit', grProject.getValue('business_unit'));

 

It didn't work. Still the only thing that's working is manually changing the business unit on the pm_project record form to a new value, then changing it back.