Is it possible to get the field value of user reference autocomplete from username? I am able to find the username. From the username I need to fill the user reference field. 

Is there a way to get the user reference field value from username?

Example:

I have username: abc
I need Reference field value: Abc(201)

user_load_by_name('admin')

stdClass Object
(
    [uid] =&gt; 1
    [name] =&gt; admin
    [pass] =&gt; $S$DYk/jJiQjg07cciSAeU2EeP3XVMm/WhWHG19rA1iQf/FIqdOmY5p
    [mail] =&gt; test@gmail.com
    [theme] =&gt; 
    [signature] =&gt; 
    [signature_format] =&gt; 
    [created] =&gt; 1469189190
    [access] =&gt; 1511853833
    [login] =&gt; 1511853621
    [status] =&gt; 1
    [timezone] =&gt; Asia/Kolkata
    [language] =&gt; 
    [picture] =&gt; 
    [init] =&gt; test@gmail.com
    [data] =&gt; 
    [uuid] =&gt; 77ef7473-31cd-432e-ace6-26f1b075abb5
    [roles] =&gt; Array
        (
            [2] =&gt; authenticated user
            [3] =&gt; administrator
        )

    [rdf_mapping] =&gt; Array
        (
            [rdftype] =&gt; Array
                (
                    [0] =&gt; sioc:UserAccount
                )

            [name] =&gt; Array
                (
                    [predicates] =&gt; Array
                        (
                            [0] =&gt; foaf:name
                        )

                )

            [homepage] =&gt; Array
                (
                    [predicates] =&gt; Array
                        (
                            [0] =&gt; foaf:page
                        )

                    [type] =&gt; rel
                )

        )

)
You can do this with user_load_by_name($name).

Once you load the user object you should be able to access the reference field normally.