"Create project from a template" action does not retain relationship to parent project

GregF2
Tera Expert

On project form when I go to Sub-Projects related list and click new I am provided the option "To create project from a template click here".  When I use this action and apply the template, the Project does not get created underneath the Project where I navigated from.  If I fill in the required fields, click save, then click "To apply template click here", then the parent information is stored on sub-project.  This is confusing to users.  Is there something I am missing?  At very least I would like to hide the message that does not work as expected.  Can someone direct me to where that might be in system?  I searched script include, business rule, and client script, script field, for that message and couldn't find it.

 

find_real_file.png

find_real_file.png

 

 

1 REPLY 1

Michael Jones -
Giga Sage

You can disable this for sub-projects, with a little bit of effort. As this would require you to modify an out of the box artifact, you would want to make a copy, modify the copy so that you get updates with upgrades. 

Start by going to System UI > Formatters

Find the record named "Create Project From Template" and open it. 

Type a new name in name (maybe just add a 2 at the end) and then right-click in the header and Insert and Stay.

On the new record and click the Related Link for View UI Macro for this Formatter.

We need a new record here as well, so add a 2 at the end of the name and then use Insert and Stay

In the XML field, find the section near the top that starts with "<g2:evaluate var="jvar_show_create_template" jelly="true">" and add the following just above the line "show_template_message = (show_create_template || show_apply_template);"

	        //this will hide the action if there is a parent defined
	        if(current.getValue('parent') != null) {
		  show_apply_template = false;
		  show_create_template = false;
		}

The whole section should look like this: 

    <g2:evaluate var="jvar_show_create_template" jelly="true">
            var show_template_message = false;
            var show_create_template = false;
            var show_apply_template = false;
            if  (gs.hasRole('project_manager')) {
                if  (GlideProjectTemplate.getTemplateCount((jelly.jvar_config_id || '') + '') != 0) {
                    if ( current.isNewRecord())
                    	show_create_template = true;
                    else if (new ProjectWorkbenchService().hasChildren(current.sys_id) == false)
                    	show_apply_template = true;
                }
            }
		//this will hide the action if there is a parent defined
		if(current.getValue('parent') != null) {
		  show_apply_template = false;
		  show_create_template = false;
		}
	
            show_template_message = (show_create_template || show_apply_template);
    </g2:evaluate>

Update your record. 

Now, open the first record that you created (Create Project From Template2) under System UI > Formatters

Change the value for Formatter to be name of the second record you created (create_project_formatter2) and update. 

Now, go to a project record and click on the header and select Configure > Form Layout.

Near the top you will see a line that says "Create Project From Template". Move this one to the left. 

In the left list, find "Create Project From Template2" and add it to the right side (should be just under Process Flow". 

Test it out! From the project list view select "New" and make sure you see the action at the top of the screen. Cancel / close out. 

Go to an existing project and, in the related list for sub projects, click new. Make sure you don't see the action at the top.

Should work like a charm!

 

Or if that is too much trouble (I would understand if it is) you can skip to the part where you configure the form layout and just remove the formatter from the top of the form...and you'll never see it again 🙂

 

If this was helpful or correct, please be kind and click appropriately!

Michael Jones - Proud member of the CloudPires Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!