Tuesday 19 May 2020

Attaching Multiple PR Files in a Applet : Siebel Open UI

Hello All,

This article explains how to tag multiple PR file with a single applet, by design we cannot tag multiple PR file to a Applet, this is Siebel Open UI Limitation.

Then how can we still tag multiple PR ??,  well this is very basic yet difficult to get in first try.

The Crux of the solution lies in Dependencies, i.e. the PR files usually extend their function and behavior from JQGridRenderer or PHYRenderer as shown in below files ,



So we have to pass our 2nd PR File name here in Place of JQGridRenderer in 1st PR File, and 2nd PR file will have the normal syntax.

PR1:

Will have PR2 as its dependency, so when PR1 is Loaded it will automatically Load PR2.








PR2: 

Will have normal structure of extending JQGridRenderer.









Now we need to make entries for Both PR files in Manifest Files, and tag only PR1 with the Applet in Manifest Administration and it will do the work.

Oracle Doc mentioning the issue and suggested Solution

https://drive.google.com/open?id=1Q3z6FCc6aiDsI9eqvG0TxWVUSfneTc36

Try this and let me know in case of any issues.

Monday 11 May 2020

MVG in Siebel : Association and Disassociation

Hello All,

This post is in continuation of my previous post http://www.siebelfoundations.com/2020/05/record-association-and-disassociation.html , Association and Disassociation in MVG applet.

So if the case arise wherein we have to write script of parent BC not the MVG BC. i.e. a case where Order is parent and Voucher is MVG BC, we have to write script on Order.

For Association of Records

The Steps are very simple.

1. Instantiate the Current BC (Order in this case)
2. Get MVG Bus comp from the field on which MVG is based
3. Get Assoc Bus comp from the MVG Bus Comp
4. Specify the search on the Assoc Bus comp
5. Trigger Associate Event


//Add Record in MVG -- Initiate BC - Get MVG BC from Field - Get Assoc BC - Fire Search Spec and Associate

var oNumber = "1-12345TXN";
var oBusObject = TheApplication().ActiveBusObject();
var oBusComp = oBusObject.GetBusComp("Order Entry - Orders");
with(oBusComp)
{
ActivateField("Voucher Number");
SetViewMode(AllView);
ClearToQuery();
SetSearchSpec("Order Number",oNumber);
ExecuteQuery(ForwardBackward);
if(FirstRecord())
{
var oMVGBuscomp = GetMVGBusComp("Voucher Number");
var oAssocBusComp = oMVGBuscomp.GetAssocBusComp();
with(oAssocBusComp)
{
ActivateField("Order Number");
ActivateField("Voucher Expiry Date");
ClearToQuery();
var expr = "[Order Number] = '"+oNumber+"' AND [Voucher Expiry Date] >= Today()";
SetSearchExpr(expr);
ExecuteQuery(ForwardBackward);
var isRec = FirstRecord();
while(isRec != "")
{
Associate(NewBefore);
isRec = NextRecord();
}
}
}
}

In case of deleting record from MVG 

The Steps are very simple.

1. Instantiate the Current BC (Order in this case)
2. Get MVG Bus comp from the field on which MVG is based
3. Specify the search and till no records left
5. Delete record


////Delete from MVG -- Initiate BC - Get MVG BC from Field  - Delete Record from MVG
var oNumber = "1-12345TXN";
var oBusObject = TheApplication().ActiveBusObject();
var oBusComp = oBusObject.GetBusComp("Order Entry - Orders");
with(oBusComp)
{
ActivateField("Voucher Number");
SetViewMode(AllView);
ClearToQuery();
SetSearchSpec("Order Number",oNumber);
ExecuteQuery(ForwardBackward);
if(FirstRecord())
{
var oMVGBuscomp = GetMVGBusComp("Voucher Number");
with(oMVGBuscomp)
{
ClearToQuery();
ExecuteQuery(ForwardBackward);
var rec = FirstRecord();
while (rec)
{
DeleteRecord();
rec = FirstRecord();
}
}
}
}

Here in this case we delete record from MVG Bus comp instance.

Tuesday 5 May 2020

Record Association and Disassociation in Siebel : MVG Applets

Hello All,

We have many time worked wth MVG Applets, where 2 Applets opens in Form of Shuttle applet.
The one of left is Associate applet and Right is MVG Applet.

When we Move record from Assoc to MVG is called Association, and Removing/Deleting from MVG is called Disassociation.



Recently i had a requirement wherein i had to perform Association, and update some field in Asso BC to keep some check
i.e. Suppose we are associating a custom entity "Vouchers" with a Account, and once we associate the Voucher we want to update a field in Voucher say Account Name, so that it does not appear again in Assoc list to prevent it from multiple tagging

and the same way we wanted to Nullify the Field, Account Name on the Voucher when Disassociation happen.

Choosing the Events:

Association triggers Associate Event of Corresponding Business Component, so update a field value of assoc BC when Association happen we will have to write script in Associate Event.


