Read Lookup Type Custom Field Value using JavaScript Object Model(JSOM)

Read Lookup Type Custom Field Value using JavaScript Object Model(JSOM)

Read Lookup Type Custom Field Value JavaScript Object Model JSOM in Project online or Project Server. Here are many ways to Read Lookup Type Custom Field Value. The Lookup Type field can be updated using Client side object model and also can Read Lookup Type Custom Field Value JavaScript Object Model JSOM. One another way to update

Reference article  Get Custom Field Value using JavaScript Object Model(JSOM)

    function doWithProject(projectInfo) {

        alert('Project Name: ' + projectInfo.get_name());
        var fieldValues = projectInfo.get_includeCustomFields().get_fieldValues();
        var CFenumerator = projectInfo.get_customFields().getEnumerator();
        while (CFenumerator.moveNext()) {
            var ISLookup;
            var customField = CFenumerator.get_current();
			var str1 = fieldValues[customField.get_internalName()];
			var str2="Entry";
			if (str1.indexOf(str2) != -1) {
                ISLookup == true; 
			else {
			ISLookup == false; 
			alert(customField.get_name() + " = " + fieldValues[customField.get_internalName()]); }


If Custom field is the non-lookup type, you can get custom field value if the custom field is lookup type you will get Lookup Table Entry GUID like Entry_GUID.

To pass the lookup table entry GUID in this method and you can get Lookup Type custom field value.

Reference Article Update Lookup Type Custom Field value Using Javascript object Model(JSOM).

 function getCFComplete(response) {
        var cfEnumerator = customFieldsOBJ.getEnumerator();

        while (cfEnumerator.moveNext()) {
            var cf = cfEnumerator.get_current();
            while (cfEnumerator.moveNext()) {
                var cf = cfEnumerator.get_current();

                    Id: cf.get_id(),
                    Name: cf.get_name(),
                    InternalName: cf.get_internalName()
                if (cf.get_name() === CustomfieldName) {
                    var lookupTable = cf.get_lookupTable();

                    ProjectContext.executeQueryAsync(function () {
                        var ltEntries = lookupTable.get_entries();

                        ProjectContext.executeQueryAsync(function () {
                            var ltEnum = ltEntries.getEnumerator();

                            while (ltEnum.moveNext()) {
                                var ltEntry = ltEnum.get_current();

                                    InternalName: ltEntry.get_internalName(),
                                    Value: ltEntry.get_value(),
                                    FullValue: ltEntry.get_fullValue(),
                                    Description: ltEntry.get_description()
    function ReadLookupCustomField(lookupEntryGUID) {
        var lookupEntryData = $.grep(lookupEntriesOBJ, function (val) {  //Filter lookup entry value
            return val.InternalName === lookupEntryGUID; //*ME: This is your one of lookup entry value of your lookup table

        // If you custom field is lookup type then if condition work
        if (lookupEntryData.length > 0 && customfieldData.length > 0) {
            var LookupEntryInternalName = lookupEntryData[0].Value;
            // If your custom field is NON-lookup type then else condition work

Hope this article will help you. Like comment and Share.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!