简体   繁体   中英

Retrieving a list of Sortable Emails from CRM 2011 via JavaScript

I am trying unsuccessfully to retrieve a list that is sorted based on criteria that i want to set (to, from, subject etc.) but can't seem to find a way to do it. the standard grids do not allow you to sort emails by to and from, which is why we are going down this path.

Fetch XML Approach

Using the FetchXML route i can get data, but the sorts on sender , torecipients (amongst others) are just ignored, data is returned but in the standard order, not the one i specified. This did kind of work at one stage where a hack was in place, so using a FetchXML (the sort was still ignored) but setting a value to the bound grid did what was needed:

subgrid.all.divGridProps.children["sortColumns"].value = "sender:Desc"; 

As of IE9 this no longer works, so alternative and more robust solutions are being looked at.

REST Approach

I tried to build the request query, so i started with EmailSet , but including To and From blows up the query. Ok, maybe i should link to ActivityParties but had no idea how i could do that, as using the Query Designer nothing really seems to stick (some good resources on this would be much appreciated) and after all this i am still not sure if this sort of data can be sorted?

Does anyone have any idea how this can be achieved, i am not getting anywhere and their seems to be no resources available.

If i understood correctly, you want to retrieve a sorted list of EmailSet rows. You can achieve that by following REST query:

https://crmserver.net/company/XRMServices/2011/OrganizationData.svc/EmailSet?$select=Sender,ToRecipients&$orderby=Sender%20desc // You can change desc/asc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM