Different Query Mode in Edit List

I crunched one. This post is an addendum to one of my previous "Food for Thought" post where the main challenge was to display different columns in Query Mode when applet is displayed in Edit List Mode. with some configuration-Scripting-Luck i am able to achieve this scenario.

The key ingredient here is the usage of Dynamic Toggle. Following necessary steps are required to achieve desired solution.

1 - Create a clone of the list applet which should be displayed in Query Mode. Remove unnecessary Columns which are not required to be displayed while querying. Consider two applets are:
a) SR List Applet
b) SR Query List Applet

2 - Make the "SR Query List Applet" as the default applet to be displayed in the view.

3 - Create a calculated field in the Service Request BC with following values:
Name: QueryCalc
Value: IIF(GetProfileAttr('QueryMe') = 'Y','Y','N')

4 - Now create a dynamic toggle in the "SR Query List Applet". Set the "SR List Applet" as toggle applet with following Value in the condition.
Auto Toggle Field: QueryCalc
Auto Toggle Value: Y

5 - Once toggle is created, its time to set Profile Attribute. Following piece of code is required in below applets:
a) SR Query List Applet
Following script is written to toggle to SR List Applet.

function WebApplet_PreInvokeMethod (MethodName)
{
if(MethodName == "ExecuteQuery" || MethodName == "UndoQuery")
TheApplication().SetProfileAttr("QueryMe","Y"); //This is used to toggle back to Applet with More Fields
}

function WebApplet_Load ()
{
TheApplication().SetProfileAttr("QueryMe","Y"); //This is used to toggle back to Applet with More Fields
}

b) SR List Applet

In this applet we will create our own custom method and will invoke NewQuery.

function WebApplet_PreInvokeMethod (MethodName)
{
if(MethodName == "TestQuery") //Instead of Query We are calling our own custom method. Test Query
{
TheApplication().SetProfileAttr("QueryMe","N");
this.BusComp().SetSearchSpec("Id","");
this.BusComp().ExecuteQuery();
this.InvokeMethod("NewQuery");//New query is executed on the default applet in the view
return(CancelOperation);
}
}

The key here is to execute a blank query and then do New query so that the default applet in the View appears,i.e. the SR Query List Applet. Compile the objects and look out for super cool stuff. Siebel Rocks!!!

Disclaimer: There are caveats in this approach. This should be thoroulgy tested before you implement in your scenario.

Happy Crunching!!

תגובות

פוסטים פופולריים מהבלוג הזה

Profile Attributes and Open UI

SBL-BPR-00191: The rowId of the active row of the primary buscomp '%1', '%2', does not match the Primary Id

SBL-SVC-00150