JavaScript - CRM 4 - Custom entities and Case form.

Asked By John Morlan
03-Nov-09 06:31 AM

Hi, Can you please provide me some advise on how to improve the following code:

var lookupItem = new Array;
var subjectchosen;

lookupItem = crmForm.all.subjectid.DataValue;

if (lookupItem[0] != null)
 {
    // The guid value of the lookup.
    alert(lookupItem[0].id);
    subjectchosen = lookupItem[0].id;
  }

 if (subjectchosen == '{10942DD5-AA96-DE11-A34A-0050569744FE}')
 {
    crmForm.all.new_productcompserialid_c.style.visibility = '';
    crmForm.all.new_productcompserialid_d.style.visibility = '';
  }
 else
 {
  if (subjectchosen == '{C8550C28-AB96-DE11-A34A-0050569744FE}')
    {
      crmForm.all.new_productairconserialid_c.style.visibility = '';
      crmForm.all.new_productairconserialid_d.style.visibility = '';
     }
  else
   {
     if (subjectchosen == '{A8116101-AB96-DE11-A34A-0050569744FE}')
     {
        crmForm.all.new_productckserialid_c.style.visibility = '';
        crmForm.all.new_productckserialid_d.style.visibility = '';
      }
    }
  }

My issue is that i have another 15 subjects to add!! Plus additional coding later to filter the results of the lookup. 

Use ID  Use ID

05-Nov-09 12:02 PM

One thing you can do to avoid this whole set of IF statements is to use the code you are searching for (the one you are comparing with subjectchosen) as the ID of your elements.

As an example, instead of using "new_productcompserialid_c" as the ID of your element, use "10942DD5-AA96-DE11-A34A-0050569744FE" instead.  Then all you have to do is use document.getElementById to get a handle on that element and change its visibility.

Regards,
http://www.sql-server-helper.com/

Create New Account
help
Using SQL on Development Machine .NET Framework My Web application will eventually be hosted on someplace like to install anything else in order to test it? Specifically, I'm wondering about My SQL. With all the tons of stuff included with VS, do I need to download and welcome- -I'm lost. - - Jonathan Wood SoftCircuits Programming http: / / www.softcircuits.com ADO.NET Discussions SQL Server 2005 (1) SQL Express (1) SQL Server (1) MySQL (1) Visual Studio 2005 (1) Active Directory (1) Expression Web (1) Oracle (1 developing / testing somewhere either on your computer or on the reachable network. VS2005 comes with SQL Server Express. However, in ADO.NET, you would use different data access namespace, which would
Cannot register server (LOCAL) SQL Server I'm trying to register the (LOCAL) database using SQL Server authentication. However, I get the following message. I still can register other servers using ip connect to (LOCAL). - -- -- -- -- -- -- -- -- -- -- -- -- -- -- - ADDITIONAL INFORMATION: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL
I want know how to import excel sheet data into databse using stored procedure in sql server Use this - INSERT Personal (Name, ID) SELECT Name, ID FROM OPENROWSET('MSDASQL', 'Driver = {Microsoft Excel hi. . Follow this link . . http: / / www.aspsnippets.com / Articles / Read-and-Import-Excel-Sheet-into-SQL-Server-Database-in-ASP.Net.aspx HI try htis Stored Procedures For this article I have SheetName varchar ( 20 ), @FilePath varchar ( 100 ), @HDR varchar ( 3 ), @TableName varchar ( 50 ) AS BEGIN DECLARE @SQL nvarchar ( 1000 ) IF OBJECT_ID ( @TableName , 'U' ) IS NOT NULL SET @SQL = 'INSERT INTO ' + @TableName + ' SELECT * FROM OPENDATASOURCE' ELSE SET @SQL = 'SELECT * INTO ' + @TableName + ' FROM OPENDATASOURCE' SET @SQL = @SQL + '(''Microsoft.Jet.OLEDB.4.0'', ''Data Source = ' SET @SQL = @SQL + @FilePath + ';Extended Properties = ''''Excel
Error 1332 or 0x534 installing SQL Server Express update (KB 92189 Windows 7 Hi All, Windows Update wants to install the (KB MSOffice 2007 and various other pieces of software installed. The file 'C: \ Program Files \ Microsoft SQL Server \ 90 \ Setup Bootstrap \ LOG \ Hotfix.log' contains: 07 / 07 / 2007 10:01:21.250 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 07 828 Enumerating applicable products for this patch 07 / 07 / 2007 10:01:21.843 Found SQL 2005 Express product definition 07 / 07 / 2007 10:01:22.281 Enumeration: Determining QFE level Enumeration: Associated hotfix build information not found for the following file: c: \ Program Files \ Microsoft SQL Server \ MSSQL.1 \ MSSQL \ Binn \ SQLServr.exe 07 / 07 / 2007 10:01:22.343 Enumeration: Found Enumeration: Associated hotfix build information not found for the following file: c: \ Program Files \ Microsoft SQL Server \ MSSQL.1 \ MSSQL \ Binn \ SQLServr.exe 07 / 07 / 2007 10:01:22.406 Enumeration
The mysteries of sqlservr.exe SQL Server We've had problems with the process sqlservr.exe recently. Several instances of it are restart the process, it quickly increases its memory footprint and CPU usage. What exactly does SQL Server do when it starts up? Why does it use up the entire processor? What does not accessing or modifying databases when it loads, so that can't be the problem. SQL Server Discussions SQL Server 2005 (1) SQL Server 2000 (1) SQL Server (1) Business Contact Manager (1) Active Directory