SSRS can't use "Required Attendees" in dataset? - sql

I am creating report in SSRS for CRM. I have a table with Dataset for Appointment info and I noticed that it does not allow me to report on required attendees??? Is this true? If so is there a workaround around this? I basically want my report to show appointments details and of course who participated.
Any advice is much appreciated!
Below is the fetchXML I gathered from using Advanced Find in CRM 2013.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="appointment">
<attribute name="subject"/>
<attribute name="statecode"/>
<attribute name="scheduledstart"/>
<attribute name="activityid"/>
<attribute name="instancetypecode"/>
**<attribute name="requiredattendees"/>**
<order attribute="subject" descending="false"/>
<link-entity name="account" from="accountid" to="regardingobjectid" alias="ae">
<filter type="and">
<condition attribute="accountid" operator="eq" value="#name"/>
</filter>
</link-entity>
</entity>
</fetch>

To get this information you will have to create another one datasource and retrieve information from ActivityParty entity. All items like requiredattendees, optionalattendees in appointment, from, to, cc, bcc in email, e.t.c. are stored inside ActivityParty entity.

Related

Execution of Fetch XML using Web API Dynamics 365

I am using this approach for paging using Fetch XML within Web API.
Web API works perfect when we use simple fetch and it returns pagging cookie along with results if there are more records but when we use complex(where we have link entities) Fetch XML it returns paging cookie but empty e.g.:
<b><cookie pagenumber="2" pagingcookie="" istracking="False" /></b>
Here you can see we have nothing in pagingcookie.
Fetch XML used for query:
<fetch mapping="logical" version="1.0" output-format="xml-platform" count="10" page="1" >
<entity name="invoicedetail" >
<attribute name="invoicedetailid" />
<attribute name="uomid" />
<attribute name="quantity" />
<attribute name="manualdiscountamount" />
<attribute name="priceperunit" />
<attribute name="extendedamount" />
<filter>
<condition entityname="invoice" attribute="customerid" operator="eq" value="{5A8F8B46-2443-E511-80E3-3863BB351E10}" />
</filter>
<link-entity name="invoice" from="invoiceid" to="invoiceid" >
<attribute name="invoiceid" />
<attribute name="invoicenumber" />
<attribute name="description" />
<attribute name="totalamount" />
<order attribute="ss_postingdate" descending="true" />
</link-entity>
</entity>
</fetch>
If we remove linked entity it starts giving the exact paging cookie in the response that can be get using #Microsoft.Dynamics.CRM.fetchxmlpagingcookie.
Is there any way to get the exact paging cookie in complex scenarios?
I've seen this happen before in the standard organization service. I would suggest just paging without the paging cookie - this resolved the issue for me in the organization service.
E.g. <fetch mapping="logical" page="1" count="50">

Dynamics CRM 2015 - Retrieve all Contact that are in any way connected to Opportunity

I need to present all contact that have connection to opportunity in dialog. So when some opportunity has Sales Team, Stakeholders, Owners, etc. Something like Active Connection Associate View. I need a FetchXml or other ways to find all the Contact that are in any way connected to current opened Opportunity.
Your fetchXML query will look quite like this :
<fetch mapping='logical' version='1.0'>
<entity name='myentity'>
<filter>
<condition attribute='myentityid' operator='eq' value='myvalue' />
</filter>
<link-entity name='secondentity' from='stsr_materialid' to='stsr_material_casinglookup' alias='c' link-type='outer'>
<attribute name='stsr_name' />
<attribute name='stsr_code_aisi' />
<attribute name='stsr_code_astm' />
<attribute name='stsr_code_din' />
<attribute name='stsr_code_e' />
<attribute name='stsr_code_en' />
</link-entity>
If you need more help, please provide more context.

case statement inside of fetchxml script

