How to fetch delivery manager of selected project?

Supriya P
Tera Contributor

I have created record producer.

SupriyaP_0-1703249094397.png

 

where, I am fetching projects which are tagged to 'Project Manager' in 'Project' variable below the Project manager variable.

(Multiple projects are assigned to project manager)

The requirement is,

if project manager selects 1 project then BCP Approver should be autopopulated with the delivery manager of the selected project.

How can we achieve this scenario?

1 ACCEPTED SOLUTION

@Supriya P 

that's correct.

Your variable is not reference type?

It should be reference type. User won't remember project name and it should not be a text variable

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Supriya P 

you should use onChange catalog client script to fetch the BCP Approver from that Project

OR

you can use Utah Auto-populate feature

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I have written below script include and catalog client script.

I am getting alert(answer) as a null value.

 

Script include :

  deliveryManager: function() {
        var projectName = this.getParameter('sysparm_prjName');
        var projectList = [];
        var x = '';

        var prj = new GlideRecord('pm_project');
        //prj.addQuery('short_description', projectName);
        prj.addEncodedQuery('short_description=' + 'Acme Workday to Payroll Automation');
        //prj.addEncodedQuery('active=true^short_descriptionIN');
        prj.query();
        if (prj.next()) {
            //  projectList.push(prj.short_description.getDisplayValue());
            //x=  prj.getValue('u_delivery_manager');
            x = prj.u_delivery_manager;
        }
        return x;
        //short_description=Acme Workday to Payroll Automation
    },
 
Catalog Client Script:
 
function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    var ga = new GlideAjax('fetch_delivery_manager');
    ga.addParam('syaparm_name', 'deliveryManager');
    ga.addParam('sysparm_prjName', newValue);
    ga.getXML(projectDetails);
    alert('hi');

    function projectDetails(response) {

        var answer = response.responseXML.documentElement.getAttribute("answer");
        alert(answer);
        g_form.setValue('bcp_approver', answer);
    }
}

@Ankur Bawiskar ,Utah Autopopulate feature is only working for reference field type?

@Supriya P 

that's correct.

Your variable is not reference type?

It should be reference type. User won't remember project name and it should not be a text variable

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader