This is possible in CRM 2011 now without getting our hands
dirty. When you go to the form to add the field you are shown the fields at the
right most cornet of the form. There the fields are already filtered to show
the ones you have not being used. Once you UN tick that you can select any
field that has been already used on the form to another place on the same form.
This blog describes mostly about the work (CRM 365, CRM 2016, CRM 2015, CRM2011, CRM 4.0, CRM 3.0, C#,Javascript and SQL Server) i do.
Wednesday, May 29, 2013
Working with Date and Time Values in CRM 2011 Programmatically
Most of us working with CRM 2011 would have faced some
issues working with CRM 2011 date time objects as they don’t represent the
exact date time value that we see on CRM form.
This has been an issue when working with the
programmatically as what we see as the date time value in the CRM form isn’t
the value that is stored in the database for that field. The value we send gets
converted and gets stored inside the date time field. When we check the record
from CRM form, internally this value has got converted and we see the correct
value. This is all good. But what happens when you want to get this field
programmatically for one of our task. This is where we get the issue.
We came across an issue like this while working with one of
our projects. We came up with the following solution to get around this issue.
·
We retrieve the user setting of the user who
created the record.
·
Then we take the TimeZoneBias and TimeZoneDaylightBias
fiels values from the user setting record and calculate the correct time from
them.
UserSettings us = "Retreived
user settings record";
DateTime dt = account.start_date.Value.AddMinutes(-Convert.ToDouble(us.TimeZoneBias));
dt = dt.AddMinutes(-Convert.ToDouble(us.TimeZoneDaylightBias));
The value is normally updated in the database
in the CRM by adding users time zone minutes and deducting the day light saving
value. We simply add them here to get the correct date and time. Simple
ha!.....
CRM 2011 Error “Object of type 'Microsoft.Xrm.Sdk.Entity' cannot be converted to type...”
This error is coming up when you try to execute a linq
query. After checking this out we found out how to resolve this.
What happens is that we create an organization proxy
variable and then cast to service context object. Before you cast to service
context object you need to enable proxy types in organization service proxy.
You can use the code below to do that and that would prevent you from seeing
the above error and getting your task done.
orgServiceProxy.EnableProxyTypes();
Tuesday, December 18, 2012
CRM 2011 Plugin Images – Target Image
As we all know when a record creation is happening we can find the information of the attributes in that event using Target image from the Pre create event.
You get all the values in the Target image from the Create event.
You get the same image in the update as well. But there is a different.
In update you only get the changed attributes. Not all the attributes of the record. So if you want to get all the attributes of the record you need to do some alternatives.
The best would be to merge the Pre image of the event with the target image.
However please do keep in mind when you are doing that you need to give precedence to the target image and add any attribute that is not in the Target image from the Pre image. If not you will be misguided and will not be able to produce the correct result that you are planning to have.
You get all the values in the Target image from the Create event.
You get the same image in the update as well. But there is a different.
In update you only get the changed attributes. Not all the attributes of the record. So if you want to get all the attributes of the record you need to do some alternatives.
The best would be to merge the Pre image of the event with the target image.
However please do keep in mind when you are doing that you need to give precedence to the target image and add any attribute that is not in the Target image from the Pre image. If not you will be misguided and will not be able to produce the correct result that you are planning to have.
Thursday, September 6, 2012
Error message “User does not have send-as privilege.” when sending emails programmatically in CRM 2011
We were working on sending emails programmatically using CRM and all were working fine. Suddenly we got this error when we tried to send an email. It was strange to us as this functionality was working fine before. So we did some digging to find out what had changed to cause this issue. We found out that one of us had changed the email sending user from the admin user to another user.
We use a CRM user to work with a web portal and we have used the same user as the email sending user. Hence we didn’t get any errors as the same user can send emails to anyone using the same user account. (no impersonation is here).
But when you try to send an email from someone else using a different user account you get and error as the email sending user has not granted permission for others to send emails on behalf of him. You can grant the permission by going to personal user setting of the email sending user and selecting “Allow other Microsoft dynamics CRM users to send email on your behalf”.
After doing this our problem was solved and we were able to send emails.
You can refer the following articles for more details
http://social.microsoft.com/Forums/en/crm/thread/9fee0bd6-2ae9-4f33-a971-0bf83bcf43de
http://blogs.msdn.com/b/crm/archive/2009/12/07/configure-microsoft-dynamics-crm-online-e-mail-router-with-exchange-online.aspx
We use a CRM user to work with a web portal and we have used the same user as the email sending user. Hence we didn’t get any errors as the same user can send emails to anyone using the same user account. (no impersonation is here).
But when you try to send an email from someone else using a different user account you get and error as the email sending user has not granted permission for others to send emails on behalf of him. You can grant the permission by going to personal user setting of the email sending user and selecting “Allow other Microsoft dynamics CRM users to send email on your behalf”.
After doing this our problem was solved and we were able to send emails.
You can refer the following articles for more details
http://social.microsoft.com/Forums/en/crm/thread/9fee0bd6-2ae9-4f33-a971-0bf83bcf43de
http://blogs.msdn.com/b/crm/archive/2009/12/07/configure-microsoft-dynamics-crm-online-e-mail-router-with-exchange-online.aspx
Monday, August 13, 2012
Dependent Optionlist/Picklist values in CRM 2011
This is not possible with OOTB CRM features. We can use lookup options with cascading features from OOTB functions.
So is there a way to come around this? Yes, there is. There is a solution which has been created and shared among the developers. This is perfect when it comes to CRM interfaces.
The links below would take you to articles which describe it more.
http://blogs.msdn.com/b/paf/archive/2011/04/21/how-to-easily-create-dependent-picklist-in-crm-2011.aspx
The recurring problems have been included in this article.
http://blogs.msdn.com/b/paf/archive/2011/09/29/dependent-picklist-recurrent-problems.aspx
Please not you can have multiple picklist dependent on the same picklist in an entity. This is supported. All you have to do is to create a single web resource with all the mapping data inside it and it will work.
So is there a way to come around this? Yes, there is. There is a solution which has been created and shared among the developers. This is perfect when it comes to CRM interfaces.
The links below would take you to articles which describe it more.
http://blogs.msdn.com/b/paf/archive/2011/04/21/how-to-easily-create-dependent-picklist-in-crm-2011.aspx
The recurring problems have been included in this article.
http://blogs.msdn.com/b/paf/archive/2011/09/29/dependent-picklist-recurrent-problems.aspx
Please not you can have multiple picklist dependent on the same picklist in an entity. This is supported. All you have to do is to create a single web resource with all the mapping data inside it and it will work.
If you have any issues doing the above let me know.
Thursday, August 9, 2012
CRM 2011 Integer fields and comma symbol
In CRM if you create an integer field by default the CRM group 2 numbers together by using a comma. This is the standard feature.
However sometimes customers ask this comma to be removed. This is not possible with OOTB functionality in CRM. You have couple of options.
• Remove the integer field, have a text field and include javascripting to validate the field. This might be cumbersome.
• Can create another field (text) and using a workflow assign the value of the integer field to this. This field would be getting displayed in views and forms. The drawback is you have synch both these fields.
• You can have a javascript to remove the comma from the CRM form when it’s loading. Not much difficult. However you still would not be able to get rid of commas when you display a view.
Below I have given a common javascript function which can be used to get rid of commas. Add this to a web resource.
function RemoveComma(fieldname)
{
document.getElementById(fieldname).value = Xrm.Page.data.entity.attributes.get(fieldname).getValue();
}
• Add the web resource to form onload event.
• Call the function RemoveComma with the field name as the parameter.
This way you can use this function anywhere you want just by passing the field name to it.
However sometimes customers ask this comma to be removed. This is not possible with OOTB functionality in CRM. You have couple of options.
• Remove the integer field, have a text field and include javascripting to validate the field. This might be cumbersome.
• Can create another field (text) and using a workflow assign the value of the integer field to this. This field would be getting displayed in views and forms. The drawback is you have synch both these fields.
• You can have a javascript to remove the comma from the CRM form when it’s loading. Not much difficult. However you still would not be able to get rid of commas when you display a view.
Below I have given a common javascript function which can be used to get rid of commas. Add this to a web resource.
function RemoveComma(fieldname)
{
document.getElementById(fieldname).value = Xrm.Page.data.entity.attributes.get(fieldname).getValue();
}
• Add the web resource to form onload event.
• Call the function RemoveComma with the field name as the parameter.
This way you can use this function anywhere you want just by passing the field name to it.
Subscribe to:
Posts (Atom)
Retrieving Calendar of a Bookable Resource in Dynamics
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
-
There is a bit of change in CRM 2011 than CRM 4. The code is below. Microsoft.Xrm.Sdk. EntityReference Moniker1 = new Microsoft.Xrm.S...
-
When you create a new security role from scratch and then assign only that role to a system user and when you log to the CRM site you might ...
-
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
