web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Change the query of a queueitem

(0) ShareShare
ReportReport
Posted on by 3,460

The advanced find is sometimes to limited, so i was thinking to write a Post RetrieveMultiple plugin on QueueItem, and add my conditions to the query.

But it seems i can't add a plugin to QueueItem ?

I need this because of a chart, and for the chart i need to create this view.

Any sugesstions?

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    you have to write plugin for RetrieveMultiple message and check the entity type with this plugin before adding your custom logic.

  • Aileen Gusni Profile Picture
    44,524 on at

    Zorden,

    You can create a new view programmatically

    msdn.microsoft.com/.../gg594431.aspx

    Or you can use RetrieveMultiple plugin on the queueitem

    Or if you want to modify a view, you need to use retrievemultiple with savedquery as the entity.

    Hope this helps.

    Thanks.

  • Letoir Profile Picture
    3,460 on at

    I cant register the RetrieveMultiple plugin on queueitem, strange.

    I was thinking to change the saved query, i have a line in the fetchxml and was thinking of overwriting this with my value.

    How can i get the fetchxml out of the savedquery, bare in mind that mostly there are more fetchxmls in the saved query!

  • Aileen Gusni Profile Picture
    44,524 on at

    Zorden,

    This is stored in savedquery["fetchxml"] attribute

  • Letoir Profile Picture
    3,460 on at

    The problem is how do you find the type of the entity of the view. Sometimes there are lots of views and we want to stay in queueitems.

  • Suggested answer
    Aileen Gusni Profile Picture
    44,524 on at

    Hi Zorden,

    Understood, sorry didn't notice previously.

    You can get from this code:

    var context = (IPluginExecutionContext) serviceProvider.GetService(typeof (IPluginExecutionContext));

    var query = (QueryExpression) context.InputParameters["Query"];

    if (query.EntityName != "queueitem")

       return;

    Btw, have you read these posts:

    stackoverflow.com/.../how-to-modify-filter-condition-of-a-queueitem-view-dynamically

    stackoverflow.com/.../crm-2011-intercepting-the-quick-search-fetch-xml-and-query-expression-dont-r

    blogs.msdn.com/.../using-plug-ins-to-modify-views.aspx

    Thanks.

  • Letoir Profile Picture
    3,460 on at

    What about adding a condition to the allready defined link-entity.

    How do i know which linked-entity i have to give the condition?

    if i want to insert a condition in:

    <link-entity name="team" alias="ab" to="owningteam" from="teamid"/>
     My condition/
    </link-entity>

    <fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0">
    <entity name="queueitem">
    <attribute name="objecttypecode"/>
    <attribute name="objectid"/>
    <order descending="true" attribute="queueitemid"/>
    <filter type="and">
    <condition attribute="objecttypecode" value="4212" operator="eq"/>
    </filter>
    <link-entity name="task" alias="a_4317a47620834b68a2f9e7ca23b46f1d" visible="false" to="objectid" from="activityid">
    <attribute name="subject"/>
    <filter type="and">
    <condition attribute="statecode" value="0" operator="eq"/>
    </filter>
    <link-entity name="team" alias="ab" to="owningteam" from="teamid"/>
    </link-entity>
    </entity>
    </fetch>
  • Letoir Profile Picture
    3,460 on at

    Btw @Aileen, what about the InputParameters, shouldnt it be outputParameters i am on the Post Retrieve Multiple of the SavedQuery entity. ??

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Zorden,

    I suggest you to get the advanced find first...

    The post retrieve multiple as I know that one if you register for individual entity

    But if for saved query you need the input parameter to detect the entity type

    Have you seen this?

    blogs.msdn.com/.../using-plug-ins-to-modify-views.aspx

    You really need the xml?

    Instead of just use the Query expression manipulation?

    Thanks.

  • Aileen Gusni Profile Picture
    44,524 on at

    Zorden,

    See this section:

    You can modify the QueryExpression's criteria in the PreValidation step.

    stackoverflow.com/.../how-to-modify-filter-condition-of-a-queueitem-view-dynamically

    If possible you can change the query in the pre stage

    Or you can manipulate the output of fetchxml as well..

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans