locked
clone case RRS feed

  • Question

  • Hello

    I'm trying to clone a case. For this I made a javascript on the onload event

    Clone = function()
    {
        var cloneUrl  = location.pathname + "?";
            cloneUrl += "_CreateFromType=" + crmForm.ObjectTypeCode + 
            cloneUrl += "&_CreateFromId=" + crmForm.ObjectId + 
            cloneUrl += "&etc=" + crmForm.ObjectTypeCode + "#";
            
        var cloneFeatures = 'toolbars=0,status=1,width=' + document.body.offsetWidth + "height=" + document.body.offsetHeight; 
        
        window.open(cloneUrl,'',cloneFeatures);
    }
    
    after that i added a button in ISV config 
     <Entity name="gi_test">
       <ToolBar ValidForCreate="0" ValidForUpdate="1">
          <Button Icon="/_imgs/ico_18_debug.gif" JavaScript="Clone();">
             <Titles>
                <Title LCID="1033" Text="Clone" />
             </Titles>
             <ToolTips>
                <ToolTip LCID="1033" Text="Clone" />
             </ToolTips>
          </Button>
          <ToolBarSpacer />
       </ToolBar>
     </Entity>
    Unfortunately I get the following error
    Microsoft Dynamics CRM Error Report Contents
    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>Syntax error</Message>
     <Line>257</Line>
     <URL>/test&#47;_forms&#47;FormScript.js.aspx&#63;etc&#61;112&#38;FormType&#61;main&#38;FormName&#61;crmForm</URL>
     <PageURL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;</PageURL>
     <Function></Function>
     <CallStack>
     </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
     <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.1&#59; WOW64&#59; Trident&#47;4.0&#59; SLCC2&#59; .NET CLR 2.0.50727&#59; .NET CLR 3.5.30729&#59; .NET CLR 3.0.30729&#41;</BrowserUserAgent>
     <BrowserLanguage>en-us</BrowserLanguage>
     <SystemLanguage>ro</SystemLanguage>
     <UserLanguage>ro</UserLanguage>
     <ScreenResolution>1364x768</ScreenResolution>
     <ClientName>Web</ClientName>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>&#123;82411E7D-CD57-499E-BD5D-27147B032D56&#125;</OrgID>
        <UserID>&#123;FCB2A3A6-B1E4-DE11-A99A-00155D636701&#125;</UserID>
        <CRMVersion>4.0.7333.2138</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>
    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>Object expected</Message>
     <Line>1</Line>
     <URL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;</URL>
     <PageURL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;&#35;</PageURL>
     <Function></Function>
     <CallStack>
     </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
     <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.1&#59; WOW64&#59; Trident&#47;4.0&#59; SLCC2&#59; .NET CLR 2.0.50727&#59; .NET CLR 3.5.30729&#59; .NET CLR 3.0.30729&#41;</BrowserUserAgent>
     <BrowserLanguage>en-us</BrowserLanguage>
     <SystemLanguage>ro</SystemLanguage>
     <UserLanguage>ro</UserLanguage>
     <ScreenResolution>1364x768</ScreenResolution>
     <ClientName>Web</ClientName>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>&#123;82411E7D-CD57-499E-BD5D-27147B032D56&#125;</OrgID>
        <UserID>&#123;FCB2A3A6-B1E4-DE11-A99A-00155D636701&#125;</UserID>
        <CRMVersion>4.0.7333.2138</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>
    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>Could not complete the operation due to error 80020101.</Message>
     <Line>268</Line>
     <URL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;</URL>
     <PageURL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;&#35;</PageURL>
     <Function>onclick&#40;&#41;</Function>
     <CallStack>
       <Function>onclick&#40;&#41;</Function>
     </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
     <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.1&#59; WOW64&#59; Trident&#47;4.0&#59; SLCC2&#59; .NET CLR 2.0.50727&#59; .NET CLR 3.5.30729&#59; .NET CLR 3.0.30729&#41;</BrowserUserAgent>
     <BrowserLanguage>en-us</BrowserLanguage>
     <SystemLanguage>ro</SystemLanguage>
     <UserLanguage>ro</UserLanguage>
     <ScreenResolution>1364x768</ScreenResolution>
     <ClientName>Web</ClientName>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>&#123;82411E7D-CD57-499E-BD5D-27147B032D56&#125;</OrgID>
        <UserID>&#123;FCB2A3A6-B1E4-DE11-A99A-00155D636701&#125;</UserID>
        <CRMVersion>4.0.7333.2138</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>
    Thank you
    Thursday, April 1, 2010 2:32 PM

Answers

