Siebel : Load data from Excel through UI

You can import the data into Siebel by a click of a button. 😉

Basically you need to use the Excel COM Objects and import them.

Sample Excel :LoadTest.xlsx

Product Name Language Code
Penalty Charges Arabic (Saudi Arabia) ARA
EOF

Sample code below :

function WebApplet_PreInvokeMethod (MethodName)
{
if (MethodName == “AVRImportRecords”)
{
Try
{
var i =2;
var ExcelApp = COMCreateObject(“Excel.Application”);
ExcelApp.Workbooks.Open(“C:\\LoadTest.xlsx”);
ExcelApp.Visible = false;

var oBOLdVal = TheApplication().GetBusObject(“Admin ISS Product Definition”);
var oBCLdVal = oBOLdVal.GetBusComp(“Internal Product Translation”);
var oBCLdValParent = oBOLdVal.GetBusComp(“Internal Product – ISS Admin”);

while(ExcelApp.ActiveSheet.Cells(i,1).Value!= “EOF”)
{
var ProductName = ExcelApp.ActiveSheet.Cells(i,1).Value;
var LanguageName = ExcelApp.ActiveSheet.Cells(i,2).Value;
var Code = ExcelApp.ActiveSheet.Cells(i,3).Value;

var Description = ExcelApp.ActiveSheet.Cells(i,4).Value;
with(oBCLdValParent)
{
SetViewMode(“AllView”);
InvokeMethod(“SetAdminMode”,”TRUE”);
ActivateField(“Name”);
ClearToQuery();
SetSearchSpec(“Name”,ProductName);
ExecuteQuery();
}
if(oBCLdValParent.FirstRecord())
{
var ProductId = oBCLdValParent.GetFieldValue(“Id”);
with(oBCLdVal)
{
NewRecord(NewAfter);
var bcPickParentProd = oBCLdVal.GetPicklistBusComp(“Language Code”);
bcPickParentProd.SetViewMode(AllView);
bcPickParentProd.ActivateField(“Language Code”);
bcPickParentProd.ClearToQuery();
bcPickParentProd.SetSearchSpec(“Language Code”,Code);
bcPickParentProd.ExecuteQuery();
if(bcPickParentProd.FirstRecord())
{
bcPickParentProd.Pick();
}

bcPickParentProd = null;
SetFieldValue(“Product Id”,ProductId);
WriteRecord();

}
}
i=i+1;

}

}// try
catch(e)
{
throw(e);
return(CancelOperation);
}
finally
{
ExcelApp.Quit();
ExcelApp = null;
oBOLdVal = null;
oBCLdVal = null;
oBCLdValParent = null;
}
return(CancelOperation);
} // method end
return(ContinueOperation);
} // function end

Easy Right ?? 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: