How to generate Siebel Deep Links

What are Deep Links?
Deep linking, on the World Wide Web, is making a hyperlink that points to a specific page or image on another website, instead of that website's main or home page. Such links are called deep links.

In Siebel terms, its a direct link to a particular Record in a particular View. For e.g. if you want to navigate to an account in the My Accounts List View directly when logging in then you can use a deep link for it.

Below is an example of a Deep Link to Siebel.
http://zapmysiebel:8080/fins_enu/start.swe?SWECmd=GotoView&SWEView=My+Accounts+List+View&SWERF=1&SWEHo=zapmysiebel&SWEBU=1&SWEApplet0=My+Account+List+Applet&SWERowId0=1-6D8D

Now lets split this URL and see whats inside this.

Part 1: http://zapmysiebel:8080/fins_enu/start.swe?
This is your siebel application URL with the webserver, port number and siebel application details.

Part 2: SWECmd=GotoView
Now this is a command to siebel as to what action needs to performed when you are logged in, GotoView tells Siebel to Go To the View provided in the SWEView parameter. This parameter takes different values like Execute, Query and NewRecord. All this depends on what you want the application to do, if you are using some of the above SWECmd values then you might have to use the eai_enu URL(Will be posting a an article about how to use HTTP post methods and executing WF).

Part 3: SWEView=My+Accounts+List+View
This is just straight forward, as described above this parameter must have the view you want to navigate with each space being replaced by a "+" symbol.

Part 4:SWERF=1, SWEHo=zapmysiebel, SWEBU=1
These 3 parameters are some mandatory parameters like the hostname etc.

Part 5: SWEApplet0=My+Account+List+Applet
This parameter provides the Name of the Main Applet in the view separated by a "+" for every space, similar to the View Name

Part 6: SWERowId0=1-6D8D
The last part defines which record to display. With the value being the ROW_ID of the Record.

You can either use the above sample and tweek it to generate a Deep Link for your application i.e. by changing the Server Name, View Name, Applet Name etc or by letting Siebel generate it for you.

To generate the URL directly from Application follow the below steps.
Login to your siebel aplication. Navigate to any particular List View. Select any record. While holding the mouse boutton, drag and drop the record from the application to your desktop. Make sure your dektop is visible when your siebel application is open.


If your main applet is a form applet (i.e. for .e.g. a Detail View) then generate the deep link to the list applet and just replace the applet name and view name as per your requirement.

The best use of Deep Links are in Emails. When you send out notification emails to users, you can provide a deep link for the particular record for which the notification was sent. To do this just make Row Id Value dynamic.

Note: More on Rich HTML emails will be coming your way in the next few posts.

Use Deep Links in your applications and you would have Zapped your Siebel!!!

Generate GUID's in Siebel

What are GUIDs?
GUIDs or Global Unique Identifiers are Unique IDs generated in software applications to uniquely identify any particular entity. Row Ids are unique across a Siebel environment hence cannot be used as a unique identfier when integrating with other applications, the GUIDs are unique globally.

To generate a GUID, the following Business Service can be used.

Business Service: FINS Teller Converter Extensions
Method: GenerateID

Inputs: IDType Value: GUID
Outputs: GUID in the PropertySet Value

Code:

Input.SetProperty("IDType", "GUID");
bsTeller = TheApplication().GetService("FINS Teller Converter Extensions");
bsTeller.InvokeMethod("GenerateID", Input, Output);
GUIDValue = Output.GetValue();


Sample GUIDs: B5065590-930E-11DE-A110-00212837A7C6, B5065591-930E-11DE-A110-00212837A7C6


Use the above Business Service to Generate GUID and you would have Zapped your Siebel!

Invoke a Business Service from a Calculated Field

To invoke a Business Service from Calculated field put the following in the Calculated Value attribute
InvokeServiceMethod("BusServName","MethodName","InputPropertyName=InputPropertyValue","OutputPropertyName")

