index > ISV Open Discussions > Ajax in CRM

Ajax in CRM


Hi, i have a problem in CRM. I have a custom field named "new_number" and this field is disabled in form Order. I want to fill this field with autonumbering system which it must working with CRM Web Services, so i make a code that will return the new_number data into the field new_number in CRM Order form. To do that, i think i must working with AJAX (for example if the last record of new_number is A0001, then ajax will return A0002), where i can write my ajax code in Order Form Properties (onSave function at Save button). This is my AJAX code :

function OnSave()
{
var xmlHttp = null;
if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest();
else if (window.ActiveXObject) xmlHttp = new ActiveXObject("Microsoft.XMLHTTP") ;

if (xmlHttp == null)
{
alert ("Browser does not support HTTP Request") ;
return ;
}

var url = "http://crm:81/OrderNo/getOrderNo.aspx";
xmlHttp.onreadystatechange = function ()
{
if (xmlHttp.readyState==4) crmForm.all.new_limasorderno.DataValue=xmlHttp.responseXML.getElementsByTagName("orderid")[0].firstChild.data;
}
xmlHttp.open("GET",url,true) ;
xmlHttp.send(null) ;
}

But in the fact, the CRM will do save action first, and then fill the new_number field, so the new_number value doesn't filled into the database. Anyone can help me to solve this problem? Thx before ^_^.
Kartini

Have you considered putting the code in the OnLoad event instead? You can check whether it's a create or update form and only run the code for new orders.

I would probably implement this as a server side callout, however.




Mattias, C# MVP
Mattias Sjögren
I think it can't be put in OnLoad, because the autonumbering system is depend to the picklist new_ordertype value. For example the new_ordertype picklist have 2 value : Free Trial and Full Version. The code for the Free Trial is start with FT0001, and the code for Full Version is start with FV0001. So, the ajax can't put in onLoad, but must onSave function.
Kartini
reply 3

You can use google to search for other answers

 

More Articles

• Trouble while dealing with Share Point Object Model
• Challenging Topic: Online Gaming Portals!
• BSM Install Errors - PLEASE HELP IM DESPERATE
• Business Scorecard 2005 Installed - Just cannot connect to Analys...
• Installing BSC on SQL 2005 - SQL Server on the server does not me...
• Please help
• ODMA
• Authentication schemes in LCS ?
• Sharepoint Error
• experiences with MS software testing?
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• Design Strategy Problem
• What is ISV
• The elusive Microsoft Human Resources De
• BSM Install Errors - PLEASE HELP IM DESP
• MSDN licene vs. purchased license
• LAN vs WAN
• Multiple login to one MSDN subscription
• Installing BSC on SQL 2005 - SQL Server
• CRM 1.2 Error 80040e2f "the stateme
• Office Communicator and Video Controls
• Application Deployment Problem using GPO
• Ajax in CRM
• Can Business Scorecard Manager connect t
• Business Scorecard Manager Alerts
• Live Communications Server Kerberos impl

Hot Articles

• BSM Install Errors - PLEASE HELP IM DESP
• MODI Port
• trouble with internet explorer and java?
• Redistributing SSAS cubes
• Error on Archive Acivation
• Live Communications Server 2005 SP1 - no
• Business Scorecard Manager - Deploy to R
• CRM 3.0 doesn´t save my settings
• Can Business Scorecard Manager connect t
• Host Headers
• How to track changes
• Sharepoint 2007 - MOSS 2007 - Service er
• Client to SSAS
• XML view in IE
• An issue with Outlook Express 6 attachme

Recommend Articles

• outlook help
• Host Headers
• What language to learn?
• Audio/Video streams encryption in Office
• Trouble signing up for the Microsoft Emp
• how do i print selected informations fro
• How to get Sum of row members in ScoreCa
• Live Communications Server tab does not
• BSM 2005 server installation failed
• Redistribution of SQL Server Management
• Request for ink replies
• Sharepoint 2007 Site Template
• Dimensions in BSM
• BSM with SSRS(2005) on a different box
• Problems with Project Server