Accessing global field values in site loop
Finally solved with the following code:
    &lt;select  class=&quot;form-control &quot; name=&quot;sites&quot; id=&quot;company-select&quot;&gt;
    &lt;option value=&quot;&quot; class=&quot;small text-muted&quot;&gt;Please select your company&lt;/option&gt;
    {% for site in allSites %}
        {% set siteId = site.id %}
        {% set groupId = site.getGroup().id %}
        {% if groupId == '5' %}
            {% set setForSiteId = craft.app.getGlobals().getSetByHandle('siteInfo', siteId) %}
            {% if setForSiteId.showInDropdown == '1' %}
            &lt;option value=&quot;{{baseUrl ~ '/' ~ site.handle }}&quot;&gt;{{site.name}}&lt;/option&gt;
                {% endif %}
        {% endif %}
    {% endfor %}
    &lt;/select&gt;