eg: InvokeServiceMethod("Workflow Process Manager","RunProcess","ProcessName=CountChildWF",”Count")

The above example invokes RunProcess method of Workflow Process Manager Business Service with Input as ProcessName and output as Count. Now in this example we would also need to pass the Id of the record. To pass field values as input we need to use eval().

eg: InvokeServiceMethod("Workflow Process Manager","RunProcess",”RowId=eval([Id])”,"ProcessName=CountChildWF",”Count")

Note: Do not use this feature in a List Applet, It could lead to performance issues as the Business Service would be triggered Multiple times.

Use the above trick and you would have Zapped your Siebel!

How to Invoke ShowPopup using Script

There are lot of posts about how to use ShowPopup and invoking it through configuration. Almost all the post say that showpopup cannot be invoke through scripting. This isnt completely true. I was going through the support web when I found a page about how to invoke popup applet using browser side scripting.

The Doc Id ID 812853.1. I am just pasting the code section of the Support web Document here.

function Applet_PreInvokeMethod (name, inputPropSet)
{
if (name == "MyShowPopup")
{
// invoke the ShowPopup applet method
var psIn2 = theApplication().NewPropertySet();
var psOut2 = theApplication().NewPropertySet();
psIn2.SetProperty("SWEMethod","ShowPopup");
psIn2.SetProperty("SWESP","true");
psIn2.SetProperty("SWEView","Order Entry - Line Items View (Sales)") ;
psIn2.SetProperty("SWEApplet","Order Entry - Line Item List Applet (Sales)") ;
psIn2.SetProperty("SWETA","Product Popup Applet");
psIn2.SetProperty("SWEM","Edit List");
psOut2 = this.InvokeMethod("ShowPopup",psIn2);
return ("CancelOperation");
}


If we try to invoke the ShowPopup from a server side script. We would be getting the below error.

Method 'ShowPopup' requires a value for argument 'SWETA'.(SBL-UIF-00355)

Note from Siebel: To open Popup applet, please note that the method "ShowPopup" is a specialized method that cannot be accessed via script.
i.e. if something screws up, niether the Author nor Siebel is responsible...:-)

Use the above code and you would have Zapped your Siebel!!!

How to use showpopup method for required fields

This is the first post for this blog. To start with I have picked a topic which is most ignored feature of Siebel. The showpopup method.

In one of the projects that I worked upon, we had a requirement to invoke a popup window on a button click. Nah! it wasnt that a simple requirement. I know requirements are never simple. But when we delivered this requirement as requested, the client was really happy(they always are...:-)...ain't they?). The details of the requirement are as descibed below.

Requirement: On a button click, call a particular interface to send a message to an external system but a few field values are required while sending the request to this external system.

Normally we write a script to getfield the values and then do a raise error text to show an alert. But this isnt a user friendly approach. Once the user sees the error, they need to navigate to the appropriate field; fill in the values and then click again and again untill all the values are provided.

Instead, we took a different approach. The design was to check if the field values are populated, if they are not then invoke a window with the popup applet having just fields that are required and ask the user to fill in the required field values. Once the user fills in the field values, go ahead with the interface call.

Detailed design.
1. Create a new control as MiniButton and place the control on the parent applet. The method invoked must be "ShowPopup".

2. Create the Control User Properties for the inputs to the ShowPopup method.
Name: Popup Value: (Popup Applet Name)
Name: Mode Value: (like Base, Edit etc...default is Base mode)


3. Create a new popup applet. I am not going into details of the popup applet. Its same as any other applet. Just keep in mind to have the class as "CSSSWEFramePopup" and the Height and Width as per your requirement. Also this popup applet must contain only those fields that are required for the interface call.

4. Now write a script to make the Interface Call button enabled i.e. CanInvoke to "True" in the parent applet.

WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
if(MethodName == "ShowPopup")
{
CanInvoke = "TRUE";
return (CancelOperation);
}
return (ContinueOperation);
}

5. Now the meat of the design. Write a code in the preinvoke method of the parent applet to check if the required fields for Interface call are available or not.

function WebApplet_PreInvokeMethod (MethodName)
{
if(MethodName == "ShowPopup")
{
var lFieldVal = this.BusComp().GetFieldValue("Some Field");
if (lFieldVal != null && lFieldVal != "")
{
CallInterface();
return (CancelOperation);
}
}
return (ContinueOperation);
}

What happens in the above code is, it checks for the field value and if the value is populated then it calls the interface function and does a canceloperation. This will not invoke the popup applet as the operation is cancelled. Whereas if the field doesnt have a value then it will continue with the normal Siebel operation and show the popup window.

6. The last step is some configuration and few lines of script in the popup applet. Add a control in the Popup Applet with the name "Ok' and method "CloseApplet". This button is to close the applet.

Finally add the following code in the invoke method of the popup applet.

function WebApplet_InvokeMethod (MethodName)
{
if(MethodName == "CloseApplet")
{
var lFieldVal = this.BusComp().GetFieldValue("Some Field");
if (lFieldVal != null && lFieldVal != "")
{
CallInterface();
}
else
{
TheApplication().RaiseError("This field is required");
}
}
}

Note: In this requirement the popup applet and parent applet are based on the same BC. You can experiment with other BC's as well like if we have the child BC fields required.

Compile both the applets and Voila you would have Zapped your Siebel!!!