Thursday, July 29, 2010

Defined()

Most of us might be aware of this function but i came it across quite recently. There can be multiple scenarios in scripting where we need to check whether any variable is defined in the code or not. Defined() method does the trick here. This can come handy before you nullify any object. More of this function details are available on support web.

Basic Syntax is

defined(AnyVariable)

Output: returns True/False based on whether Object/variable is defined or not.


Example Usage:

if(defined(sAccountBO)
sAccountBO = null;

Tuesday, July 27, 2010

Mapped List Columns/Controls

As the chineese saying go "Ink is better than the best memory", documentation is key to success for any project.

UIS,LLD, HLD are generally part of Document deliverables. We will not discuss these specs here rather this blog will focus more on getting extract from siebel tools for future reference.

This tip may be useful for LLD spec. For most of the objects siebel gives direct export from tools. But consider a scenario when you want export of columns/controls which are mapped to applets. Direct export from list Columns or controls will give you all columns available in the applet and not the mapped one. An export from applet Web Template item will only give columns which are mapped but not the other desired properties like pickapplet or mvg applet.
Following SQL will help to extract list columns which are mapped to list applet in edit list mode. Anybody can change the name of Applet in the query for which columns need to be extracted.

select
D.NAME,
D.AVAILABLE_FLG,
D.DISPLAYFORMAT,
D.FIELD_NAME,
D.HTML_TYPE,
D.MVG_APPLET_NAME,
D.PICK_APPLET_NAME,
D.CHECKBITMAP,
D.COMMENTS,
D.READONLY,
D.RUNTIME_FLG,
D.VISIBLE
From
siebel.S_APPL_WTMPL_IT A,
siebel.S_APPL_WEB_TMPL B,
siebel.S_APPLET C,
siebel.S_LIST_COLUMN D,
siebel.S_LIST E
where
A.APPL_WEB_TMPL_ID = B.ROW_ID AND
B.APPLET_ID = C.ROW_ID AND
D.NAME = A.CTRL_NAME AND
E.ROW_ID = D.LIST_ID AND
E.APPLET_ID = B.APPLET_ID AND
C.NAME = 'Employee List Applet' AND -- Applet name
B.NAME= 'Edit List'; -- Base or Edit List Mode
OUTPUT TO employee_List_Column.csv

Following SQL will help to extract Controls which are mapped to Form Applet in edit mode. Applet name can be changed in order get desired output.
select
D.NAME,
D.FIELD_NAME,
D.HTML_TYPE,
D.MVG_APPLET_NAME,
D.PICK_APPLET_NAME,
D.COMMENTS,
D.READONLY,
D.RUNTIME_FLG
From
siebel.S_APPL_WTMPL_IT A,
siebel.S_APPL_WEB_TMPL B,
siebel.S_APPLET C,
siebel.S_CONTROL D,
where
A.APPL_WEB_TMPL_ID = B.ROW_ID AND
B.APPLET_ID = C.ROW_ID AND
D.NAME = A.CTRL_NAME AND
D.APPLET_ID = B.APPLET_ID AND
C.NAME = 'Case Form Applet' AND -- Applet name for which extract is required
B.NAME= 'Edit'; -- Edit Mode
OUTPUT TO Case_control.csv

This sql should be run on local databse using dbisql utility and could be fine tuned for columns which are desired in UIS.


Ink is truly, better than the best memory.

Monday, July 26, 2010

Implicit Printing

There are certain scenarios when user may request for printing of reports without opening the report when the report content is quite huge on click of button.I was not able to find any OOB business service which prints BIP report on client machine. There is business service for actuate report that does printing task but that can't be used for BIP reports. One of the alternate way to print BIP reports without opening them is to fetch content of report in the code using shell and fire verbex print. Please find below the code snippet to achieve this. This can be used for silent printing for any document.

function WebApplet_PreInvokeMethod (MethodName)
{
if(MethodName == "Printer")
{
var TargetFolder = "D:\Program Files\Siebel8\Files"; //This is the folder name where report document is kept
var oShell = COMCreateObject("Shell.Application"); //Creating Shell
var objFolder = oShell.Namespace(TargetFolder);
var objItem = objFolder.ParseName("AccountListReport.rtf"); //Name of the document to print
objItem.InvokeVerbEx("Print") // Print without opening the document
return(CancelOperation);
}
return (ContinueOperation);
}

The key here is InvokeVerbx method. The Shell object has a method called InvokeVerbEx that allow us perform the tasks that show up when we do right-click a file in Windows Explorer. Following options could be used with this method Open, Print, Edit, Cut, Copy, Delete, etc. The Shell object allows us to perform all those tasks programmatically.

Happy Printing!!

Sunday, July 25, 2010

HasViewResponsibility

Not more than often it is required to find whether logged in user has access to any particular view. Siebel gives us a vanilla business service which returns "T" if user has access to any particular view or returns "F" it doesn't have access to that view.
Details of business service are :

Business Service Name: Mobile Device
Method: HasViewResponsibility

Input Arg: PersonId
Input Arg: View
Output Arg: HasViewResponsibility

PersonId is the rowid of the user under question. View is the name of the view to be checked. T or F is returned as output in HasViewResponsibility argument.

System Preferences

Configurable system is need of any project and for that "System Preferences" can be real gold diggers. System Preferences if used properly could be as effective as LOV's giving, sometimes more,flexibility then LOV's. By its own Siebel gives lot of system preferences values which helps in governing the siebel behavior.

LOV's are first choice when one think of having a dynamic system where values can be changed on runtime without server restart or doing an extra srf push. But LOV's do have there own length limitations. You can't have display value more than 30 characters. Here we will discuss some the commonly used OOB system preferences available and how we can best use System Preferences for our requirements.

Suppress Scripting Error Code: With due respect to configuration lovers, Scripting is something which can't be avoided in any project. As a result Error handling becomes an integral part of any code. This system preference could be used to suppress error codes which are appended to user defined errors in scripts.

ReportEngineType: This is used to control type of reports Report Icon will display. It can be "ACTUATE" for actuate reports, "BIP" for bip reports or "BOTH" for both reports type.

Technical Support (URL): This hosts the URL for technical Support

Technical Support (Voice): This hosts phone number for technical Support

Technical Support (FAX): This hosts fax number for technical Support

Quick Print Application: This preference determines which option to be used for Quick Print. HTML and EXCEL are two allowed options.

Quick Print Output Format: Formats supported are HTML, CSV, or Tab

Apart from these there are number of other system preferences available for UCM and Marketing Management. Now as compared to LOV's System Preferences allow us to host any value upto 100 characters. You can create your own system preference and set its value as desired upto 100 characters. It can be useful in scenarios where you have to keep path of filename which has to be dynamic. The following OOB business service could be used to retrieve system prefernces in workflow/Business/service.

Business Service: PRM ANI Utility Service
Business Service Method: GetSystemPreference
Method Arg
Input Arg: System Preference Name
Output Arg: System Preference Value

Lets make configurable and flexible systems.

Thursday, July 22, 2010

Siebel Encryption

Encryption is one term which gives you goosebump no matter what your mood is. There are many scenarios which involves data movement across multiple system using web services, http adapters or queues. Security remains a concern whichever option you go for and if data is related to real time transaction number or payment number then it becomes extremely important that data is encrypted while travelling across the system.

There was one of the requirements which involved encrypted and unique number generation so that new number couldn’t be guessed by looking at existing values. I tried to find any OOB business service that siebel might provide in order to encrypt data while sending to external system but unfortunately I was not able to found any OOB user property or any business service which could do trick for me. However I found Some Field level user Properties which does encyption of field while storing in database and while rendering that field is decrypted back. Encrypt Key Field and Encrypt Service Name are two user properties which does the encryption but it was not relevant in context as I needed data to be encrypted when I send that to external system. We will discuss these encryption user properties in later post.


Now coming back to original requirement as per need data which we send to external system should be in encrypted and unique in some format . There could be multiple ways to achieve this. One can write business service using Base 64 algorithm or his own algorithm to encrypt data and generate unique value but anybody knowing that alogrithm could decode the output value. After some analysis we found there is one utility that comes with siebel itself which encrypts any string and generates unique and encrypted string. Generally this is used to generate encrypted user passwords for cfg files. This utility is located under “/u01/app/siebel/product/8.0.0/siebsrvr/bin/encryptstring”. One can make use of this utility in business service to generate random encrypted unique code. Beauty of this utility is everytime it generates unique output value for the same input value. However all good things with some price. The disadvantage is siebel has not published the algorithm which is used to generate the output value so the encrypted random value which we get as output can’t be decrypted back to original value.

Tuesday, July 20, 2010

SWEPersonalizationGotoview


Many of us have used “SWEPersonalizationGotoview” function during our projects. In my current project I came across an interesting requirement for the application home page/landing page. The requirement was to display count of open activities for the logged in user on application home page and when user clicks on that count he should be navigated to the My activities view and only open activities should be displayed in that. But when user directly clicks on My activities view he should see all records.


There could be multiple ways to achieve this but idea which we implemented is to use “GetNumBCRows” to count number of records and “SWEPersonalizationGotoview” function in the personalization rule to go to destination view. The challenge here was to restrict the records while navigating from home page to My Activities view on click of count. The catch here is to set some profile attribute on click and based on its value to apply filter on “My Activities” View. After some analysis I found that “SWEPersonalizationGotoview” is defined in “swecommon_top.js” file under “\Siebel\8.0\web client\PUBLIC\enu\20405\SCRIPTS” directory. I modified “SWEPersonalizationGotoview” function to set the profile attribute whenever user clicked on count. This Profile attribute was used to control searchspec in “My Activities” view using personalization rules and was reset using runtime event “ViewActivated” back to null.

It gave me immense ease to dynamically control the filter criteria without having multiple My Activities view. Probably it will also benefit other readers in projects to implement such scenarios.