function BusComp_Associate ()
{
var AccNum = this.ParentBusComp().GetFieldValue("CSN Number");//to get the field in corresponging parent BC
ActivateField("Account Number"); 
SetFieldValue("Account Number", AccNum);       
WriteRecord(); 

}

There is no such event Disassociate in siebel, rather DeleteRecord is triggered when Disassociation occurs, so to remove the field value we can use Delete event.
I am using preDelete event, to make my code run before the record is deleted.

function BusComp_PreDeleteRecord ()
{
ActivateField("Account Number"); 
SetFieldValue("Account Number", ""); 
WriteRecord(); 
return (ContinueOperation);
}

we will explore how to associate/disassociate from different BC, in our next post

Monday 4 May 2020

Navigation One Record at a time in Siebel IP17/18 : Part 2

Hello All,

In my previous post we modified the navigation behavior of Siebel IP 17 to navigate single record at a time,
but there was one miss with this, pointed by one of the reader. The Icons for navigation were always highlighted i.e. irrespective of being on last record next record icon was highlighted.



so to achieve this i have made some change ,

The logic is , we need to disable or enable button based on CanInvoke result of Methods, below code does the trick ,

function disableIcons ()
{
if ( pm.ExecuteMethod("CanInvokeMethod", "GotoNext") == false) {
$("#" + appletFullId).find($('.ui-icon-seek-next')).addClass('ui-state-disabled');
}
else {
$("#" + appletFullId).find($('.ui-icon-seek-next')).removeClass('ui-state-disabled');
}
if (pm.ExecuteMethod("CanInvokeMethod", "GotoPrevious") == false) {
$("#" + appletFullId).find($('.ui-icon-seek-prev')).addClass('ui-state-disabled');
}
else {
var a = pm.ExecuteMethod("CanInvokeMethod", "GotoPrevious");
$("#" + appletFullId).find($('.ui-icon-seek-prev')).removeClass('ui-state-disabled');
}
if (pm.ExecuteMethod("CanInvokeMethod", "GotoPreviousSet")== false) {
$("#" + appletFullId).find($('.ui-icon-seek-first')).addClass('ui-state-disabled');
}
else {
$("#" + appletFullId).find($('.ui-icon-seek-first')).removeClass('ui-state-disabled');
}
if (pm.ExecuteMethod("CanInvokeMethod", "GotoNextSet")== false) {
$("#" + appletFullId).find($('.ui-icon-seek-end')).addClass('ui-state-disabled');
}
else{
$("#" + appletFullId).find($('.ui-icon-seek-end')).removeClass('ui-state-disabled');
}
}

and the updated PR file can be Taken from the Drive link.


https://drive.google.com/open?id=1R_gOJjjIWhU-8IoTMKm2YxckyD_Xd3Tr

Sunday 3 May 2020

Improving Siebel Dashboard Part 2: Using Siebel Open UI

Hello All,

Siebel has a very obsolete Homepage/Dashboard with outdated Calendars and Applets appearing on Homepage,  so is there a way we can improve siebel dashboard to make it par with the latest products available ?

Well yes, we can achieve this using the Open UI Framework and can include Charts, Graphs , Timeline etc to give it a rich and modern look.













The Code to get this Done, well the code is pretty simple to set the context please go through the W3  School Link, this will give a basic idea of How to use Google charts and then we will only have to pass Siebel data to Chart Object.

https://www.w3schools.com/howto/howto_google_charts.asp

Siebel Code, I am writing the sample code in postload.js file for reference, you can write in any Applet or View PR.


if (typeof(SiebelAppFacade.Postload) == "undefined") {
Namespace('SiebelAppFacade.Postload');
// need to pass the JS file here or in Script tag, either the URL or Make an entry in Manifest file and register it
//define("Postload", ["https://www.gstatic.com/charts/loader.js"],
function ()
{
 SiebelApp.EventManager.addListner("postload", OnPostload, this);
function OnPostload( ){         
try{       
//Invoking 3rd party script for charts rendering 
var script = '<script type="text/javascript" src="http://www.gstatic.com/charts/loader.js"></script>';
var a = '<div id="piechart"></div>'; $('#_sweclient').append(a);
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
// Draw the chart and set the chart values , need to pass values from Siebel i am using the value from W3 School as example 
function drawChart() {
  var data = google.visualization.arrayToDataTable([
  ['Task', 'Hours per Day'],
  ['Work', 8],
  ['Eat', 2],
  ['TV', 4],
  ['Gym', 2],
  ['Sleep', 8]
]);
  // Optional; add a title and set the width and height of the chart
  var options = {'title':'My Average Day', 'width':550, 'height':400};
  // Display the chart inside the <div> element with id="piechart"
  var chart = new google.visualization.PieChart(document.getElementById("piechart"));
  chart.draw(data, options);}

            }
            catch(error)
            {
                //No-Op
            }
        }
}());
}

For more information of Charts available please refer,  https://developers.google.com/chart/interactive/docs/gallery

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