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

Hello Shloke



On our instance, Project name on the Demand was changed awhile ago, but it broke functionality to the Project Console. I have added back the short_description on the (task) table back to the demand. When approving a Demand, the project is created but is not showing the Project Name short_description on the (task) table on the Project. I need help getting it to populate that field. I have looked at all information above and do not see any changes this is currently on the Script Include.



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




We are currently on Helsinki Patch 9 and will be moving to Jakarta Patch 7 soon, but I would like to fix this before the upgrade.



Any help is gratefully appreciated.



Thanks


Denee


Thanks Shloke

You have to change update both  Business Rule (Create Strategic Type on Approve)  as well as Script Include (DemandToProjectCreationHelper).

 

 

Manal  AQUIL
Tera Contributor

@Michael Bachme1 


Please follow below steps to copy demand fields to project. 

 

1. Create before insert BR on pm_project with condition demand changes.

2. PFB script (replace the backend name of your custom field to be copied)

 

var refDmd = current.demand.getRefRecord();

current.u_sponsor_guid = refDmd.getValue('u_sponsor_guid');

 

This will copy demand field value from demand to project without making any changes to OOB Script Include : DemandToProjectCreationHelper.

P.S: Please mark helpful, if it works for you.