Populate Secondary Project Manager on Status Report (SPM)

Mallika Bhupath
Tera Contributor

All,

 

I have a field called "Secondary Project Manager" on the project form. On the status report, I want the "Secondary Project Manager" to be populated with the name inserted on the field. However, it does not seem to be working.

Currently, the Secondary Project Manager is pulling the same value as Project Manager.

Can you please let me know where to modify?
 
Please find the screenshots attached.

Thanks,
Mallika

4 REPLIES 4

Runjay Patel
Giga Sage

Hi @Mallika Bhupath ,

 

Code seems okay but check the HTML tag where you are using "Secondary Project Manager" to display, May be you have used "Project Manager" keyword instead of "Secondary Project Manager". It happen due to copy past.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Part 2. In this video i have talked about overview on ServiceNow platform/tool. How you can opt for personal dev instance (PDI)? how to login in ServiceNow instance and navigation to OOB modules. For document please visit: https://servicenowwithrunjay.com/ Follow Facebook page for latest update on

Hi @Runjay Patel ,
This is the HTML code below.

MallikaBhupath_1-1730916696584.png

 



 

Hi @Mallika Bhupath ,

 

As expected you are using same variable for both.

in script you have to set secondMgr and use the same in html.

share all script I can help you where to make changes.

Hi @Runjay Patel 

This is the script include :

var UICPmProjectStatusReport = Class.create();
UICPmProjectStatusReport.prototype = {
    initialize: function() {},

    projectRecord: function(sysId, projectTable) {
        //gs.info("Into projectRecord: " + sysId + " - " + projectTable);
        var gr;
        if (JSUtil.notNil(projectTable)) {
            gr = new GlideRecord(projectTable); // for Teamspaces
        } else {
            gr = new GlideRecord("pm_project");
        }
        gr.get(sysId);
        return gr;
    },

    getIcon: function(value) {
        if (value == 'green')
            return 'icon-success-circle';
        else if (value == 'yellow')
            return 'icon-not-started-circle';
        else
            return 'icon-warning-circle';
    },

    headerInfoPlain: function(sysId, weekDate, reportId) {
        //gs.info("Into headerInfo: " + sysId);
        var projectStatusRec, startDate, endDate, workStart, workEnd, approvedStartDate, approvedEndDate, cost, workCost;
        if (reportId)
            projectStatusRec = this.getProjectStatusBySysId(reportId);
        else if (weekDate)
            projectStatusRec = this.getProjectStatus(sysId, weekDate);
        else {
            projectStatusRec = this.getProjectStatusByProjectID(sysId);
            if (projectStatusRec.hasNext())
                projectStatusRec.next();
        }
        var projectRec = this.projectRecord(sysId);
        if (JSUtil.notNil(projectStatusRec.getValue("start_date"))) {
            var psd = projectStatusRec.start_date.getGlideObject();
            startDate = psd.getLocalDate().getDisplayValue();
        }
        if (JSUtil.notNil(projectStatusRec.getValue("end_date"))) {
            var ped = projectStatusRec.end_date.getGlideObject();
            endDate = ped.getLocalDate().getDisplayValue();
        }
        if (JSUtil.notNil(projectStatusRec.getValue("work_start"))) {
            var asd = projectStatusRec.work_start.getGlideObject();
            workStart = asd.getLocalDate().getDisplayValue();
        }
        if (JSUtil.notNil(projectStatusRec.getValue("work_end"))) {
            var aed = projectStatusRec.work_end.getGlideObject();
            workEnd = aed.getLocalDate().getDisplayValue();
        }
        if (JSUtil.notNil(projectStatusRec.getValue("approved_start_date"))) {
            var apsd = projectStatusRec.approved_start_date.getGlideObject();
            approvedStartDate = apsd.getLocalDate().getDisplayValue();
        }
        if (JSUtil.notNil(projectStatusRec.getValue("approved_end_date"))) {
            var aped = projectStatusRec.approved_end_date.getGlideObject();
            approvedEndDate = aped.getLocalDate().getDisplayValue();
        }
        if (this._isProjectCurrencySelected(projectRec)) {
            if (projectStatusRec.planned_cost_project_currency)
                cost = projectStatusRec.planned_cost_project_currency.getDisplayValue();
            if (projectStatusRec.actual_cost_project_currency)
                workCost = projectStatusRec.actual_cost_project_currency.getDisplayValue();
        } else {
            if (projectStatusRec.planned_cost)
                cost = projectStatusRec.planned_cost.getCurrencyDisplayValue();
            if (projectStatusRec.work_cost)
                workCost = projectStatusRec.work_cost.getCurrencyDisplayValue();
        }

        var statusReportData = {
            short_description: projectRec.getValue("short_description"),
            number: projectRec.getValue("number"),
            project_manager_label: gs.getMessage("Project Manager"),
            project_manager_value: projectRec.getDisplayValue("project_manager"),
            project_secondary_manager_label: gs.getMessage("Secondary Project Manager"),
            project_secondary_manager_value: projectRec.getDisplayValue("u_secondary_project_manager"),
            portfolio_label: gs.getMessage("Portfolio"),
            portfolio_value: projectRec.getDisplayValue("primary_portfolio"),
            start_date_label: gs.getMessage("Planned Start Date"),
            start_date_value: startDate,
            work_start_label: gs.getMessage("Actual Start Date"),
            work_start_value: workStart,
            work_end_exists: JSUtil.notNil(projectRec.getValue("work_end")),
            work_end_label: gs.getMessage("Actual End Date"),
            work_end_value: workEnd,
            end_date_label: gs.getMessage("Planned End Date"),
            end_date_value: endDate,
            approved_start_date_label: gs.getMessage("Approved Start Date"),
            approved_start_date_value: approvedStartDate,
            approved_end_date_label: gs.getMessage("Approved End Date"),
            approved_end_date_value: approvedEndDate,
            percent_complete_label: gs.getMessage("% Complete"),
            percent_complete_value: projectStatusRec.getDisplayValue("percent_complete"),
            state_label: gs.getMessage("State"),
            state_value: projectStatusRec.getDisplayValue("state"),
            planned_cost: cost,
            work_cost: workCost,
            phase: projectStatusRec.getDisplayValue("phase")
        };