locked
Adding a Save and Close button to Cases RRS feed

  • Question

  • I am trying to add a Save and Close button to the intiall case screen. I need to do 3 things with this button

    1. Save the record
    2. Add a default value of 0 to an business required attribute
    3. Launch the Case resolution screen using the resolve() function.

    I have tried the code below in the ISV Config file but it generates an error refering to the GUID as seen below - I suspect that this is because it is trying close it before it is saved. I have tried the windon.Timeout command but this doesn't work (well my attempt at it didn't). Any help would be greatly appreciate as this is driving me nuts! 

     ISV Config Code
     <ToolBar ValidForCreate="1" ValidForUpdate="0">
                <Button Icon="/_imgs/ico_16_4206.gif" JavaScript="crmForm.Save();crmForm.all.new_timespent.DataValue=0;resolve();">
                  <Titles>
                    <Title LCID="1033" Text="Save Resolve Case" />

    Error Code

    [FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).]
    
    
    
     System.Guid..ctor(String g) +2959
    
    
    
     Microsoft.Crm.Dialogs.CloseCasePage.ConfigureForm() +152
    
    
    
     Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e) +40
    
    
    
     System.Web.UI.Control.PreRenderRecursiveInternal() +108
    
    
    
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
    
    
    
    
    Friday, September 10, 2010 3:37 PM

Answers

  • Problem: The method "resolve" requires an id of a case to resolve. Since your toolbar button is added to a form which is not saved it doesn't know what to resolve hence the Guid format exception

    Solution: You can workaround this either by using a plugin on create of a case or using a workflow. Custom attributes on a case entity can be used to hold on to the values that you will need for resolution like resolution type.

    • Marked as answer by Jim Glass Jr Friday, September 10, 2010 6:36 PM
    Friday, September 10, 2010 6:27 PM

All replies

  • Problem: The method "resolve" requires an id of a case to resolve. Since your toolbar button is added to a form which is not saved it doesn't know what to resolve hence the Guid format exception

    Solution: You can workaround this either by using a plugin on create of a case or using a workflow. Custom attributes on a case entity can be used to hold on to the values that you will need for resolution like resolution type.

    • Marked as answer by Jim Glass Jr Friday, September 10, 2010 6:36 PM
    Friday, September 10, 2010 6:27 PM
  • Mesganaw - Thanks for yur help!
    Monday, September 13, 2010 10:07 AM