Thursday, December 26, 2013

Printing Entity Images on Reports in Dynamics CRM 2013


In our earlier post Now Store Images in CRM 2013 we discussed at length about the new Image attribute added to CRM 2013. It included steps to programmatically read/write to this field. The next step being the ability to include the image attribute in the reports.

This seemingly appears a simple task to include images just as the images were picked up earlier from the notes entity and displayed on the report. But when we tried to do the same with the image attribute, we found that the image attribute is actually not stored the same way as the attachments.

We could use the following code to read the image data using the CRM SDK

string binaryImageQuery =
                "<fetch mapping='logical'>
                <entity name='lead'>
                <attribute name='fullname' />
                <attribute name='entityimage' />
                </entity>
                </fetch>"

EntityCollection binaryImageResults = _serviceProxy.RetrieveMultiple(new FetchExpression(binaryImageQuery));

This would return the image data in binary format that we could then read in a byte array.

But when you execute the same fetch query using BIDS for report designing, you receive the following results

 
This appears all good but when you set the control source of the image control on the form to the entityimage attribute, it returns an error about the data in the field not being in correct format.

Upon further review of the results we found that the System.Byte[] did not mean the binary data but only the string “System.Byte[]”.

The Fetch query when executed using the RetrieveMultipe API as shown above returns binary data. But when the same query is executed using the ExecuteFetch API call, the results are returned in xml format and therefore the image attribute returns only a string “System.Byte[]” not the actual image binary data in Base64 string.

ExecuteFetchRequest fetch = new ExecuteFetchRequest();

fetch.FetchXml = binaryImageQuery;

_service.Execute(fetch);

As a result of this, reports designed using FetchXML (reports in CRM Online) would not be able to include images on the report.

On-Premise installs can still add the images in the report using SQL queries.

select con.FullName, con.Parentcustomeridname,con.entityimage  from FilteredContact con

Bind the image control in the report to entityimage attribute

The result would be

Hope this helps anyone trying to include images on reports.

Thursday, December 12, 2013

Pass Custom Parameters to an entity form through a URL in CRM 2013


This blog posted back in 2012, described how to pass custom parameters to an entity in CRM 2011. The other day tried to use the same code to make it in CRM 2013 but unfortunately that would not work. You will be able to pass a single parameter through the URL using the same code as before, but to pass more than one parameters, you need to use the new openEntityForm client API.

In 2011, the parameters would be concatenated to make a string and pass that as the extraqs query string

var extraqs = "Parameter_Source=Hello";
extraqs += "parameter_Source2=8";


//Set features for how the window will appear.
var features = "location=no,menubar=no,status=no,toolbar=no";
// Open the window.
window.open(Xrm.Page.context.getServerUrl() +"/main.aspx?etn=account&pagetype=entityrecord&extraqs=" + encodeURIComponent(extraqs), "_blank", features, false);


Using the new client API to open the record, this would now be presented as follows

var parameters = {};

parameters["myparam_test"] = "1";

parameters["parameter_test"] = "100";

//use the openEntityForm to open the record

Xrm.Utility.openEntityForm("account", null, parameters);

Tuesday, December 10, 2013

Mobile Client for Dynamics CRM 2013


Mobile app for Dynamics CRM is out for Android, iOS and Windows Phone platform. When you navigate to CRM in your web browser on a blackberry device you are redirected to the mobile version as well. So true to BYOD, Dynamics CRM is now available through Web clients, Outlook Clients, Tablet Clients and Mobile clients as well J

You can download the mobile apps on different platforms through their respective app stores.

When you start the app, you will be required to enter the credentials to sign in.

 
 
Note: Unlike the tablet client the mobile client allows you to sign out and sign in to another org without having to uninstall/re-install, since it only requires the credentials and not the org url to login.
Home Page
 
On an OOB CRM Org, you will find the following entities listed in the mobile app.
 


Entity configuration for mobile access

On the entity settings, check the CRM for phones option to make the entity available for access through mobile clients.


Rich Client

The mobile client unlike the earlier mobile express option provides a richer client and user experience in line with its tablet client. Though it does not provide for process driven forms, it still allows you to check on related records.

This is how an account form would look like on a mobile client


Related entities


 
Support for Click to Call and Click to Mail support.

 

You can click on a phone number field to directly dial the number on the mobile.

 

 
This however does not create a phone call record in CRM.
 
Similarly click on an email address to pop-up the email client prompt for composing an email.
 
 
The email again is not tracked in CRM.
 
Complete Task
You can check off your to-do list in CRM from your mobile by selecting the task and marking it complete
 
Support for lookup selection
You can now perform a lookup search similar to the webclient to select the appropriate record.
 
Customize Mobile form layout/design
Once you have enabled an entity for mobile access, you need to configure the mobile form for the entity. The tablet client used the same form as the web client and only rendered it differently. However the mobile forms are rendered off the mobile forms designed for the entity.
 

You can even add a field on the form for read-only access by clicking on the Read Only button.

Note: When the form is rendered fields that do not have any data assigned to them are not displayed on the form in View mode. When you click Edit button, all fields are displayed.

Mobile forms also support Role-based access. Assign the roles that need to have access to a particular mobile form.


 
This also means you can design multiple mobile forms per entity and provide role based access to each of them.

 

