eService - Gridview problems

Feb 26, 2009 at 4:04 PM
Edited Mar 5, 2009 at 8:40 AM

Hope that someone can assist me with the follwoing please:

 

1.       Have to add more attributes to the My services entity grid which displays all the cases related to my company or to what i have created. I have looked at the eService Console and edited the Case Entity which provides me with the attributes from case entity but for some reason i can’t select the “statecode” attribute which is of type state?

2.       When i add new attributes to the case entity by adding html code to eService Config V1 then the column appears on the grid but it errors when i try to create new cases? As seen in Error 1

3.       When my Grid paging occurs it does not allow me to select the next page index from the webpage. As seen in Error 2

 

Hope you can assist me with my questions please.

 

Error 1

Server Error in '/' Application.


Server was unable to process request.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Services.Protocols.SoapException: Server was unable to process request.

Source Error:

 

Line 397:                                   }

Line 398:

Line 399:                                   EntityId = ((CreateResponse)_crmService.Execute(createRequest)).id;

Line 400:                          }

Line 401:


Source File: c:\Program Files\Microsoft Dynamics CRM Customer Portal\Controls\EntityEditor.ascx.cs    Line: 399

Stack Trace:

 

[SoapException: Server was unable to process request.]

   System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +551452

   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204

   Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request) +47

   Controls_EntityEditor.SaveEntity() in c:\Program Files\Microsoft Dynamics CRM Customer Portal\Controls\EntityEditor.ascx.cs:399

   Controls_EntityEditor.updateButton_Click(Object sender, EventArgs e) in c:\Program Files\Microsoft Dynamics CRM Customer Portal\Controls\EntityEditor.ascx.cs:168

   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105

   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107

   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

 


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

 

Error 2

 

Server Error in '/' Application.


The GridView 'gridView' fired event PageIndexChanging which wasn't handled.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The GridView 'gridView' fired event PageIndexChanging which wasn't handled.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

 

[HttpException (0x80004005): The GridView 'gridView' fired event PageIndexChanging which wasn't handled.]

   System.Web.UI.WebControls.GridView.OnPageIndexChanging(GridViewPageEventArgs e) +1495955

   System.Web.UI.WebControls.GridView.HandlePage(Int32 newPage) +83

   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +467

   System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +199

   System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

 


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

 

Mar 5, 2009 at 3:17 PM
You need to edit settings -> "eservice configuration" -> " eservice config V1" -> "configuration XML" field

when you attempt to edit otherwise it just creates a new entry in the configuration table...
Mar 5, 2009 at 3:26 PM
Good Day Daniel

thanks for that and do edit the configuration XML on eservice config V1 when i get the error. I added the portal subject on and it works fine so don't know why i can't add in custom attributes or state entity attributes?

I have fixed error 2 by adding following code...to EntityGrid.ascx.cs

protected

 

void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)

 

{

gridView.PageIndex = e.NewPageIndex;

gridView.DataBind();

}

Mar 5, 2009 at 3:34 PM
This is how my xml looks like.....

<Entities>
<Entity name="contact">
<Fields>
<Field name="firstname" label="First Name" IsDisabled="0" includeInGrid="1" default="" required="0" />
<Field name="lastname" label="Last Name" IsDisabled="0" includeInGrid="1" default="" required="0" />
<Field name="address1_line1" label="Street 1" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="address1_line2" label="Street 2" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="address1_line3" label="Street 3" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="address1_city" label="City" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="address1_stateorprovince" label="State/Province" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="address1_postalcode" label="ZIP/Postal Code" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="address1_country" label="Country/Region" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="telephone1" label="Business Phone" IsDisabled="0" includeInGrid="1" default="" required="0" />
<Field name="emailaddress1" label="E-mail" IsDisabled="0" includeInGrid="1" default="" required="0" />
</Fields>
</Entity>
<Entity name="incident">
<Fields>
<Field name="ticketnumber" label="Case Number      " IsDisabled="1" includeInGrid="1" default="" required="0" />
<Field name="title" label="Title" IsDisabled="0" includeInGrid="1" default="" required="0" />
<Field name="description" label="Description" IsDisabled="0" includeInGrid="0" default="" required="0" />
<Field name="statecode" label="Status Code" IsDisabled="0" includeInGrid="1" default="" required="0" />
<Field name="cosl_dateresolutionprovided" label="Date Resolved" IsDisabled="1" includeInGrid="1" default="" required="0" />
<Field name="createdon" label="Created On" IsDisabled="1" includeInGrid="1" default="" required="0" />
<Field name="cosl_portalsubject" label="Portal Subject" IsDisabled="0" includeInGrid="1" default="" required="0" />
</Fields></Entity><Entity name="account"><Fields><Field name="name" label="Account Name" />
</Fields>
</Entity>
</Entities>
Mar 5, 2009 at 3:38 PM
sorry didn't realise you were looking at custom entities.  I'm quite a bit behind you - but also need to change the gridview... Ill update if i find anything

