Error executing code: Wrong type in field number.

I get error when deploying the form.

Error is in CatalogRequest form.

error detail:

Error executing code: Wrong type in field number.

(C)\Forms\jsCatalogRequest\Methods\init - line 24

(C)\Classes\SysSetupFormRun\init - line 3

and the code is

[code]

06/29/2005

<TRACKING_ID>F424, D907</TRACKING_ID>

Loads active catalogs for customer.

Set buttons for quick key access.

[/code]

public void init()

{

CustAccount custAcct;

smmBusRelAccount busRelAcct;

smmBusRelTable tBusRelTable;

jsTmpCustSearchTable tTmpCustSearchTable;

;

// D4056 - Removed call to element.jsSetQuickKeys();

super();

switch(element.args().record().TableId)

{

case(TableNum(CustTable)):

custAcct = CustTable::findRecId(element.args().record().RecId).AccountNum;

break;

case(TableNum(SalesTable)):

custAcct = SalesTable::findRecId(element.args().record().RecId).CustAccount;

break;

// F1391 5/23/07 - support sending a catalog to a BR

case(TableNum(smmBusRelTable)):

tBusRelTable = element.args().record();

custAcct = tBusRelTable.CustAccount();

busRelAcct = tBusRelTable.BusRelAccount;

break;

// F7333 10/25/07 - support sending a catalog from customer search

case(TableNum(jsTmpCustSearchTable)):

tTmpCustSearchTable = element.args().record();

custAcct = tTmpCustSearchTable.CustAccount;

busRelAcct = tTmpCustSearchTable.BusRelAccount;

break;

}

jstmpCatalogRequest.initFromjsCatalogSetup(custAcct, busRelAcct);

jstmpCatalogRequest_ds.executeQuery();

}

Please anybody reply me regarding this error.

Thanks to all.

Hello,

Your error is coming on the code line:

switch(element.args().record().TableId)

{

It is so because your form is not called by any other form. Because of this the value of element.args().record() is null and hence a null record should not have a TableId. So an error is thrown:

Error executing code: Wrong type in field number.

(C)\Forms\jsCatalogRequest\Methods\init - line 24

(C)\Classes\SysSetupFormRun\init - line 3

To prevent this error just include an if condition in the init method as shown below:

if (element.args().record())

{

switch(element.args().record().TableId)

{

case(TableNum(CustTable)):

custAcct = CustTable::findRecId(element.args().record().RecId).AccountNum;

break;

}

}