The CreatorCon Call for Content is officially open! Get started here.

How to copy Demand fields to Project fields

Michael Bachme1
Kilo Guru

When a Project is created from a Demand, how do I copy the Business Case field on the Demand table to the Description field on the Project table?

So far I've copied the Demand Business Rule, "Create Strategic Type on Approve" and added the bolded line but it doesn't seem to work:

function createNewProject(){

  var project = new GlideRecord("pm_project");

  project.initialize();

  project.setValue("short_description", current.short_description);

  project.setValue("description", current.business_case); //copy DMND business case to PRJ description

  project.setValue("parent", current.sys_id);

Thoughts?

27 REPLIES 27

The script I'm looking at is the "Create Strategic Type on Approve" business rule.


shloke04
Kilo Patron

Hi,



Prior to Istanbul, Business Rule "Create Strategic Type on Approve" works and the script shown in your thread above also works fine. But from Istanbul onwards, this Business Rule has been made inactive OOB and To copy fields Values and other functionality from Demand to Project there is a Script Include "DemandToProjectCreationHelper" which is being used and this needs to be modified to copy your Business Case Value to Description field on the Project Form as shown below:



find_real_file.png



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Can this be done with the Demand Number? I'd like to pull a link to the Demand Number into the Project so that once the Project is set up there would be an easy way for the team member to click back to the Demand if they wanted to.


I tried adding to the "DemandToProjectCreationHelper" script include (with and without "Display" in the set/getValue lines). Neither worked.



                              project.setValue("short_description", demand.getValue('short_description'));


                              project.setValue("primary_portfolio", demand.getValue("portfolio"));


                            project.setDisplayValue("u_demand", demand.getDisplayValue("number"));



thanks,


Richelle


After reading the Include Script a little closer, I tried something that worked to pull in demand number/link into the project...(added line 6 below) -"u_demand" is the reference field on my project form.



                      if(sys_id && !projId) {
                              var project = new GlideRecord(projectTable);
                              project.initialize();
                              project.setValue("short_description", demand.getValue('short_description'));
                              project.setValue("primary_portfolio", demand.getValue("portfolio"));
                              project.setDisplayValue("u_demand", demand.getDisplayValue("sys_id"));
                              if(project.isValidField('primary_program')){
                                      project.setValue("primary_program", demand.getValue("primary_program"));
                              }

       


Yeah that is possible. Create a New Reference Field on the project Table say "Demand" and refer it to the Demand Table. Once the field is created, Update your Script Include as shown below in the screenshot:



find_real_file.png



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke