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?