Siebel::Integration::Com::BusComp - Abstraction of Siebel Business Component
use Siebel::Integration::Com; my $sa = Siebel::Integration::Com->new( ConnectionType=>'Thick', UserName=>$inputs{user}, PassWord=>$inputs{pass}, CFG=>$inputs{cfg}, DataSource=>$inputs{DataSource} ); #Query for and print employee's with logins containing ADMIN my @Fields = ('First Name','Last Name','Login Name'); #fields to activate and print my $BO = $sa->GetBusObject('Employee'); my $BC = $BO->GetBusComp('Employee'); $BC->ClearToQuery(); $BC->SetSearchExpr('[Login Name] LIKE "*ADMIN*"');#logins containing ADMIN $BC->SetViewMode('AllView');#all view mode constants can be used as strings or you can use the int value $BC->ActivateFields(@Fields); $BC->ExecuteQuery('ForwardOnly'); if($BC->FirstRecord()){ print "Record(s) Found\n"; do{ print "Id: " . $BC->GetFieldValue('Id') . "\t"; foreach my $field (@Fields){ print "$field: " . ($BC->GetFieldValue($field) // '') . "\t"; } print "\n"; }while($BC->NextRecord()); print "Record Limit Reached\n"; }else{ print "No Records Found\n"; } #Create a sys preference, then delete it my $BOPrefs = $sa->GetBusObject('System Preferences'); my $BCPrefs = $BOPrefs->GetBusComp('System Preferences'); if(!$BCPrefs->NewRecord('NewBefore')){ die print "New record failed: " . $BCPrefs->Error(); } $BCPrefs->SetFieldValue('Name','Test Pref'); $BCPrefs->SetFieldValue('Value','Test Pref Value'); $BCPrefs->WriteRecord(); my $PrefId = $BCPrefs->GetFieldValue('Id'); #Delete the sys preference, could just call delete since the record is still focused, but will query for the example. $BCPrefs->ClearToQuery(); $BCPrefs->SetSearchSpec('Id', $PrefId); $BCPrefs->ExecuteQuery('ForwardOnly'); if($BCPrefs->FirstRecord()){ if($BCPrefs->DeleteRecord()){ print "New Preference Record Deleted\n"; }else{ print "Delete failed: " . $BCPrefs->Error() . "\n"; } }else{ print "Can not find record to delete!\n"; } #Query for current user. Update the users title and associate a new position. If the position is already associated disassociate it my $BOEmp = $sa->GetBusObject('Employee'); my $BCEmp = $BOEmp->GetBusComp('Employee'); $BCEmp->ClearToQuery(); $BCEmp->SetViewMode('AllView'); $BCEmp->ActivateFields('Personal Title', 'First Name'); $BCEmp->SetSearchSpec('Login Name', $sa->LoginName());#query for current user $BCEmp->ExecuteQuery('ForwardOnly'); if($BCEmp->FirstRecord()){ my ($NewTitle); if($BCEmp->GetFieldValue('Personal Title') =~ /Mr/){#toggle users title between Mr, and Miss $NewTitle = 'Miss'; }else{ $NewTitle = 'Mr'; } print "Setting " . $BCEmp->GetFieldValue('First Name') . "'s title to $NewTitle\n"; my $PickTitleBC = $BCEmp->GetPicklistBusComp('Personal Title'); $PickTitleBC->ClearToQuery(); $PickTitleBC->SetSearchSpec('Value', $NewTitle); $PickTitleBC->SetViewMode('AllView'); $PickTitleBC->ExecuteQuery('ForwardOnly'); if($PickTitleBC->FirstRecord()){ if(!$PickTitleBC->Pick()){ print "Picking title failed: " . $PickTitleBC->Error(); }else{ $BCEmp->WriteRecord(); } }else{ print "Can not find title " . $NewTitle . " in the picklist BC\n"; } #associate proxy employee position, if already assosiated then remove. my $MVGBC = $BCEmp->GetMVGBusComp('Position Id'); #find out if Proxy position already associated, if found disassociate, if not found associate $MVGBC->ClearToQuery(); $MVGBC->SetSearchSpec('Id', '0-57T1J');#proxy employee $MVGBC->ExecuteQuery('ForwardOnly'); if($MVGBC->FirstRecord()){ $MVGBC->DeleteRecord(); print "Removed Proxy Employee\n"; }else{ my $AssocMVG = $MVGBC->GetAssocBusComp(); $AssocMVG->ClearToQuery(); $AssocMVG->SetSearchSpec('Id', '0-57T1J');#proxy employee $AssocMVG->ExecuteQuery('ForwardOnly'); if($AssocMVG->FirstRecord()){ if($AssocMVG->Associate('NewBefore')){ print "Associated Proxy position\n"; }else{ print "failed to associate Proxy position\n"; } }else{ print "Can not find proxy employee record!\n"; } } $BCEmp->WriteRecord(); }else{ print "Can not find employee record something is wrong!\n"; }
The Siebel::Integration::Com modules are designed to remove the different method calls and error checking between the COM Data Control and COM Data Server interfaces. Changing between the two interfaces only requires a change in the parameters to Siebel::Integration::Com->new() rather than a rewrite of all calls. Beyond just replicating the base functions of the interfaces it is hoped that additional methods will be added to these modules to extend the functionality provided by the Siebel COM framework.
All methods that have been exposed keep the same names so there is no additional learning curve, you can program in Perl using the same method names as eScript
Returns the error text for the last operation, returns '' if no error.
The ClearToQuery method clears the current query Returns 1 for success Returns undef for failure. A failure will set BC->Error
The SetViewMode method sets the visibility type This will accept the numbers as per Siebel or you can use a string version of the type SalesRepView => 0 ManagerView => 1 PersonalView => 2 AllView => 3 OrganizationView => 4 GroupView => 5 CatalogView => 6 SubOrganizationView => 7 Example: $bc->SetViewMode('AllView') is the same as $bc->SetViewMode(3), readability would be better served by AllView Returns 1 for success Returns undef for failure. A failure will set BC->Error
Activates a field so that the next query on the BC will return the fields value Returns 1 for success Returns undef for failure. A failure will set BC->Error
Activates an array of fields so that the next query on the BC will return the fields values Returns 1 for success Returns undef for failure. A failure will set BC->Error
Sets the search specification for the BC you can call this multiple times to setup your query Examples: BC->SetSearchSpec('Id', '0-1') BC->SetSearchSpec('Status', " <> 'New'") BC->SetSearchSpec('Status', "IS NULL") Returns 1 for success Returns undef for failure. A failure will set BC->Error
Sets the search expression for the BC Example: BC->SetSearchExpr('[Name] = "Bob"') Returns 1 for success Returns undef for failure. A failure will set BC->Error
Queries the BC based on your SearchSpec, SearchExpr and any other settings This will accept the numbers as per Siebel or you can use a string version of the type ForwardBackward => 0 ForwardOnly => 1 Example: $bc->ExecuteQuery('ForwardOnly') is the same as $bc->ExecuteQuery(1), readability would be better served by ForwardOnly Returns 1 for success Returns undef for failure. A failure will set BC->Error
Returns 1 if there is a record to focus or 0 if there is no record to focus on
Returns the field value. Returns undef for failure. A failure will set BC->Error
Sets the field value Returns 1 for success Returns undef for failure. A failure will set BC->Error
Returns the MVG business component releated to the input field
Sets the sort spec for the BC, See BUGS/LIMITATIONS this does not seem to work Returns 1 for success Returns undef for failure. A failure will set BC->Error
Deactivates all fields not explicity needed to form the SQL or set as force active in the BC
Queries the BC based on your SearchSpec, SearchExpr and any other settings This will accept the numbers as per Siebel or you can use a string version of the type ForwardBackward => 0 ForwardOnly => 1 Example: $bc->ExecuteQuery2('ForwardOnly', 1) is the same as $bc->ExecuteQuery2(1, 1), readability would be better served by ForwardOnly Returns 1 for success Returns undef for failure. A failure will set BC->Error The Thin and Thick clients expect different values for ignoreMaxCursorSize. The cover method will automaticly select the appropriate inputs to the underlying ExecuteQuery2 method possible inputs are 0, 1, true, false.
Returns a string that contains a field value that is in the same format that the Siebel client uses or undef if there was an error. A failure will set BC->Error
Rerurns the search related to the input name Returns undef for failure. A failure will set BC->Error
Sets a named search on the BC, this can not be overriden except using scripting Returns 1 for success Returns undef for failure. A failure will set BC->Error
Returns the full search expression for the BC Returns undef for failure. A failure will set BC->Error
Returns the search expression for the specified field only Returns undef for failure. A failure will set BC->Error
Returns the Sort Specification for the BC. See BUGS/LIMITATIONS this does not work for thin client connections Returns undef for failure. A failure will set BC->Error
Rerurns the view mode of the BC, this will be an integer number SalesRepView => 0 ManagerView => 1 PersonalView => 2 AllView => 3 OrganizationView => 4 GroupView => 5 CatalogView => 6 SubOrganizationView => 7 Returns undef for failure. A failure will set BC->Error
Allows you to start refining the query, use after ExecuteQuery when you do not wish to clear the existing Query information Returns 1 for success Returns undef for failure. A failure will set BC->Error
Returns a new Siebel::Integration::Com::BusComp Object
Reruns the BC name most useful with Pick, MVG and Assoc BC's where the name is not known at creation.
Returns the value of the user property. Do not confuse it with User Properties as defined in Siebel tools Returns undef for failure. A failure will set BC->Error
Sets a user property to the BC, this is effectivly a global variable. Do not confuse it with User Properties as defined in Siebel tools Returns 1 for success Returns undef for failure. A failure will set BC->Error
Invokes a method on the business component object Returns the result of the Method call if there is an error it sets BC->Error
Returns a new Siebel::Integration::Com::BusComp object based on the input fields picklist Business Component
Used on a picklist Business Component returned from GetPicklistBusComp to pick the selected record in to the parent Business Component Returns 1 for success Returns undef for failure. A failure will set BC->Error
Sets the field value using the local format Returns 1 for success Returns undef for failure. A failure will set BC->Error
Write changes to the database Returns 1 for success Returns undef for failure. A failure will set BC->Error
Delete the selected record and focus on the next record Returns 1 for success Returns undef for failure. A failure will set BC->Error
Returns a Siebel::Integration::Com::BusComp object. Called on a MVG Business Component to get the Associate Business Component. Query the Business Component returned from this call for the record you wish to associate to the base Business Component and then call the Associate method.
Called on an Associate Business Component as returned from GetAssocBusComp to associate the selected record to the base record Returns 1 for success Returns undef for failure. A failure will set BC->Error
Undo changes made to the Business Component Returns 1 for success Returns undef for failure. A failure will set BC->Error
Insert a new record Returns 1 for success Returns undef for failure. A failure will set BC->Error
Only called internally from Siebel::Integration::Com::BusObj->GetBusComp() Returns a Siebel::Integration::Com::BusComp object Sets BC->Error if an error occurs
See Siebel::Integration::Com
SetSortSpec, does not apear to work, need to prove this is the DLL. Maybe specific to Siebel version. GetSortSpec does not work on thin client, seems the DLL does not support it.
The documentation for Siebel::Integration::Com contains additional information
Oracle Help Business Component Methods
Kyle Mathers, <kyle.perl at mathersit.com>
<kyle.perl at mathersit.com>
The same as Siebel::Integration::Com
Version 0.02 March 2013
To install Siebel::Integration::Com, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Siebel::Integration::Com
CPAN shell
perl -MCPAN -e shell install Siebel::Integration::Com
For more information on module installation, please visit the detailed CPAN module installation guide.