Dan
Mar 5, 2009 at 5:28 PM
i have edited the grid by adjusting the xml successfully (added modification date, statecode and ownerid).  Did you manage to get anything working on the viewcase page?
Ill try adding a custom field tomorrow...
Mar 5, 2009 at 5:43 PM
i added a custom field to the grid (new_relatedaccountid).  i then added this as a fieldname and it appeared in the grid ...

on ours to add statecode i used below...

<Field name="statuscode" label="Status" IsDisabled="1" includeInGrid="1" default="" required="0" />


Mar 6, 2009 at 8:36 AM
Hi Dan

Cool thanks for the feedback but would like to know how you got around the[throw new NotImplementedException(String.Format("Attributes of type {0} are unable to be saved by the EntityEditor control.",attributeType.ToString))); exception on EntityEditor.ascx.cs when you have added the Statecode attribute to portal and want to create a new case or view an existing case?
Mar 6, 2009 at 9:02 AM
It just worked.  I have not changed anything after basic install with the exception of adding additional fields to the xml...
Mar 6, 2009 at 9:21 AM

Was puzzled for a minute but then saw what is different.....you are using the statusCode of type Status which is handled but i am using the statecode of type state to give me Active, Resolved, Cancelled ext. This field is necessary for me to show because i need to show all cases on the portal and need to see the state of each case in the grid. By adding this field i get the exception error.

Mar 6, 2009 at 9:27 AM
just added it and it works on the grid but fails when editing the individual case, but i get a more useful error message (see below).


Server Error in '/' Application.

Attributes of type State are unable to be displayed in the EntityEditor control.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotImplementedException: Attributes of type State are unable to be displayed in the EntityEditor control.

Source Error:

Line 638:
Line 639:			default:
Line 640:				throw new NotImplementedException(
Line 641:					String.Format("Attributes of type {0} are unable to be displayed in the EntityEditor control.",
Line 642:						attributeData.AttributeType.Value.ToString()));

Source File: c:\Program Files\Microsoft Dynamics Customer Portal\Controls\EntityEditor.ascx.cs    Line: 640

Stack Trace:

[NotImplementedException: Attributes of type State are unable to be displayed in the EntityEditor control.]
   Controls_EntityEditor.GetPopulatedControl(AttributeData attributeData, String defaultValue) in c:\Program Files\Microsoft Dynamics Customer Portal\Controls\EntityEditor.ascx.cs:640
   Controls_EntityEditor.PopulateHtmlTable(List`1 attributeDataList) in c:\Program Files\Microsoft Dynamics Customer Portal\Controls\EntityEditor.ascx.cs:491
   Controls_EntityEditor.OnLoad(EventArgs e) in c:\Program Files\Microsoft Dynamics Customer Portal\Controls\EntityEditor.ascx.cs:156
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Mar 6, 2009 at 10:00 AM
i was trying to add the owner of the case to the caseeditor (which is actually the entity editor) and found this... within private void PopulateHtmlTable

and found this... which might explain...

// Skip any attributes that either aren't in the list or are lookups, as they're currently not supported.
Mar 6, 2009 at 10:01 AM

Yes that is the error i get too. It is because the state type is not supported in the case statement on EntityEditor.ascx.cs. I know how to add in the extra case but have no idea of what to add to the statement....What i am busy doing as a workaround is to add a new customer attribute and update the newStatusCode with statuscode through workflow and plugin. Workflow is to update the field every time a case is created and plugin for when case is resolved or cancelled....because entity is marked as read only by the time the workflow want to update resolved status.....don’t know if this is the correct way of doing it....i would have liked to just update the ascx.cs page to handle state types....