2

I managed to import the data with Parent-Child relations (below you can see that I have several pipelines for different types of items - red for parent; green for subfolder; blue for children). However, I need to have children of different templates under the parent (Folder Assets on the image below).

enter image description here

I thought that I can try to extend the second Pipeline like below:

1.Select Languages

2.Resolve Product Model

3.Apply Mapping

4.Update Sitecore Item

5.Get Product Folders

6.Iterate Product Folders

7.Get Asset Folders (use another property of a parent object)

8.Iterate Asset Folders (pointer to a new pipeline which will handle Assets)

However, this solution doesn't work (it seems that If we changed the context to a child pipeline in step 6 then we can't go back to step 7). Do you have any suggestions how to setup the pipeline batch to reach the goal?

Thank you in advance for the help.

5
  • Is you import an one-time operation or are you planning on running this regularly / periodically? Jul 30, 2018 at 13:56
  • It will be loaded regularly.
    – Max
    Jul 30, 2018 at 14:06
  • Ok, is there a reason you’ve down this all via pipelines? It all seems a bit complex even for a regular import. Have you looked at other options? Jul 30, 2018 at 14:44
  • It was suggested to use DEF. Which options do you mean? Sitecore Commerce Connect?
    – Max
    Jul 30, 2018 at 15:05
  • Ahr ok so the items above are items imported into a Sitecore Commerce Catalog. That makes sense. Jul 30, 2018 at 15:16

2 Answers 2

2
+50

Solution 1

Override SetObjectOnPipelineContext method ofCopyObjectFromContextToNewLocationStepProcessor with

 public class MyCopyObjectToNewLocation : DataExchange.Processors.PipelineSteps.CopyObjectFromContextToNewLocationStepProcessor
{

    public override bool SetObjectOnPipelineContext(object obj, Guid location, PipelineContext pipelineContext, ILogger logger)
    {

        if (location == ItemIDs.PipelineContextIterableData)
        {
            var plugin = this.GetPipelineContextPlugin<IterableDataSettings>(pipelineContext, false);
            if (plugin != null)
            {
                pipelineContext.RemovePlugin(typeof(IterableDataSettings));
            }

            plugin = new IterableDataSettings(obj as IEnumerable);
            this.AddPluginToPipelineContext(plugin, pipelineContext, false);
            return true;
        }

        return base.SetObjectOnPipelineContext(obj, location, pipelineContext, logger);
    }
}

Find __Standard Values of Copy Object from Context to New Location Pipeline Step template and update Process Type with your fix.

Verify that pipeline steps created on this template were updated.

Solution 2

Solution 1 is hint where problem is. There is an issue with itarable data location. Certainly for this location it checks if it's already set then skip it. It means the next using of this location in the current pipeline will never assign new object to Pipeline Context Iterable Data location.

As workaround you can use Pipeline Context Temp Storage instead of Pipeline Context Iterable Data

1
  • Thanks! I have decided to use the second approach. it works as expected.
    – Max
    Aug 2, 2018 at 9:15
0

I have similar requirement, i wanted to create child category items under the product. I used above 'Vlad' inputs and added pipeline step 'Get Catalog item'.

As mentioned in the below image for resolve category child item, I set 'Parent for item location' as 'Pipeline Context Parent Target', it helps me to create child categories under product.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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