Please note that although this question is an entirely different question, it relates directly to this question.
The following is the script that returns the dataset for my SSRS chart:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
<entity name="account">
<attribute name="bio_employeesworldwide" alias="TotalWorldWideEmployees" aggregate="sum" />
<filter>
<condition attribute="customertypecode" operator="eq" value="2" />
</filter>
<link-entity name="contact" from="parentcustomerid" to="accountid" alias="contact">
<attribute name="bio_webuseraccountstatus" alias="count_bio_webuseraccountstatus" aggregate="countcolumn" />
<attribute name="bio_webuseraccountstatus" alias="bio_webuseraccountstatusgroupby" groupby="true" />
</link-entity>
</entity>
</fetch>
The values for bio_webuseraccountstatus can be Active, Inactive, Disabled, Pending, etc..
In FetchXML is there a way to do a case statement where you "InActive" for every value that is not equal to "Active" ?
As you can see I've been trying to solve this issue within the reporting layer, but am experiencing lots of "string format" issues.
Can this be done with the dataset layer (fetchxml) instead?
According to this Microsoft forum post:
There's no equivalent function in FetchXml. Instead, you will need to return each field value, and process the CASE logic in the calling code. If this FetchXml is to be used in a report, then you may be able to implement the CASE logic in a calculated field on the report.
You can always parse the output of the fetchxml on return.
So rather than pushing to the screen, report, or db, the original record field of isreceivetravelalerts, you check the status (zero or one) and rewrite it, and add the new variable to your output. Clunky, but useful.
if ($record->isreceivetravelalerts == 1)
{
$travel_alerts = "Active";
}
$travel_alerts = "Inactive";

FetchXML nvarchar returns nothing - Custom Report for CRM

I am trying to get data from Dynamics CRM 2013 for a custom report using FetchXML.
I "converted" the following SQL Query to FetchXML using this page: http://www.sql2fetchxml.com/
SQL:
SELECT
accountidname,
billto_line1,
billto_postalcode,
billto_city,
invoicenumber,
name,
description
FROM FilteredInvoice
WHERE invoiceid = #invoiceid
FetchXML:
<fetch mapping="logical">
<entity name="invoice">
<attribute name="accountidname" />
<attribute name="billto_line1" />
<attribute name="billto_postalcode" />
<attribute name="billto_city" />
<attribute name="invoicenumber" />
<attribute name="name" />
<attribute name="description" />
<filter>
<condition attribute="invoiceid" operator="eq" value="#invoiceid" />
</filter>
</entity>
</fetch>
Both, "accountidname" and (e.g.) "billto_line1" are NVARCHAR(4000) and both contain data, but if I try to execute the query (e.g. in the "Query Designer" in Visual Studio) only the data of "billto_line1" is shown, not the data of "accountidname".
Since both fields "accountidname" and "billto_line1" are of the same type (nvarchar(4000)) and contain information in the database (I checked it with the "Microsoft SQL Server Management Studio") I am wondering why I can only receive the information from one of those two.
This has happend with many different fields of the type NVARCHAR - some are displayed correctly, while some are not - and I have no idea why.
I would be very pleased if somebody could give me a hint :)
Thank you
accountidname is on the Views, not the actual tables, in SQL. It is not a field on the invoice entity and therefore will not return any information in a FetchXml request.
You should be able to retrieve the Account's name by using accountid - I don't remember in SSRS how the Name property of an EntityReference is surfaced but it should be available.
The FetchXml converter is good at converting SQL SELECT's to FetchXml format and converting joins. It will not validate that the SQL fields are available in FetchXml - that could only be done by accessing the metadata of the CRM Org.

how to get a cross Joins in Fetch XML queries in CRM2011?

1.-First Time I do Queries as it then I dont know how to get a cross join
2.-I understand this example is a inner join isn't it? I take it for this line "from="accountid" to="customerid"" this sees as a Inner Join
then how would it be a cross join?
3.- I copied this example on http://mscrmshop.blogspot.mx/2012/09/outer-joins-in-fetch-xml-queries-in.html
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="opportunity">
<attribute name="name" />
<attribute name="customerid" />
<attribute name="estimatedvalue_base" />
<order attribute="name" descending="false" />
<link-entity name="account" from="accountid" to="customerid" visible="false" link-type="outer" alias="accountid">
<attribute name="telephone1" />
</link-entity>
</entity>
</fetch>
Fetch XML does not support a cross Join.
There is another alternative solution suggested in the below link. Please see whether that can be useful for your case.
http://social.microsoft.com/Forums/en-US/e3ee734c-81d3-4277-b54f-c2e46bb20e0d/crm-2011-sql-cross-join-equivalent-fetchxml-in-report?forum=crmdevelopment