Issue with script using ADODB.Connection (Doc ID 507625.1)

Last updated on OCTOBER 31, 2016

Applies to:

Siebel Tools - Version 7.7.2.1 SIA [18353] and later
z*OBSOLETE: Microsoft Windows 2000
Database: Oracle 9i
Application Server OS: Microsoft Windows 2000 Advanced Server SP 4
Database Server OS: Microsoft Windows 2000 Advanced Server SP 4

This document was previously published as Siebel SR 38-2748781161.

"Checked for relevance on 10-Oct-2013"

Symptoms

Hi. I created a function (see LoadMissingDLDProfessionals.txt) which I'm planning to use in a Business Service, but whenever I run it in the Simulator I get an error message ""Operation is not allowed when the object is open".
"

Could you let me know what I need to change in the function to fix the problem.

function LoadMissingDLDProfessionals()
{
// Oracle Server - change the variable when ported to Priduction
var strServerName="<Server Name> ";
var strUser="<User Name>";
var strPWD="<Password>";
//
var strSQL;
var objCon = COMCreateObject("ADODB.Connection");
var strConnect = "DSN=" + strServerName;
objCon.Open(strConnect, strUser, strPWD);
var objRecSet = COMCreateObject("ADODB.Recordset");
//
strSQL="SELECT FINDR_ID,LAST_NAME,FST_NAME,PROF_TYPE,PROF_SPECIALTY," +
"ADDRESS2,CITY,PROVINCE,POSTAL_CODE FROM JOI_DLD_PHYSICIAN WHERE SIEBEL_ROW_ID IS NULL";
objRecSet = objCon.Open.Execute(strSQL);
//
if (!objRecSet.Eof)
{
// Activate BC and BC Fields
var objBO = TheApplication().GetBusObject("Contact");
var objBC = objBO.GetBusComp("Contact");
objBC.ActivateField("Last Name");
objBC.ActivateField("First Name");
objBC.ActivateField("JOI IMS Id");
objBC.ActivateField("Type");
objBC.ActivateField("JOI Specialty");
objBC.ActivateField("Street Address");
objBC.ActivateField("City");
objBC.ActivateField("State");
objBC.ActivateField("Postal Code");
objBC.ActivateField("Country");
objBC.SetViewMode(AllView);
objBC.InvokeMethod("SetAdminMode", "TRUE");

// Move to the First record :
objRecSet.moveFirst();
while (!objRecSet.Eof)
{
// create a new professional
objBC.NewRecord(NewAfter);
objBC.SetFieldValue("Last Name", objRecSet.Field("LAST_NAME").value);
objBC.SetFieldValue("First Name", objRecSet.Field("FST_NAME").value);
objBC.SetFieldValue("JOI IMS Id", objRecSet.Field("FINDR_ID").value);
objBC.SetFieldValue("Type", objRecSet.Field("PROF_TYPE").value);
objBC.SetFieldValue("JOI Specialty", objRecSet.Field("PROF_SPECIALTY").value);
objBC.SetFieldValue("Street Address", objRecSet.Field("ADDRESS2").value);
objBC.SetFieldValue("City", objRecSet.Field("CITY").value);
objBC.SetFieldValue("State", objRecSet.Field("PROVINCE").value);
objBC.SetFieldValue("Postal Code", objRecSet.Field("POSTAL_CODE").value);
objBC.SetFieldValue("Country", "Canada");
objBC.WriteRecord();
// get professionals id and update DLD Professional Table
strConId = objBC.GetFieldValue("Id");
// update Siebel Row Id column in DLD Professional Table
strConId = objBC.GetFieldValue("Id");
// update Siebel Row Id column in DLD Professional Table
strSQL="UPDATE JOI_DLD_PHYSICIAN SET SIEBEL_ROW_ID='" +
strConId + "' WHERE FINDR_ID='" + FINDR_ID + "'";
objCon.Open.Execute(strSQL);
//
objRecSet.moveNext();
}
objCon.Open.Execute("COMMIT");
// clear memory
objBC = null;
objBO = null;
}
// Close Recordset and Connection
objRS.Close();
objCon.Close();
objRS = null;
objCon = null;
return (CancelOperation);
}



Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms