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)

Odata - filter QueueItem based on a field on it's linked object

(0) ShareShare
ReportReport
Posted on by 2,601

I've created an object which is used to trace calls to customers.  I've created a CRM queue to use with this, and am trying to create an oData call which will filter the QueueItems to only bring back items which have a DueDate in the linked object.

This brings back all the QueueItems:
http://localhost:5555/BAYV/XRMServices/2011/OrganizationData.svc/QueueItemSet?

I've tried adding the $expand command but can't get it work.  Has anyone achieved this?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Hosk Profile Picture
    on at

    I would recommend using the OData Query Designer, which you can find in the XRM tools.

    It has a GUI tool to allow you to create oData querys and test the results it brings back.

    dynamicsxrmtools.codeplex.com

  • Verified answer
    jlattimer Profile Picture
    24,562 on at

    Problem is that you can only filter on one entity. So you can't create a filter that filters both on the QueueItem's QueueId and the specific Activity's Due Date.

    So you would need to create a query for filtering on the specific Queue Id and iterate through the results looking for Due Dates with values. 

    Something like this:

    var req = new XMLHttpRequest();
    req.open('GET', encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/QueueItemSet?$select=Task_QueueItem/ScheduledEnd&$expand=Task_QueueItem&$filter=QueueId/Id eq guid'EE391E97-6592-E311-8787-6C3BE5A8362C'"), true);
    req.setRequestHeader('Accept', 'application/json');
    req.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 200) {
                var returned = JSON.parse(req.responseText).d;
                var results = returned.results;
                for (var i = 0; i < results.length; i++) {
                    var Task_QueueItem_ScheduledEnd = results[i].Task_QueueItem.ScheduledEnd;
                    alert(Task_QueueItem_ScheduledEnd);
                }
            }
            else {
                alert(this.statusText);
            }
        }
    };
    req.send();
    

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