Dynamics CRM 2013 : Report for team's users - dynamics-crm

I need to retrieve (in report or view) all users that are in a specific team, or get all teams with their users.
CRM 2013 on premise.

You can navigate to Settings - Administration - Teams and then change the view selector to "All Teams". Then once there, you can open the teams and will be able to see the users who are a member of the team in the "Team Members" list. If you want to use a report, since you are using OnPremise, you could use either a SQL query to get User and Team information, or alternatively could create a FetchXML based report that could also be used in CRM Online (if you later decide to move to CRM Online, then the FetchXML will be the only way to get the custom report to work). I just picked some of the basic columns, but you could add as needed additional columns from these views.
SELECT tm.SystemUserId, tm.TeamId, tm.TeamMembershipId, su.DomainName,T.Name
FROM dbo.FilteredTeamMembership tm
INNER JOIN FilteredSystemUser Su on tm.SystemUserID = Su.SystemUserId
INNER JOIN FilteredTeam T on Tm.TeamId = T.TeamId
ORDER BY T.Name
or FetchXML below:
<fetch mapping="logical">
<entity name="TeamMembership">
<attribute name="SystemUserId" />
<attribute name="TeamId" />
<attribute name="TeamMembershipId" />
<link-entity name="SystemUser" to="SystemUserID" from="SystemUserId" alias="Su" link-type="inner">
<link-entity name="Team" to="TeamId" from="TeamId" alias="T" link-type="inner">
<attribute name="Name" />
<order attribute="T" />
</link-entity>
</link-entity>
</entity>
</fetch>

Related

Virtual Entity: Access the filter condition within the retrieve multiple plugin

