Copy record in MS CRM – Ajax

June 1, 2010 by · Leave a Comment 

This article explains how you can copy one or more fields from any entity in MS CRM using (Ajax).  The main idea is to build a create XML message, gather the entity values and send them to CrmService.Create web method. The method returns a create result of the newly created entity which is then used to create a valid entity url e.g. edit.aspx?id={cloned entity id}. 

This function is a server-side function whereby the new entity record is first created and then displayed on the form. When the user decides to cancel this action the new record needs to be deleted manually !!
If you want to copy fields client-side (via Addressable Forms) you can use gCopyRecord()

For more information on copying a records via Ajax see the original post by Adi Kats: Cloning an Entity Part 3 – using Ajax

Step-by-Step: 

  1. Copy the script in the Onload event.
  2. If you don’t want to include the popup message in your solution, then simply set the ajaxCloner.Progress.Visible to false.
  3. You can copy specific fields via the AddField method inside the script (optional). If no fields are defined, all fields will be copied.
  4. Create a ISV button that calls this function. For more information on how to create an ISV button see: Create ISV toolbar button on a form.

image  

Copy the code in the Onload event and call the function using the example below: 

Read more

Copy record in MS CRM – Addressable Forms

June 1, 2010 by · Leave a Comment 

This article explains how you can copy one or more fields from any entity to a new form in MS CRM (Client-Side). The function uses a new feature in MS CRM 4.0 called addressable forms which allows you to fill a new entity Form from scratch by sending Named (Field Names) parameters inside the Query String e.g. /edit.aspx?fieldname1=value1&fieldname2=value2 .  

This function is a client-side function whereby the fields are copied from one form to another and the copied record is not yet saved.
If you want to copy fields server-side (via AJAX) you can use gCopyRecordAjax()

For more information on copying a records via Addressable Forms see the post by Adi Kats: Cloning an entity Part 2 – Addressable Forms

 Step-by-Step: 

  1. Copy the script in the Onload event
  2. Create an array of fields to copy (optional).  If you don't specify any fields or array is null, all fields that are not null are copied.
  3. Create a ISV button that calls this function. For more information on how to create an ISV button see: Create ISV toolbar button on a form.

 Copy the code in the Onload event and call the function using the example below: 

Read more

Create ISV toolbar button on a form

March 25, 2009 by · Leave a Comment 

This post describes how to create an ISV button in a toolbar e.g. the account form.

image

1. Before you start you must make sure that ISV extensions are enabled.

  • Go to Settings, System Settings, Customizations.
  • In Custom menus and toolbars select for which clients you want to make custom menus and toolbars (Web Client, Outlook and / or Outlook Offline).

image

2. Follow the steps below to change the isv.config file :

  • Export de isv.config (note: always make sure you create a backup of the original isv.config).
  • Open the file in a text editor e.g. Notepad++
  • Locate the section "<!– The Account Tool Bar –>"

image

  • Scroll down to just above  </Toolbar>: 
  • Create a new  <Button> tag by copying the following code sniplet:
<Button Icon="/_imgs/ico_18_quota.gif" JavaScript="gCopyAccount();" Client="Web">
  <Titles>
    <Title LCID="1033″ Text="Copy Account" />
  </Titles>
  <ToolTips>
    <ToolTip LCID="1033″ Text="Copy Account" />
  </ToolTips>
</Button>
  • After the “Javascript=” enter the name of the function that needs to be called. In our example the function is called: gCopyAccount(). Note: If it is a function located in a different file (external) than the isv.config (e.g. formload) make sure the function is declared globally. A global function is set up as follows:
    savePage = function() instead of function savePage().
  • Finally specify a Title and a Tooltip for the bew button.
  • Save the changes and import the new ISV.config.
  • Open the form and test the button.