Based on zip code how to get the consultant record details and display.

using this code we can get the consultent details of the customer and show the values for more details check in the elovate project
findconsultant:function()
    {
            var zip = request.getParameter('zipcode');
            console.error('Test-Rohit zip',zip);
            var ziplength = zip.length;
            if(ziplength >= 3) 
            {
                var zipper = zip.substring(0, 3);
                // Define search filters - startswith / contains
                var filters = new Array();
                filters[0] = new nlobjSearchFilter ('zipcode', null, 'startswith', zipper);
                filters[1] = new nlobjSearchFilter ('releasedate', null, 'isempty');
                filters[2] = new nlobjSearchFilter ('custentity36', null, 'is', 'FALSE');
                console.error('Test-Rohit filters',filters);
                // Define search columns
                var columns = new Array();
                columns[0] = new nlobjSearchColumn('entityid');
                columns[1] = new nlobjSearchColumn('email');
                columns[2] = new nlobjSearchColumn('mobilephone');
                columns[3] = new nlobjSearchColumn('altphone');
                columns[4] = new nlobjSearchColumn('fax');
                columns[5] = new nlobjSearchColumn('supervisor');
                columns[6] = new nlobjSearchColumn('title');
                columns[7] = new nlobjSearchColumn('zipcode');
                columns[8] = new nlobjSearchColumn('comments');
                columns[9] = new nlobjSearchColumn('image');
                columns[10] = new nlobjSearchColumn('jobdescr');
                columns[11] = new nlobjSearchColumn('statedisplayname');
                columns[12] = new nlobjSearchColumn('city');
                columns[13] = new nlobjSearchColumn('billaddress');
                console.error('Test-Rohit columns',columns);
                var searchresults = nlapiSearchRecord('employee', 'customsearch868_2', filters, columns);
                // Extract information from search results
                    var resultArray = [];
                    for (var i = 0; searchresults != null && i < searchresults.length; i++)
                    {
                        var result = {};
                        result.entityid = searchresults[i].getValue('entityid');
                        result.email = searchresults[i].getValue('email');
                        result.mobilephone = searchresults[i].getValue('mobilephone');
                        result.altphone = searchresults[i].getValue('altphone');
                        result.fax = searchresults[i].getValue('fax');
                        result.supervisor = searchresults[i].getValue('supervisor');
                        result.title = searchresults[i].getValue('title');
                        result.zipcode = searchresults[i].getValue('zipcode');
                        result.comments = searchresults[i].getValue('comments');
                        result.image = searchresults[i].getValue('image');
                        result.jobdescr = searchresults[i].getValue('jobdescr');
                        result.statedisplayname = searchresults[i].getValue('statedisplayname');
                        result.city = searchresults[i].getValue('city');
                        result.billaddress = searchresults[i].getValue('billaddress');
                        result.address1 = searchresults[i].getValue('address1');
                        result.address2 = searchresults[i].getValue('address2');
                        result.country = searchresults[i].getValue('country');
                        result.note = searchresults[i].getValue('custentity30_2');
                        result.territory = searchresults[i].getValue('custentity31_2');
                        result.vimagey = searchresults[i].getText('custentityfind_consultant_image');
                        result.vimageid = searchresults[i].getValue('custentityfind_consultant_image');
                        result.no_consultanti = 'https://1258556.app.netsuite.com/core/media/media.nl?id=143670&c=1258556&h=e3b97c496edfbd5ea3d6';
                        resultArray.push(result);
                    }


                    return resultArray;
            }
        }

Leave a comment

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