# RequestModelAccessor gives incorrect channel in OrderHistoryViewModelBuilder

**URL:** <https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633>\
**Category:** Questions\
**Created:** [July 7, 2022, 9:52am UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633 "2022-07-07T09:52:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![felixfroberg](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@felixfroberg](https://forum.litium.com/u/felixfroberg)\
**Post date:** [July 7, 2022, 9:52am UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633/1 "2022-07-07T09:52:15Z")

</div>

Hi,

We have an issue in a customer solution, where we have two channels, channel1 and channel2. We use a constructor injected instance of RequestModelAccessor to get the channel (`_requestModelAccessor.RequestModel.ChannelModel.Channel`) which works great elsewhere. In OrderHistoryViewModelBuilder however we always get channel1 from the requestmodel, even when we are visiting from channel2. Is this a bug or are we missing something obvious here?

Regards,  
Felix

Litium version: _7.6.1_

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [July 7, 2022, 10:13am UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633/2 "2022-07-07T10:13:42Z")

</div>

Can you check the URL on `OrderHistoryPanelViewModel.OrderHistoryLink` if it’s for the correct channel? Maybe the pointer field value is set to a specific channel.

---

<div class="post-metadata">

**Author:** ![felixfroberg](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@felixfroberg](https://forum.litium.com/u/felixfroberg)\
**Post date:** [July 7, 2022, 11:42am UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633/3 "2022-07-07T11:42:31Z")

</div>

The URL in OrderHistoryLink points to channel1, so that seems to be the issue. Any idea why that might be happening?

Also, it seems to work fine when visiting the site from the CMS in BO, or when using “Preview as published in a new tab”.

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [July 7, 2022, 12:28pm UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633/4 "2022-07-07T12:28:46Z")

</div>

If you can check the database you can see if there’s a GUID for channel1 stored with the pointer value. You can read a little about it in this other thread: [Search against Lucene index with pointeritem not working - #6 by NilsN](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/6)

Removing and re-adding the pointer should clear it up.

---

<div class="post-metadata">

**Author:** ![felixfroberg](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@felixfroberg](https://forum.litium.com/u/felixfroberg)\
**Post date:** [July 7, 2022, 1:08pm UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633/5 "2022-07-07T13:08:22Z")

</div>

Ah, now I see. Removed the pointer and added it again and it started working. Thanks!

Now it seems like it disregarded the channel selection for the field when previewing, is that a bug?

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [July 7, 2022, 2:13pm UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633/6 "2022-07-07T14:13:26Z")

</div>

Not sure. If it’s reproducible you could report it as a bug so the team can investigate. Might be that when in administration mode the channel selected for the preview overrules the other.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [August 4, 2022, 2:13pm UTC](https://forum.litium.com/t/requestmodelaccessor-gives-incorrect-channel-in-orderhistoryviewmodelbuilder/2633/7 "2022-08-04T14:13:32Z")

</div>

Closed on August 4, 2022, 2:13pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
