Set First Name, Middle Name and Last Name in Catalog item

Shoheb Shaikh
Kilo Contributor

Hello Experts,

We have designed a Catalog item and it has 2 variables. Requested For (this fields get auto populated based on logged user). Requestor Full Name (This is a Single line text field).

I want to display requested for Full Name i.e. First Name, Middle Name and Last Name in the String field. If anyone changes the Value of requested for then automatically Requestor Full Name should be updated with the new Value.

How can I achieve this?

Regards,

Shoheb 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Shoheb Shaikh 

you can use this

getReference() with callback method using onChange client script on Requested For variable

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

var ref = g_form.getReference('requested_for', callBackMethod);

}

function callBackMethod(ref){

var firstName = ref.first_name;

var lastName = ref.last_name;

var middleName = ref.middle_name;

var finalValue = firstName  + ',' + middleName + ',' + lastName;

}

Regards
Ankur

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

View solution in original post

11 REPLIES 11

@Shoheb Shaikh 

Glad to know.

Please mark appropriate responses helpful as well.

Regards
Ankur

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

@Shoheb Shaikh 

Please close your previous questions by marking appropriate response as correct.

https://community.servicenow.com/community?id=community_question&sys_id=3290fd68dbaea4103daa1ea66896...

https://community.servicenow.com/community?id=community_question&sys_id=e74989f5db026090ab0202d5ca96...

Regards
Ankur

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