The remote name could not be resolved while using HttpWebRequest


The issue could be because of proxy setting not specified for the web application. The solution to this is to add the following conifig info in the application’s web.config
<system.net><defaultProxy  enabled=true” useDefaultCredentials=true>
<proxy  bypassonlocal=True”  proxyaddress=proxyaddress />
</defaultProxy
</system.net

Hope it helps.

Error: ‘VEMap’ is undefined


If we get the above error while working with Virtual Earth first thing we need to check is whether the internet connection is working or not.

Next thing to check is whether JavaScript is disabled for the browser. And if this is the case, to enable it in case of IE.

Go to Tools à Internet Options à Security Tab

Find the entry Active Scripting and enable it.

Hope it helps.

Data Audit in CRM 2011 (while updating record programmatically)


Suppose we have enabled (out of the box) data audit feature for a particular entity and then we are updating its record programmatically in the following manner (the way we usually do)

myEntityRecord.new_addressname = txtAddressName.Text;

myEntityRecord.new_street2 = txtStreet2.Text;

myEntityRecord.new_city = txtCity.Text;

myEntityRecord.new_state = txtState.Text;

myEntityRecord.new_zip = txtZipCode.Text;

service.Update(serviceMember);

Now what happens over here is that all of these fields will appear as “changed field” in Audit History even if we haven’t changed its value.

Here in the above screen shot we can see the same value for fields in old value and new value column. This is something we should be aware of while updating records programmatically in CRM.

Bye.

Set Organizer for appointment or working with ActivityParty in CRM 2011


Hi,
Just posting a sample code for creating appointment record in CRM 2011.

Uri organizationUri = new Uri(<a href="http://CRM2011/orgName/XRMServices/2011/Organization.svc">http://CRM2011/orgName/XRMServices/2011/Organization.svc</a>);
Uri homeRealmUri = null;
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential("administrator", "password", "contoso");

OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
// Get the IOrganizationService
IOrganizationService orgService = (IOrganizationService)orgProxy;

// create entity record
Entity appointment = new Entity();
appointment.LogicalName = "appointment";
appointment.Attributes["subject"] = "App at " + DateTime.Now.ToString();
appointment.Attributes["scheduledstart"] = new DateTime();
appointment.Attributes["scheduledstart"] = DateTime.Now.AddDays(1);
appointment.Attributes["scheduledend"] = new DateTime();
appointment.Attributes["scheduledend"] = DateTime.Now.AddDays(1).AddHours(2);

// create activity party record
Entity activityParty = new Entity();
activityParty.LogicalName = "activityparty";
activityParty.Attributes["partyid"]=new EntityReference("systemuser",new Guid("userGuid"));
EntityCollection colAP = new EntityCollection();
colAP.Entities.Add(activityParty);

appointment.Attributes["organizer"] = new EntityCollection();
appointment.Attributes["organizer"] = colAP;

// If we use the bookrequest class it will fail
// and gives ResourceBusy error in case of scheduling conflict
// so simply create the appointment without using book request
// to make it appear in the calendar

//   BookRequest bookRequest = new BookRequest();
//   bookRequest.Target = appointment;

try
{
//  BookResponse booked = (BookResponse)orgService.Execute(bookRequest);
string appGuid = orgService.Create(appointment).ToString();
}
catch (Exception ex)
{
string exMessage = ex.Message;
}

Hope it helps !

“DropDownList has a SelectedIndex which is invalid because it does not exist in the list of items” error while setting SelectedIndex


I had my drop down list defined as following
<asp:DropDownList
ID=”ddlNeedEFMP” runat=”server” Enabled=”False”>
<asp:ListItem
Value=”2″>No</asp:ListItem>
<asp:ListItem
Value=”1″>Yes</asp:ListItem>

</asp:DropDownList>
To set it’s selectedindex we can make use of below syntax.

ddlNeedEFMP.SelectedIndex= ddlNeedEFMP.Items.IndexOf(ddlNeedEFMP.Items.FindByValue(“1”));

Hope it helps.

Some useful links while working with CSS.


Has some simple css for tables à

http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs/

Good site with live examples à

http://icant.co.uk/csstablegallery/tables/47.php

Setting CSS for disabled textbox à

http://www.cssportal.com/form-elements/text-box.htm

http://www.developertutorials.com/tutorials/html/styling-disabled-buttons-disabled-text-boxes-in-css-404/

Bye.

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