Use the Form Order setting to decide on the order in which forms are displayed
 
 
 
Conclusion
The new mobile client that only provides support to CRM organizations provisioned on the O365 platform and for On-Premise environment, IFD configuration is essential is a true rich client that matches the tablet client released earlier. This now brings CRM to your mobile and much more easily accessible and usable than before.
 

 

Friday, November 8, 2013

South Asia Community Day - 9th November'13

 
The South Asia MVP award is organizing Community Day on 9th November, that involves community activities like UG Meets, Webcasts and On-line Chat with the MVP's in all technologies.
 
Sam along with fellow MVP Mahender Pal would be presenting a webcast showcasing the new features in CRM 2013 between 3PM - 5PM IST. It would a techno-functional webcast that includes a look at the following topics
 
UI Changes
Business Processes
Business Rules
Actions
Access Teams
Real-time Workflows
Client-Side script changes
Tablet Client
 
You can register for this event at https://www.livemeeting.com/lrs/microsoft1/Registration.aspx?pageName=dp48dz6c2z28kfzh
 
Learn more about Community Day activities at http://blogs.technet.com/b/southasiamvp/archive/2013/11/04/community-day-activities.aspx

Watch the session recording at http://www.youtube.com/watch?v=m6bfRel7rfQ 

Wednesday, October 30, 2013

How to install Ready-to-Use business processes in CRM 2013

Microsoft Dynamics CRM 2013 provides Ready to use Business Processes and it is as simple as we install sample data in CRM. To use this feature please follow the below steps:

To install the Ready to use processes, Navigate to Settings -> Data Management -> Under Data Management you can see the Option “Add Ready To Use Business Processes” as shown below.



When you click on this option you will get the below window and click Add button to add the business processes to your system.


  

After hitting the “Add” button wait for some time to install the business processes to your environment.


 
This process basically installs a Managed Solution called “BusinessProcesses”, you can see this solution in the Solution component as shown in below screen shot.




Following business process flows and some workflows get installed after completing this.









Hope this article helps!

 

Thursday, October 24, 2013

Access Teams in CRM 2013

This is another new feature addition in CRM 2013.

What are Access Teams?

In the previous versions of CRM record could be shared to other users or team to provide them access to the records. While sharing the records you could specify the permissions provided to the shared users to that record. The shortcomings here were either you add one user at a time and then specify the permissions for each user at the time of adding (repetitive work) or else pre-create teams and then share the record with the team. If you had a dynamic setup where you could have different set of users working on different records, it would require creating of those many teams to use team sharing. This was not a feasible idea.

Access Teams are based on these same concepts but without the limitations of the earlier Share options.

You can user Access Teams to provide access to records to more than one user and have teams created on the fly as the users are added.

How does it work?

  • Enable the Access Team feature for the desired entity.




  • Define the Access Team Template


         Navigate to Settings --> Administration --> Access Team Templates


In the Access Template you define the permissions to be assigned to the users selected for this Access Profile



The entity will only list those entities for which the Access Team feature is enabled.

You can create multiple templates for any entity. You can then select appropriate template on the entity form.

Add the Access Teams grid on the desired entity form.

Add a subgrid control and set the following properties.


In the Team Template select the Access Template that would like to apply.

All users included in the team grid would be controlled by the access template selected for the grid and would be provided permissions accordingly.

If a user that has user level access permission logs in, they would still be able to view records that were made accessible to them through the Access Teams.

The Team profile defines the privileges assigned.


Behind the scenes
 
  • For every record that you assign team members, a team record is created. So it creates one team per record.
 
  • The team type for this record is set to Access
 
  • The team name is auto generated by concatenating the entity record + the access template record id.
 



Programmatically Add/Remove users from a records Access Team

Read the Access Template ID using the Template name.

The entity that stores Access Template is “teamtemplate

                   //  Query using ConditionExpression and FilterExpression
                    ConditionExpression condition = new ConditionExpression();
                    //attribute name add to condition
                    condition.AttributeName = "teamtemplatename";
                    //operator add to condition
                    condition.Operator = ConditionOperator.Equal;
                    //values added to condition
                    condition.Values.Add(_accessTeamTemplateName);

                    // filter creation
                    FilterExpression filter = new FilterExpression();
                    //condition added
                    filter.Conditions.Add(condition);
                    //   create query expression
                    QueryExpression query = new QueryExpression("teamtemplate");
                    //filter added to query
                    query.Criteria.AddFilter(filter);

                    //retrieve all columns
                    query.ColumnSet = new ColumnSet("teamtemplatename");

                    // execute query which will retrieve the Access team teamplate
                    accessTeamColl = service.RetrieveMultiple(query);


Add user to the Access Team for a record

       //Request to create the Access team and add the user in that access team
                   AddUserToRecordTeamRequest adduser = new AddUserToRecordTeamRequest()
                    {
                        Record = entityToAdd,

                        SystemUserId = UserId,
                        TeamTemplateId = teamTemplateId
                    };
                    // Execute the request.
                   AddUserToRecordTeamResponse response = (AddUserToRecordTeamResponse)service.Execute(adduser);

Similarly you can use the RemoveUserFromRecordTeamRequest to remove users from a particular records access team.