Tuesday 15 October 2019

Update Records in Siebel Scripts - Chat UI Business Service

Hello All,

Whenever we require to update a record we use Inbound Email Database Operations Business Service, but this BS has a major limitation if there are no records matching the search Specification it throws an error which is not desirable and requires us additional error handling.

Query Using Inbound Email Database Operations,

var sBusService = TheAppliation().GetService("Inbound E-mail Database Operations");
var Inputs = TheAppliation().NewPropertySet();
var Outputs = TheAppliation().NewPropertySet();
Inputs.SetProperty("BusComp", "Order Entry - Line Items");
Inputs.SetProperty("BusObj", "Order Entry (Sales)");
Inputs.SetProperty("QueryFields", "Id");
Inputs.SetProperty("ValueFields", "Order Header Id");
Outputs =  sBusService.InvokeMethod("FindRecord",Inputs);                                   

error returned , 

No record matching the search specification is found.(SBL-CMI-00122)

The Alternative ,

Chat UI Business Service's FindRecord method, this uses the same inputs and does not return any error in case no records are found.

var sBusService = TheAppliation().GetService("Chat UI Business Service");
var Inputs = TheAppliation().NewPropertySet();
var Outputs = TheAppliation().NewPropertySet();
Inputs.SetProperty("BusObj", "Order Entry (Sales)");
Inputs.SetProperty("BusComp", "FS Invoice");
Inputs.SetProperty("QueryFields","Order Id");
Inputs.SetProperty("Order Id", "1-3B39B13S_1");
Inputs.SetProperty("ValueFields","Invoice Number");`
Outputs =  sBusService.InvokeMethod("FindRecord",Inputs);                                               

Writing Output in XML file - EAI XML Write to File

Hello All,

I was working on a requirement where after performing a update action i needed to capture the records in a file for EOD verification.
There are multiple ways to achieve this, i used WritePropSet method of EAI XML Write to File Business service.

Approach 1: 
Use Property Set to store Output and call PropSetToXML method of EAI XML Converter Business Service , then call EAI XML Write to File Business service's WriteXMLHier method to get the final XML.

Approach 2: 
Use Property Sets to store data , in Hierarchical Format (i.e. create Property sets in a way to maintain Hierarchical structure), then call EAI XML Write to File Business service's WritePropSet method to get the final XML.

Final Code :

Storing Data in Outputs:

var outPropset1 = TheApplication().NewPropertySet() ;//for output logging
outPropset1.SetType("Processed Invoices") ;
outPropset1.SetValue("Invoice Number :"+sInvoiceNum) ;

Passing Output in EAI Write to File:

var timestamp = new Date();
var month = timestamp.getMonth() + 1;
timestamp=timestamp.getDate()+"-"+month+"-"+timestamp.getFullYear()+" "+timestamp.getHours()+":"+timestamp.getMinutes()+":"+timestamp.getSeconds();

var XMLConvertorBS = TheApplication().GetService("EAI XML Write to File");
var xInputs = TheApplication().NewPropertySet();
var xOutputs = TheApplication().NewPropertySet();


Final XML:

  <?xml version="1.0" encoding="UTF-8" ?>
  <?Siebel-Property-Set EscapeNames="true"?>
  <Processed Invoices>Invoice Number :81KHH66464</Processed Invoices>
  <Processed Invoices>Invoice Number :81KHH66465</Processed Invoices>
  <Processed Invoices>Invoice Number :81KHH66466</Processed Invoices>
  <Processed Invoices>Invoice Number :81KHH66467</Processed Invoices>

 more detailed ways of manipulating Property sets :


Deleting Multiple Records in Siebel Script

Hello All,

Recently i had a requirement wherein i wanted to delete some records in Script.
Its very simple but i was missing a very basic thing.


     FRecord = DeleteRecord();
    FRecord = NextRecord(); 

This script deleted only the first record not subsequent record, reason was just after deleting the records the cursor was set to First Record so NextRecord was not fetching any results.
Final Script required me to call FirstRecord again after performing DeleteRecord.

Working Code:

   ActivateField("Error Object");
   SetSearchSpec("Error Object", "Todays Failure");//Deallocate 0-D5B3
   var FRecord=FirstRecord();

FRecord = DeleteRecord();
    //This did the trick. The Cursor would always be reset to First record and the deletion went fine.


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...