Showing posts with label Load Employees in Siebel. Show all posts
Showing posts with label Load Employees in Siebel. Show all posts

Wednesday 22 November 2017

Load Employees in Siebel : Reading Data from Excel File

Hello All,

In my previous post about Loading Employees in Siebel i described the process through CSV file and IO based approach.

In this post lets achieve the requirement with excel file and business service.

Prerequisite,

  • Excel application installed on the machine (server), so this approach works only in Windows Environment.
  • Accessible location where we need to place the Excel file


Formating the Excel File :








Here we are entering data from 2nd Row.

Now we need to write a business service that reads data row by row and insert data in siebel. Since we are reading data in terms of rows and columns, so 2nd Row 2nd column will fetch value Rahul , and 3rd Row 2nd column will fetch Ankit and this will be our base of iterating through the excel sheet.

Final Code :


  • Reading Excel and Initializing BO and BO

  var ExcelApp = COMCreateObject("Excel.Application"); 
  ExcelApp.Workbooks.Open("C:/siebel/LoadEmployee.xlsx"); 
  ExcelApp.Visible = false; 
  var oBOEmp = TheApplication().GetBusObject("Employee"); 
  var oBCEmp = oBOLdVal.GetBusComp("Employee"); 

  • Getting value from Excel columns 
 while(ExcelApp.ActiveSheet.Cells(i,1).Value!= null) 
   { 
// Give the fields here 
// Employee Details
   var LastName = ExcelApp.ActiveSheet.Cells(i,1).Value; 
   var FirstName = ExcelApp.ActiveSheet.Cells(i,2).Value;   
   var Email = ExcelApp.ActiveSheet.Cells(i,3).Value;  
   var PhoneNumber = ExcelApp.ActiveSheet.Cells(i,4).Value; 
   var LoginName = ExcelApp.ActiveSheet.Cells(i,5).Value; 

   //Position Details
   var Position = ExcelApp.ActiveSheet.Cells(i,6).Value; 
   
   //Responsibility Details
   var Responsibility = ExcelApp.ActiveSheet.Cells(i,7).Value;  
}

  • Setting Fields Value and Invoking New Record     
   NewRecord(NewAfter); 
   SetFieldValue("Last Name",LastName); 
   SetFieldValue("First Name",FirstName);  
   SetFieldValue("Email",Email); 
   SetFieldValue("Phone Number",PhoneNumber);
   SetFieldValue("Login Name",LoginName); 

  • Closing Excel File 
 ExcelApp.Quit(); 
 ExcelApp = null; 


Refer exact code and sample file here .. You can mail me for any comments or suggestions.

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...