1

Can someone confirm that when importing entries with Feed-Me, the entrytype can NOT be set dynamically based on a field of the feed?

1

i don't think it is possible via GUI but you can do this via feed me events and a simple plugin.

because entrytype's fieldlayout and field mappings are different, in my solution, you should edit feed and update fieldmapping for each entry type, change the if condition of the code and run the feed again.

    Event::on(Process::class, Process::EVENT_STEP_BEFORE_ELEMENT_SAVE, function (FeedProcessEvent $event) {
        $entryTypeId=$event->feedData['entrytype'];
        if ($entryTypeId==1){
            $event->element->typeId=1;
        }
        //maybe, if field mapping for entrytype1 and entrytype2 are same
        elseif ($entryTypeId==2){
            $event->element->typeId=2;
        } 
        else {
            //skip saving element for other entry types because they have different field mapping.
            $event->isValid=false;
        }
    });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.