Accessing global field values in site loop I have a drop down select that I am populating with sites.
I've added a lightswitch field (handle 'showInDropDown') to the global set 'siteInfo' with the hope of getting the lightswitch value per site in the loop below.
{% for siteId in currentSite.group.sites %}
    {% set setForSiteId = craft.app.getGlobals().getSetByHandle('siteInfo', SiteId =5) %}
    {{ setForSiteId.showInDropdown }}
{% endfor %}

The lightswitch field is set to translate per site.
setForSiteId is always coming back null:
Impossible to access an attribute (&quot;showInDropdown&quot;) on a null variable.

I am not sure if I am missing something. Is there another way to access global variables/values per site?
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;