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

@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.

Thank you bharath_kumer,   the name of the script include is AjaxCreateRelatedEntityFromDemand, I added the lines as you said and it worked for me!



Regards.


Thanks bharath_kumar.



It script include works for me too.



Regards


It should copy more than just the short description. If the fields are filled in, it should copy them over to appropriate field.


That is the behavior I was expecting. I'm not sure why it is not.