eService: Hide resolution field when creating case

Feb 22, 2010 at 8:24 PM

I've added the Resolution field to the Case form through the eService Console.  Unfortunately the eService site isn't smart enough to hide the resolution field when creating a new case.  I've tried adding the following code but it isn't working.  Has anyone figured out how to hide the Resolution field (or any field for that matter) when creating a case but have it show up on existing or closed cases? 

    protected void Page_Load(object sender, EventArgs e)
    {
        this.LoadComplete += new System.EventHandler(this.Page_LoadComplete);
    }
    private void Page_LoadComplete(object sender, System.EventArgs e) 
    {
        //New Case
        if (String.IsNullOrEmpty(Request["incidentid"]))
        {
            caseEditor.FindControl("resolutionLabel").Visible = false;
            caseEditor.FindControl("resolutionField").Visible = false;
        }
    }
Feb 24, 2010 at 6:03 PM

I really wanted to disable these fiels on the ViewCase.aspx page but it didn't turn out to be too easy.  I ended up adding the following line to the EntityEditor.ascx.cs file:

if ((field.Attributes["IsDisabled"].Value == "1") && (attributeData.ActualValue == null) && (field.Attributes["default"] == null || field.Attributes["default"].Value == "")) continue;

This goes in the PopulateHtmlTable method right before the "new TableRow()" line. This skips the process of adding the field to the Entity Editor. It doesn't display fields that are disabled and don't contain any data or a default value. In my instance, a new case doesn't have any data in the resolution so this works.

I'm always open to better ideas.