Answers.Body: <p>Have you tried EVENT_AFTER_PARSE_FIELD <a href="https://github.com/craftcms/feed-me/issues/516" rel="nofollow noreferrer">https://github.com/craftcms/feed-me/issues/516</a> </p>
  
  <pre><code>use yii\base\Event;
  use craft\feedme\services\Fields;
  use craft\feedme\events\FieldEvent;
  
  Event::on(Fields::class, Fields::EVENT_AFTER_PARSE_FIELD, function(FieldEvent $event) {
      if ($event-&gt;fieldHandle === 'myAssetsField' &amp;&amp; $event-&gt;fieldValue !== null) {
          // $event-&gt;fieldValue will be an array of assets (already saved).
          // Modify the assets or the field value as needed...
      }
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-13T09:04:59.843Z
Answers.Text: Ah, this would do the trick! It's exactly what I'm missing from the events I've tried, that it actually uses the values changed when returning back to the FeedMe code. Incidently, I just updated from the 4.1.1 to the 4.1.2 version that came two days ago, and the change finally seems to be commited, so I don't need to update to a dev branch. Will do a test and report back!
Answers.UserDisplayName: KSP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-13T09:27:47.623Z
Answers.Text: Bingo, it worked like a charm. Thank you! Ideally, I think it would make sense to modify imported values even earlier, as I now have to go back to the raw `$event->feedData` and fetch it again, before doing my modifications, and saving it back to `$event->parsedValue`. As long as I know the values needs to be modified anyways, it would be nice to do it before FeedMe tries to parse it itself, thus leaving me with an empty `$event->parsedValue` (presumably because the value failed to validate on the model).
Answers.UserDisplayName: KSP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-13T09:31:43.650Z
Answers.Text: Great, glad it worked – haven't used it myself but had that bookmarked to use on a project soon.
Answers.UserDisplayName: dmatthams
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-14T08:37:28.710Z
Answers.Text: Then rest assured it works! :) Thanks for your help!
Answers.UserDisplayName: KSP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-12T20:15:52.590Z
Answers.LastActivityDate: 2019-08-12T20:22:11.203Z
Answers.LastEditDate: 2019-08-12T20:22:11.203Z
Answers.UserDisplayName: dmatthams
Body: <p>I have a feed where one element is to be mapped to a <code>multiselect</code> field on an entry. However, I would need to tweak the values I'm importing (basically making them lowercase), to match the values of my multiselect field in Craft (I would rather map to value than label, although even if I mapped to labels, I would need to do some changes to the imported values).</p>
  
  <p>I've tried more or less every event that FeedMe offers me (and some I've found in the code that are not in the docs), but I cannot find any that seems to do the trick.</p>
  
  <p>I tried to use <code>EVENT_BEFORE_PARSE_FIELD</code>, which seemed to be a logical point (though the event is not mentioned in the docs), but as it doesn't actually set the  values changed in the event back to the values passed in (as it does with other events), the changes are simply lost. So no luck.</p>
  
  <p>On my last try, I tried using <code>EVENT_STEP_BEFORE_ELEMENT_SAVE</code>, and changing the <code>$contentData</code>. But, as far as I can see, this variable is not passed in to the actual save function, it's just passed to an <code>aftersave</code> function, that for entries seems to do absolutely nothing.</p>
  
  <p>So, short of having to loop through the entire feed, searching for the attribute in question in every node, and changing each of them, I can't see how to achieve this. It would make sense to be able to tweak the values passed in at some point where the code is handling one node, but I can't seem to find it.</p>
  
  <p>If anyone have any ideas, I would really appreciate it.</p>
  
Tags: <craft3><plugin-feedme>
Title: FeedMe for Craft 3: Tweaking attribute values from feed before FeedMe process it
ThreadText: # FeedMe for Craft 3: Tweaking attribute values from feed before FeedMe process it
  
  (Asked by: username_0 on 2019-08-12)
  
  I have a feed where one element is to be mapped to a `multiselect` field on an entry. However, I would need to tweak the values I'm importing (basically making them lowercase), to match the values of my multiselect field in Craft (I would rather map to value than label, although even if I mapped to labels, I would need to do some changes to the imported values).
  
  I've tried more or less every event that FeedMe offers me (and some I've found in the code that are not in the docs), but I cannot find any that seems to do the trick.
  
  I tried to use `EVENT_BEFORE_PARSE_FIELD`, which seemed to be a logical point (though the event is not mentioned in the docs), but as it doesn't actually set the values changed in the event back to the values passed in (as it does with other events), the changes are simply lost. So no luck.
  
  On my last try, I tried using `EVENT_STEP_BEFORE_ELEMENT_SAVE`, and changing the `$contentData`. But, as far as I can see, this variable is not passed in to the actual save function, it's just passed to an `aftersave` function, that for entries seems to do absolutely nothing.
  
  So, short of having to loop through the entire feed, searching for the attribute in question in every node, and changing each of them, I can't see how to achieve this. It would make sense to be able to tweak the values passed in at some point where the code is handling one node, but I can't seem to find it.
  
  If anyone have any ideas, I would really appreciate it.
  
  **Tags:** craft3, plugin-feedme
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-08-12. Score: 1 | Accepted answer
  
  Have you tried EVENT\_AFTER\_PARSE\_FIELD <https://github.com/craftcms/feed-me/issues/516>
  
  ```
  use yii\base\Event;
  use craft\feedme\services\Fields;
  use craft\feedme\events\FieldEvent;
  
  Event::on(Fields::class, Fields::EVENT_AFTER_PARSE_FIELD, function(FieldEvent $event) {
      if ($event->fieldHandle === 'myAssetsField' && $event->fieldValue !== null) {
          // $event->fieldValue will be an array of assets (already saved).
          // Modify the assets or the field value as needed...
      }
  });
  
  ```
  
  > **Comments:**
  > **username_0**: Ah, this would do the trick! It's exactly what I'm missing from the events I've tried, that it actually uses the values changed when returning back to the FeedMe code. Incidently, I just updated from the 4.1.1 to the 4.1.2 version that came two days ago, and the change finally seems to be commited, so I don't need to update to a dev branch. Will do a test and report back!  
  > **username_0**: Bingo, it worked like a charm. Thank you! Ideally, I think it would make sense to modify imported values even earlier, as I now have to go back to the raw `$event->feedData` and fetch it again, before doing my modifications, and saving it back to `$event->parsedValue`. As long as I know the values needs to be modified anyways, it would be nice to do it before FeedMe tries to parse it itself, thus leaving me with an empty `$event->parsedValue` (presumably because the value failed to validate on the model).  
  > **username_1**: Great, glad it worked – haven't used it myself but had that bookmarked to use on a project soon.  
  > **username_0**: Then rest assured it works! :) Thanks for your help!  
  
  ---
  
  