0

I'm creating a price book programatically calling the IAddPriceBookPipeline. I see as a result of that call that the book is created. Next of I'm trying to associate the same Book with a Catalog. I do that using the IAssociateCatalogToBookPipeline, passing on the CatalogAndBookArguments the book name and catalog name.

var arg = new CatalogAndBookArgument(bookName, catalogName);
await _associateCatalogToBookPipeline.Run(arg, context);

When I run this piece of code I noticed the relationship was never set in Experience Commerce so I looked into the database in the table CatalogLists and noticed that the relationship was not being created and inspecting the logs I found an error which seems to be coming from the CreateRelationshipBlock:

"Entity not found for Source:Entity-PriceBook-GBPriceBook, Target:Entity-Catalog-GBCatalog, Relationship type:PriceBookToCatalog"

And this is aborting the pipeline execution when this error is hit. Is there a format on how this relationship should be set and also what could be the cause for this issue?

I know one could go and add the Price Book to a list with the Catalog being the Entity but this should be taken care by the IAssociateCatalogToBookPipeline no?

1

It seems PriceBookToCatalog relationship definition is missing. This is often an indication that the environment was not initialized properly. Try to reinitialize the environment and make sure the relationship definitions are

1
  • That was the issue. There was a custom block causing an exception in the Environment initialization and this was having the side effect of the PriceBookToCatalog not the be present in the CatalogEntities table in the database. – Diego Jan 14 at 21:12

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.