Hello All,
In my previous posts about Loading Employees in Siebel i described the process through CSV file and IO based approach and Excel based approach. Now in this post lets try to load employees using Clib methods by reading a csv file.
In this post lets achieve the requirement using Clib methods like ,
Prerequisite,
In my previous posts about Loading Employees in Siebel i described the process through CSV file and IO based approach and Excel based approach. Now in this post lets try to load employees using Clib methods by reading a csv file.
In this post lets achieve the requirement using Clib methods like ,
Prerequisite,
- Accessible location where we need to place the csv file
- BS should be Server Side as Clib methods works only on server side BS from IP13 onwards(click to know more)
Sample Code,
var str;
var usageAry = new Array();
var filePath = "C:\\Employee.CSV"; //file path to place CSV file
var oFile = Clib.fopen(filePath,"rt"); // Open file in read Mode
var out;
if(oFile != null)
{
while(!Clib.feof(oFile)) //check for end of file
{
str = Clib.fgets(oFile);
usageAry = str.split(","); // Delimiter to separate data from the file
var FirstName = usageAry[0];
var LastName = usageAry[1];
var PhoneNumber = usageAry[2];
var Email = usageAry[3];
var LoginName = usageAry[4];
var Position = usageAry[5];
var Responsibility = usageAry[6];
}
Now we have values in variables which we can pass to siebel for inserting record, you can use below script.
//Initialize BC and Insert data
var oBOEmp = TheApplication().GetBusObject("Employee");
var oBCEmp = oBOLdVal.GetBusComp("Employee");
with(oBCEmp)
{
ActivateField("Last Name"); ActivateField("First Name"); ActivateField("Email");
ActivateField("Phone Number"); ActivateField("Login Name");
ClearToQuery();
InvokeMethod("SetAdminMode","TRUE");
NewRecord(NewAfter);
SetFieldValue("Last Name",LastName); SetFieldValue("First Name",FirstName); SetFieldValue("Email",Email);
SetFieldValue("Phone Number",PhoneNumber); SetFieldValue("Login Name",LoginName);
//Insert Responsibility Now
var RespBC = GetMVGBusComp("Responsibility");
var AssocBC = RespBC.GetAssocBusComp();
// TheApplication().RaiseErrorText(PrRecord + AssocBC);
with(AssocBC)
{
SetViewMode(3);
ClearToQuery();
ActivateField("Name");
//search for the responsibility
SetSearchSpec("Name", Responsibility);
ExecuteQuery(ForwardBackward);
var Respfound = FirstRecord();
if(Respfound)
{
AssocBC.Associate(NewAfter);
}
}
//Insert Position Now
var PostnBC = GetMVGBusComp("Position");
var AssocPostnBC = PostnBC.GetAssocBusComp();
with(AssocPostnBC)
{
SetViewMode(3);
ClearToQuery();
ActivateField("Name");
//search for the position
SetSearchSpec("Name", Position);
ExecuteQuery(ForwardBackward);
var PosFound = FirstRecord();
if(Respfound)
{
AssocBC.Associate(NewAfter);
}
}
WriteRecord(); //save record
}
sample csv file looks like,
your suggestions and comments are always welcome :-) ,for exact code you can mail me.
kalbalums@gmail.com - please mail me the code
ReplyDeleteHi Rahul, Kindly can u share the code
ReplyDeleteThere are numerous sorts of exercise manuals all through the a wide range of forms of Microsoft Excel. Excel Expert near me
ReplyDeleteFirst and foremost, on the off chance that you are attempting to plan spreadsheets for distribution, the table arrangement can turn out to be extremely restricting. excel consultants near me
ReplyDeleteMike chose to compose books as he suspected he could contact a larger number of individuals this way rather than preparing individuals in classes. His first books turned out to be smash hits and his books have beaten blockbusters records from that point onward.placement cells database
ReplyDelete"Flexibility is key when granting bereavement leave. Grieving individuals may need different amounts of time off depending on their relationship with the deceased, cultural practices, and the emotional impact." How to use bereavement leave at Walmart Cincinnati
ReplyDelete