I have a new virtual entity, which I am populating data from an external source with an api call. I have a subgrid within the case form, and I have a N:N relationship created with incident and this entity. The subgrid is for the related records. Therefore, when I load the subgrid, I see the fetchXML in network trace contains a filter condition wtih linked entity to incident, and has the incident number. However, the "Query" that I see from the plugin that this virtual entity data source-triggered retrievemultiple would trigger, doesn't contain the filter condition. The Linked Entity object is empty.
fetchXml: <fetch version="1.0" mapping="logical" returntotalrecordcount="true" page="1" count="4" no-lock="false"><entity name="virtualentity"><attribute name="myorg_name"/><attribute name="myorg_title"/><attribute name="myorg_status"/><attribute name="myorg_severity"/><attribute name="myorg_owningid"/><attribute name="myorg_owningcontact"/><attribute name="myorg_modifieddate"/><attribute name="myorg_id"/><attribute name="myorg_createdate"/><attribute name="virtualentityid"/><link-entity name="myorg_virtualentity_incident" intersect="true" visible="false" to="virtualentityid" from="virtualentityid">
<link-entity name="incident" from="incidentid" to="incidentid" alias="bb">
<filter type="and">
<condition attribute="incidentid" operator="eq" uitype="incident" value="de5759c2-928a-ec11-8f97-0022487af2d6"/>
</filter>
</link-entity>
</link-entity></entity></fetch>
But what I get within the plugin is this:
{"Distinct":false,"PageInfo":{"PageNumber":0,"Count":0,"ReturnTotalRecordCount":false,"PagingCookie":null},"LinkEntities":[],"Criteria":{"FilterOperator":0,"Conditions":[],"Filters":[]},"Orders":[],"EntityName":null,"ColumnSet":{"AllColumns":false,"Columns":[],"AttributeExpressions":[]},"NoLock":false}`
What am I missing here? Any insights will be appreciated. Thanks!

Dynamics Email and Email attachments

we have requirement that when email is received in to crm with attachments ,we need to pass to API the Attachment details for that email so can be stored.
does someone have the data model of how the email attachments entities are linked.
As i know there is activitymimeattachment and also attachment.
Or if anyone has past experience of passing through the values to API?
Thanks
If I understand your requirement correctly or I assume your requirement is to download the attachments for all the incoming Emails to CRM.
Based on assumption of Requirement,
You can create an Plugin on Incoming Emails to CRM i.e on Email Entity
Inside plugin Check for Email if you have an linked Entity (activitymimeattachment) join as Inner
Now again link it with attachment entity join as Inner
In attachment Entity you have body filed which will give you Base64 of every attachment may it be Image, Docx, Pdf and so on.
Now you can convert this base64 into Image or PDF depending on filename and it's extension.
Here is the sample Fetchxml for you
<fetch>
<entity name="email" >
<attribute name="attachmentcount" />
<attribute name="subject" />
<attribute name="mimetype" />
<link-entity name="activitymimeattachment" from="objectid" to="activityid" link-type="inner" >
<attribute name="filename" />
<attribute name="filesize" />
<attribute name="attachmentid" />
<link-entity name="attachment" from="attachmentid" to="attachmentid" link-type="inner" >
<attribute name="body" />
</link-entity>
</link-entity>
</entity>
</fetch>

CRM 2016 Blank Address record created in Contact entity

I am facing a weird issue wherein whenever I create a contact, an empty record is created in Other Addresses entity.
Below is the screenshot -
I read on several blogs that by default 2 blank records are created every time an account or contact is created, However this does not happen in case of accounts. No blank record is seen under 'Customer Address Associated view' for Accounts.
What you read on the blogs is mostly correct:
Two address records are automatically created for accounts.
Three address records are automatically created for contacts.
By default, the address records that are created behind the scenes are not shown in the Customer Address Associated View.
The default filter for the view can be seen below. If the filter for your view has been modified, it would explain why you see one of the three automatically created address records for contact.
<filter type="or">
<filter type="and">
<condition attribute="addressnumber" operator="gt" value="2" />
<condition attribute="objecttypecode" operator="eq" value="1" />
</filter>
<filter type="and">
<condition attribute="addressnumber" operator="gt" value="3" />
<condition attribute="objecttypecode" operator="eq" value="2" />
</filter>
</filter>
Have a look at the following link for a more in-depth discussion of addresses in CRM: The CRM Address Entity: There’s more to it than you think!.
In general, I find that it often pays off to make a custom address entity if your requirements deviate from what is possible with the out-of-the-box address entity.

How to know the created date/ last modified date of Field Security Profiles in CRM?

Currently I am investigating for few issues in my CRM implementation, and I believe some of the changes were not done by me, especially in Field Security Profiles and Teams.
Do we have any provision in CRM which can show who has done what changes and when! this would ideally help me finding out right person to contact as we work in a shared development environment.
Any help on this would be much appreciated.
Thanks
On both of these entities you have fields like 'createdby', 'modifiedby', 'createdon' and 'modifiedon'. Remember that fileds 'modified...' contains information about last changes made. You can list all these fields in 'advanced search'.
Run this query in FetxhXML Builder
<fetch count="50" >
<entity name="fieldsecurityprofile" >
<attribute name="name" />
<attribute name="modifiedby" />
<attribute name="createdby" />
<attribute name="modifiedon" />
<attribute name="createdon" />
</entity>
</fetch>
After executing the query, choose Friendly Names in the Display Options menu to see the names of the users who last made changes.

Creating a tricky fetch XML in CRM Dynamics

I'd like to make an advanced search that combines fields from two different entities that are in many-to-many relation to each other. In SQL it's very straight-forward but in Dynamics I get stuck.
I'd like to get a general answer but if it helps, here are the specifics. The task is to create a list of all the contacts in the DB (column "name" and "e-mail") but combined with a third column that is the name of the marketing list that the contact in question belongs to. Of course, the same person might be listed multiple times but the uniqueness is not a requirement (besides, each row will have an equivalent to PK by the combination of the names of the contact and the marketing list).
Is that doable? If so, how?
Firstly, here's your query:
<fetch mapping='logical'>
<entity name='listmember'>
<link-entity name='list' from='listid' to='listid'>
<attribute name='listname'/>
</link-entity>
<link-entity name='contact' from='contactid' to='entityid'>
<attribute name='fullname'/>
<attribute name='emailaddress1'/>
</link-entity>
</entity>
</fetch>
Example results:
<resultset morerecords='0' paging-cookie='<cookie page="1"><listmemberid last="{E1B03485-0000-0000-0000-00155D107003}" first="{A74C877A-0000-0000-0000-00155D107003}" /></cookie>'>
<result>
<listmemberid>{A74C877A-0000-0000-0000-00155D107003}</listmemberid>
<listid.listname>List 1</listid.listname>
<entityid.fullname>Amy Pickle</entityid.fullname>
<entityid.emailaddress1>apickle#domain.com</entityid.emailaddress1>
</result>
<result>
<listmemberid>{A94C877A-0000-0000-0000-00155D107003}</listmemberid>
<listid.listname>List 2</listid.listname>
<entityid.fullname>Andrew Colley</entityid.fullname>
<entityid.emailaddress1>colley#domain.com</entityid.emailaddress1>
</result>
</resultset>
Not sure how well I can describe this in general terms but:
You're looking for members of lists so listmember must be the root entity you return
For each relationship to that entity that contains attributes you want to display, you need to define a link-entity (in this case, one to list to get the list name and another to contact to get contact's details
you want to only display certain attributes, so they each need to be defined within your link-entity
you didn't specify any filtering so all memberships of all lists that are contacts will be returned
I never do these by hand. Previously I used James Downey's FetchXML Builder but I believe this is no longer available - Stunnware do a similar tool.

Resources