How to copy Demand fields to Project fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2017 09:13 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2017 11:31 AM
There is a Create Project UI action that is available on the demand table after demand is approved, did you check that out?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2017 02:18 PM
Yes, but it only copies the short description.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2017 02:42 PM
Can you add the one more line next to short description in script Include which UI action call to update Project fields.
project.setValue("description", demand.getValue('business_case'));
Thanks,
Bharath.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 09:05 AM
It doesn't work.
function createNewProject(){
var project = new GlideRecord("pm_project");
project.initialize();
project.setValue("short_description", current.short_description);
project.setValue("description", current.business_case);
project.setValue("description", demand.getValue('business_case'));
project.setValue("parent", current.sys_id);
var projId = project.insert();
if(JSUtil.nil(current.related_records))
current.related_records = projId;
else
current.related_records = current.related_records + "," + projId;
current.project = projId;
gs.addInfoMessage(gs.getMessage('Project {0} has been created.', project.number));
return project;
}