Body: <p>I'm using plugin Ad Wizard, supported custom fields.</p>
  
  <p>Trying include additional asset field for html5 animated banners.</p>
  
  <p>Here is dump array:</p>
  
  <pre><code>["groupId"]=&gt;
    string(1) "1"
    ["assetId"]=&gt;
    string(3) "144"
    ["url"]=&gt;
    string(14) "http://localhost"
    ["startDate"]=&gt;
    NULL
    ["endDate"]=&gt;
    NULL
    ["maxViews"]=&gt;
    string(1) "0"
    ["totalViews"]=&gt;
    string(1) "2"
    ["totalClicks"]=&gt;
    string(1) "0"
    ["filepath"]=&gt;
    string(0) ""
    ["width"]=&gt;
    int(0)
    ["height"]=&gt;
    int(0)
    ["html"]=&gt;
    string(0) ""
    ["revisionCreatorId":protected]=&gt;
    NULL
    ["revisionNotes":protected]=&gt;
    NULL
    ["_fieldsByHandle":"craft\base\Element":private]=&gt;
    NULL
    ["_fieldParamNamePrefix":"craft\base\Element":private]=&gt;
    NULL
    ["_normalizedFieldValues":"craft\base\Element":private]=&gt;
    NULL
    ["_nextElement":"craft\base\Element":private]=&gt;
    bool(false)
    ["_prevElement":"craft\base\Element":private]=&gt;
    bool(false)
    ["_parent":"craft\base\Element":private]=&gt;
    NULL
    ["_prevSibling":"craft\base\Element":private]=&gt;
    NULL
    ["_nextSibling":"craft\base\Element":private]=&gt;
    NULL
    ["_eagerLoadedElements":"craft\base\Element":private]=&gt;
    NULL
    ["_currentRevision":"craft\base\Element":private]=&gt;
    NULL
    ["_errors":"yii\base\Model":private]=&gt;
    NULL
    ["_validators":"yii\base\Model":private]=&gt;
    NULL
    ["_scenario":"yii\base\Model":private]=&gt;
    string(7) "default"
    ["_events":"yii\base\Component":private]=&gt;
    array(0) {
    }
    ["_eventWildcards":"yii\base\Component":private]=&gt;
    array(0) {
    }
    ["_behaviors":"yii\base\Component":private]=&gt;
    array(1) {
      ["customFields"]=&gt;
      object(craft\behaviors\ContentBehavior)#545 (18) {
        ["bannerHtml"]=&gt;
        NULL
        ["_customFieldValues":"craft\behaviors\ContentBehavior":private]=&gt;
        array(0) {
        }
        ["owner"]=&gt;
        *RECURSION*
      }
    }
    ["id"]=&gt;
    string(3) "282"
    ["tempId"]=&gt;
    NULL
    ["draftId"]=&gt;
    NULL
    ["revisionId"]=&gt;
    NULL
    ["uid"]=&gt;
    string(36) "150f6150-28a2-4237-a2fc-bcd62751fc17"
    ["fieldLayoutId"]=&gt;
    string(1) "7"
    ["structureId"]=&gt;
    NULL
    ["contentId"]=&gt;
    string(3) "382"
    ["enabled"]=&gt;
    string(1) "1"
    ["archived"]=&gt;
    string(1) "0"
    ["siteId"]=&gt;
    string(1) "1"
    ["enabledForSite"]=&gt;
    string(1) "1"
    ["title"]=&gt;
    string(8) "Banner 1"
    ["slug"]=&gt;
    NULL
    ["uri"]=&gt;
    NULL
    ["dateCreated"]=&gt;
    object(DateTime)#542 (3) {
      ["date"]=&gt;
      string(26) "2019-10-08 16:36:46.000000"
      ["timezone_type"]=&gt;
      int(3)
      ["timezone"]=&gt;
      string(9) ""
    }
    ["dateUpdated"]=&gt;
    object(DateTime)#544 (3) {
      ["date"]=&gt;
      string(26) "2019-10-09 12:22:32.000000"
      ["timezone_type"]=&gt;
      int(3)
      ["timezone"]=&gt;
      string(9) ""
    }
    ["dateDeleted"]=&gt;
    NULL
    ["root"]=&gt;
    NULL
    ["lft"]=&gt;
    NULL
    ["rgt"]=&gt;
    NULL
    ["level"]=&gt;
    NULL
    ["searchScore"]=&gt;
    NULL
    ["trashed"]=&gt;
    bool(false)
    ["awaitingFieldValues"]=&gt;
    bool(false)
    ["propagating"]=&gt;
    bool(false)
    ["propagateAll"]=&gt;
    bool(false)
    ["newSiteIds"]=&gt;
    array(0) {
    }
    ["resaving"]=&gt;
    bool(false)
    ["duplicateOf"]=&gt;
    NULL
    ["previewing"]=&gt;
    bool(false)
    ["hardDelete"]=&gt;
    bool(false)
  }
  </code></pre>
  
  <p>bannerHtml value all time empty, trying with text field, its working fine, problem only in asset field.</p>
  
  <p>UPD:</p>
  
  <p>This solution works fine:</p>
  
  <pre><code>{% for ad in craft.adWizard.ads.group('TopBannerLeft').orderBy('RAND()').all() %}
      {% set asset = craft.assets().id(ad.assetId).one() %}
      {% if asset.extension == 'html' %}
          &lt;iframe src="{{ asset.getUrl() }}" frameborder="0" vspace="0" hspace="0" width="390" height="80" marginwidth="0" marginheight="0" scrolling="no"&gt;&lt;/iframe&gt;
      {% else %}
          {{ ad.displayAd() }}
      {% endif %}
  {% endfor %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-09T23:04:16.267Z
Comments.Text: Hi Elexer, I'm the author of the Ad Wizard plugin. Can you show us the Twig code?
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-11T07:22:29.083Z
Comments.Text: Hi, updated with twig code, only this solution work for me, custom field with asset value given null any time.
Comments.UserDisplayName: Elexer
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-14T20:11:36.897Z
Comments.Text: Ok great! You should post your solution below as an Answer, then mark it as the "Accepted Answer". :)
Comments.UserDisplayName: Lindsey D
Tags: <craft3><plugins>
Title: Ad Wizard custom field asset
ThreadText: # Ad Wizard custom field asset
  
  (Asked by: username_0 on 2019-10-09)
  
  I'm using plugin Ad Wizard, supported custom fields.
  
  Trying include additional asset field for html5 animated banners.
  
  Here is dump array:
  
  ```
  ["groupId"]=>
    string(1) "1"
    ["assetId"]=>
    string(3) "144"
    ["url"]=>
    string(14) "http://localhost"
    ["startDate"]=>
    NULL
    ["endDate"]=>
    NULL
    ["maxViews"]=>
    string(1) "0"
    ["totalViews"]=>
    string(1) "2"
    ["totalClicks"]=>
    string(1) "0"
    ["filepath"]=>
    string(0) ""
    ["width"]=>
    int(0)
    ["height"]=>
    int(0)
    ["html"]=>
    string(0) ""
    ["revisionCreatorId":protected]=>
    NULL
    ["revisionNotes":protected]=>
    NULL
    ["_fieldsByHandle":"craft\base\Element":private]=>
    NULL
    ["_fieldParamNamePrefix":"craft\base\Element":private]=>
    NULL
    ["_normalizedFieldValues":"craft\base\Element":private]=>
    NULL
    ["_nextElement":"craft\base\Element":private]=>
    bool(false)
    ["_prevElement":"craft\base\Element":private]=>
    bool(false)
    ["_parent":"craft\base\Element":private]=>
    NULL
    ["_prevSibling":"craft\base\Element":private]=>
    NULL
    ["_nextSibling":"craft\base\Element":private]=>
    NULL
    ["_eagerLoadedElements":"craft\base\Element":private]=>
    NULL
    ["_currentRevision":"craft\base\Element":private]=>
    NULL
    ["_errors":"yii\base\Model":private]=>
    NULL
    ["_validators":"yii\base\Model":private]=>
    NULL
    ["_scenario":"yii\base\Model":private]=>
    string(7) "default"
    ["_events":"yii\base\Component":private]=>
    array(0) {
    }
    ["_eventWildcards":"yii\base\Component":private]=>
    array(0) {
    }
    ["_behaviors":"yii\base\Component":private]=>
    array(1) {
      ["customFields"]=>
      object(craft\behaviors\ContentBehavior)#545 (18) {
        ["bannerHtml"]=>
        NULL
        ["_customFieldValues":"craft\behaviors\ContentBehavior":private]=>
        array(0) {
        }
        ["owner"]=>
        *RECURSION*
      }
    }
    ["id"]=>
    string(3) "282"
    ["tempId"]=>
    NULL
    ["draftId"]=>
    NULL
    ["revisionId"]=>
    NULL
    ["uid"]=>
    string(36) "150f6150-28a2-4237-a2fc-bcd62751fc17"
    ["fieldLayoutId"]=>
    string(1) "7"
    ["structureId"]=>
    NULL
    ["contentId"]=>
    string(3) "382"
    ["enabled"]=>
    string(1) "1"
    ["archived"]=>
    string(1) "0"
    ["siteId"]=>
    string(1) "1"
    ["enabledForSite"]=>
    string(1) "1"
    ["title"]=>
    string(8) "Banner 1"
    ["slug"]=>
    NULL
    ["uri"]=>
    NULL
    ["dateCreated"]=>
    object(DateTime)#542 (3) {
      ["date"]=>
      string(26) "2019-10-08 16:36:46.000000"
      ["timezone_type"]=>
      int(3)
      ["timezone"]=>
      string(9) ""
    }
    ["dateUpdated"]=>
    object(DateTime)#544 (3) {
      ["date"]=>
      string(26) "2019-10-09 12:22:32.000000"
      ["timezone_type"]=>
      int(3)
      ["timezone"]=>
      string(9) ""
    }
    ["dateDeleted"]=>
    NULL
    ["root"]=>
    NULL
    ["lft"]=>
    NULL
    ["rgt"]=>
    NULL
    ["level"]=>
    NULL
    ["searchScore"]=>
    NULL
    ["trashed"]=>
    bool(false)
    ["awaitingFieldValues"]=>
    bool(false)
    ["propagating"]=>
    bool(false)
    ["propagateAll"]=>
    bool(false)
    ["newSiteIds"]=>
    array(0) {
    }
    ["resaving"]=>
    bool(false)
    ["duplicateOf"]=>
    NULL
    ["previewing"]=>
    bool(false)
    ["hardDelete"]=>
    bool(false)
  }
  
  ```
  
  bannerHtml value all time empty, trying with text field, its working fine, problem only in asset field.
  
  UPD:
  
  This solution works fine:
  
  ```
  {% for ad in craft.adWizard.ads.group('TopBannerLeft').orderBy('RAND()').all() %}
      {% set asset = craft.assets().id(ad.assetId).one() %}
      {% if asset.extension == 'html' %}
          <iframe src="{{ asset.getUrl() }}" frameborder="0" vspace="0" hspace="0" width="390" height="80" marginwidth="0" marginheight="0" scrolling="no"></iframe>
      {% else %}
          {{ ad.displayAd() }}
      {% endif %}
  {% endfor %}
  
  ```
  
  **Tags:** craft3, plugins
  
  > **Comments:**
  > **username_1**: Hi username_0, I'm the author of the Ad Wizard plugin. Can you show us the Twig code?  
  > **username_0**: Hi, updated with twig code, only this solution work for me, custom field with asset value given null any time.  
  > **username_1**: Ok great! You should post your solution below as an Answer, then mark it as the "Accepted Answer". :)  
  
  ---
  
  ## 0 answers
  
  