CustomFields Only Work Partially?

Good day all.

I have this form, which is automatically populated by the code below upon entering the client’s email address:

import wixData from 'wix-data';
import wixUsers from 'wix-users';
import {customFieldsFunction} from 'backend/customFields';

export function inputLoginEmail1_change(event) {
 let client1 = $w('#inputLoginEmail1').value;
    wixData.query("Members/PrivateMembersData")
        .eq('loginEmail', client1)
        .find()
        .then((results)=>{
         if (results.items.length === 0) {
                $w('#textUserError').show();
         } else {
                $w('#textUserError').hide();
                 let items=results.items;
                 let FN = items[0].firstName;
                 let LN = items[0].lastName;
                 let userID = items[0]._id;
                customFieldsFunction(userID)
                .then((customFields) => {
                   let DoB = customFields.Birthdate;
                   let CoB = customFields.Birthplace;
                   let Referral = customFields.Referral;
                   let Gender = customFields.Gender;
                   let Phone = customFields.phones.toString();
                   let CoR = customFields.Residence;
                    $w('#inputDoB').value = DoB;
                    $w('#inputCoB').value = CoB;
                    $w('#inputCoResidence').value = CoR;
                    $w('#inputGender').value = Gender;
                    $w('#inputReferred').value = Referral;
                    $w('#inputPhone').value = Phone;
                })
                $w('#inputFN').value = FN;
                $w('#inputLN').value = LN;
            }
        })
}

Everything works perfectly, except for Birthdate.

As you can see from the Contact List screenshot below, Birthdate is a valid field, but for some reason it is the only one that the code does not bring back.

Below I also included the code in the backend customFieldsFunction(userID) function.

Is there an error in the code somewhere?

Thank you

import wixCrmBackend from 'wix-crm-backend';

export function customFieldsFunction (contactId) {
 return wixCrmBackend.getContactById(contactId);
}

1 Like

Any comments please?

I have a similar issue. The information is loaded only on preview, but not on published mode. Were you able to solve your problem?