0

I have some external data to be populated before my External data provider is executed. Let say I have 2 functions call external data:

  • GetAllItems()
  • GetItem(string itemId)

Those functions will populate items to Dictionary XML then eventually will assign to each item's XML.

So I'd placed GetItem in External Data Provider GetItemDefinition(ID itemID, CallContext context). Also, there's a condition if the current ID is already in Dictionary, then don't call GetItem but assign Dictionary XML to the respective item instead. Thus I need a custom pipeline that will be called RIGHT before GetItemDefinition is called. So my Dict is already full with the item and don't have to Call GetItem for each item.

I've also tried to put condition: if the dictionary is empty, then GetAllItems(). But that would cause some dictionary values is null since Data Provider is asynchronous.

Back to the question, Where I can put my custom pipeline to be executed right before Data Provider? or maybe there's another workaround?

  • I'm voting to close this question as off-topic because crossposting. – Mark Cassidy Dec 14 '18 at 10:30
  • @MarkCassidy Ow. Ok. Alright – Dika Purnasucita Dec 14 '18 at 10:36
  • SEO value is the bread and butter of this community site. By crossposting you work against the very purpose and what we're trying to build here. I'm not allowed to solicit, but for Sitecore questions - I strongly believe THIS site should be your preferred one. – Mark Cassidy Dec 16 '18 at 14:13
  • 1
    Thanks for your information @MarkCassidy I've deleted my stackoverflow post. Please help to reopen this thread. Thanks – Dika Purnasucita Dec 17 '18 at 1:43
  • I'm not prepared to outline a full example of this recommendation, but I don't believe a pipeline is what you're looking for. You're wanting to change the logic for the Data Provider. so, you might be better off creating your own Data Provider, that calls back to the original one based on your criteria. – Pete Navarra Dec 18 '18 at 4:24
0

After I tried several workarounds. I found the solution by add condition -> comparing current Id to Content id ({0DE95AE4-41AB-4D01-9EB0-67441B7C2450}).

GetItemDefinitions(ID itemid, CallContext context){
If (itemid.guid.tostring() == ContentRootId)
{
GetAllItems();
}

that will run once, and first time before all content subitems.

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.