<p>I have the following code: </p>

<pre><code>$fieldHandle = 'contentLead';

$entryTitle = $event-&gt;element;
$entryQuery = \craft\elements\Entry::find();

$entries = $entryQuery-&gt;title($entryTitle)-&gt;limit(1);

foreach ($entries-&gt;all() as $entry) {
    $entry-&gt;setFieldValue($fieldHandle, 'hello');

    Craft::$app-&gt;elements-&gt;saveElement($entry, false, true);
}
</code></pre>

CC BY-SA 4.0
2019-05-14T03:47:43.170Z
After saving the element, does `$entry->getErrors()` return anything?
Brad Bell
CC BY-SA 4.0
2019-09-07T22:10:50.587Z
Sorry for disappearing, I worked around this issue (forked the Guest Entries plugin). Using the code above in a different case worked perfectly, thanks!
Ottó Radics
<plugin-development><craft3><plugin-feedme>
Custom field value doesn't get saved
# Custom field value doesn't get saved

(Asked by: username_0 on 2019-05-12)

I have the following code: 
$fieldHandle = 'contentLead';

$entryTitle = $event->element;
$entryQuery = \craft\elements\Entry::find();

$entries = $entryQuery->title($entryTitle)->limit(1);

foreach ($entries->all() as $entry) {
    $entry->setFieldValue($fieldHandle, 'hello');

    Craft::$app->elements->saveElement($entry, false, true);
}

**Tags:** plugin-development, craft3, plugin-feedme
> **Comments:**
> **username_1**: After saving the element, does `$entry->getErrors()` return anything?  
> **username_0**: Sorry for disappearing, I worked around this issue (forked the Guest Entries plugin). Using the code above in a different case worked perfectly, thanks!  

---

## 0 answers