All replies

  • sorry for format, i'll do it again
    • Edited by Cosminc Thursday, April 1, 2010 2:46 PM
    Thursday, April 1, 2010 2:39 PM
  • Did you follow the whole text at http://mscrm4ever.blogspot.com/2009/10/crm-40-cloning-using-entity-mapping.html?

    You need a self referencing relationship too. And if you use this on a system which language is not en (1033) you should set the correct language lcid too! Cause the user language is "ro" !


    Gruß Carsten Groth http://carstengroth.spaces.live.com
    Thursday, April 1, 2010 2:41 PM
  • OnLoad event

    Clone = function() { var cloneUrl  = location.pathname + "?";
            cloneUrl += "_CreateFromType=" + crmForm.ObjectTypeCode +
            cloneUrl += "&_CreateFromId=" + crmForm.ObjectId +
            cloneUrl += "&etc=" + crmForm.ObjectTypeCode + "#";
           
        var cloneFeatures = 'toolbars=0,status=1,width=' + document.body.offsetWidth + "height=" + document.body.offsetHeight;
       
        window.open(cloneUrl,'',cloneFeatures);
    }

    ISV button

    Simple button to Clone function

     <Entity name="incident"><br/>   <ToolBar ValidForCreate="0" ValidForUpdate="1"><br/>      <Button Icon="/_imgs/ico_18_debug.gif" JavaScript="Clone();"><br/>         <Titles><br/>            <Title LCID="1033" Text="Clone" /><br/>         </Titles><br/>         <ToolTips><br/>            <ToolTip LCID="1033" Text="Clone" /><br/>         </ToolTips><br/>      </Button><br/>      <ToolBarSpacer /><br/>   </ToolBar><br/> </Entity><br/>

    Error received

    Microsoft Dynamics CRM Error Report Contents

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>Syntax error</Message>
     <Line>257</Line>
     <URL>/test&#47;_forms&#47;FormScript.js.aspx&#63;etc&#61;112&#38;FormType&#61;main&#38;FormName&#61;crmForm</URL>
     <PageURL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;</PageURL>
     <Function></Function>
     <CallStack>
     </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
     <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.1&#59; WOW64&#59; Trident&#47;4.0&#59; SLCC2&#59; .NET CLR 2.0.50727&#59; .NET CLR 3.5.30729&#59; .NET CLR 3.0.30729&#41;</BrowserUserAgent>
     <BrowserLanguage>en-us</BrowserLanguage>
     <SystemLanguage>ro</SystemLanguage>
     <UserLanguage>ro</UserLanguage>
     <ScreenResolution>1364x768</ScreenResolution>
     <ClientName>Web</ClientName>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>&#123;82411E7D-CD57-499E-BD5D-27147B032D56&#125;</OrgID>
        <UserID>&#123;FCB2A3A6-B1E4-DE11-A99A-00155D636701&#125;</UserID>
        <CRMVersion>4.0.7333.2138</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>Object expected</Message>
     <Line>1</Line>
     <URL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;</URL>
     <PageURL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;&#35;</PageURL>
     <Function></Function>
     <CallStack>
     </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
     <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.1&#59; WOW64&#59; Trident&#47;4.0&#59; SLCC2&#59; .NET CLR 2.0.50727&#59; .NET CLR 3.5.30729&#59; .NET CLR 3.0.30729&#41;</BrowserUserAgent>
     <BrowserLanguage>en-us</BrowserLanguage>
     <SystemLanguage>ro</SystemLanguage>
     <UserLanguage>ro</UserLanguage>
     <ScreenResolution>1364x768</ScreenResolution>
     <ClientName>Web</ClientName>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>&#123;82411E7D-CD57-499E-BD5D-27147B032D56&#125;</OrgID>
        <UserID>&#123;FCB2A3A6-B1E4-DE11-A99A-00155D636701&#125;</UserID>
        <CRMVersion>4.0.7333.2138</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>Could not complete the operation due to error 80020101.</Message>
     <Line>268</Line>
     <URL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;</URL>
     <PageURL>/test&#47;cs&#47;cases&#47;edit.aspx&#63;id&#61;&#123;E0D33A5C-883D-DF11-B93A-00155D636701&#125;&#35;</PageURL>
     <Function>onclick&#40;&#41;</Function>
     <CallStack>
       <Function>onclick&#40;&#41;</Function>
     </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
     <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.1&#59; WOW64&#59; Trident&#47;4.0&#59; SLCC2&#59; .NET CLR 2.0.50727&#59; .NET CLR 3.5.30729&#59; .NET CLR 3.0.30729&#41;</BrowserUserAgent>
     <BrowserLanguage>en-us</BrowserLanguage>
     <SystemLanguage>ro</SystemLanguage>
     <UserLanguage>ro</UserLanguage>
     <ScreenResolution>1364x768</ScreenResolution>
     <ClientName>Web</ClientName>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>&#123;82411E7D-CD57-499E-BD5D-27147B032D56&#125;</OrgID>
        <UserID>&#123;FCB2A3A6-B1E4-DE11-A99A-00155D636701&#125;</UserID>
        <CRMVersion>4.0.7333.2138</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>

    Unfortunately i'm not a programmer :)

    Thanks in advance

    Thursday, April 1, 2010 2:45 PM