Tuesday, September 22, 2009

Capture Drilldown based on Field

Recently, I come across arequirement where We need to set perform some operation before a user drilldown on field in a List Applet.

Vanilla provides a method Drilldown at applet level which can be captured.
There is no way specified in bookshelf whcih can determine that on which field drilldown has occured.

The problem here is if there are more than one drilldown list column in applet, click on any of them will triger the operatio we need to do.
We have thought to use Application Pre Navigate event but the Drilldown view could also be accessible from normal navigation. The operation ill get performed that tiem also. There will be an overhead code at Application level.

The WOrkaround to the problem is to use the SWEField property passed to the Applet PreInvoke propertyset gives the Id specific to the drilldown field . This value has a specific format which changes from list column to list column and record to record.

For example, in “INS Claims List Applet”:

Claim Number field’s first record on applet will have SWEField value “s_1_2_33_0” while the second will have “s_1_2_33_1” and so on
Assign To field’s first record on applet will have SWEField value “s_1_2_93_0” while the second will have “s_1_2_93_1”.

We can find Control Id for a list column and use the same for condition check as below.

function Applet_PreInvokeMethod (name, inputPropSet)
{
if(name == "Drilldown")
{
//Get SWEField property value
var SWEFieldParts = inputPropSet.GetProperty("SWEField");

// Find last occurrence of “_”
var sLastIndex = SWEFieldParts.lastIndexOf("_");

// Get the Control Id of a list column
var sControlId = SWEFieldParts.substring("0", sLastIndex);

if (sControlId == "s_1_2_33")
{
// Business logic

return ("CancelOperation");
}
}
return ("ContinueOperation");
}

Sharing is the Power

9 comments:

  1. Hi Ankit,
    Will this work even if column order is altered by users?

    ReplyDelete
  2. Yes, if column order are shuffled, it will work. I am not sure only if in case Merge are done on the Applet Object.

    ReplyDelete
  3. This is really good information... thanks for sharing...

    ReplyDelete
  4. if (sControlId == "s_1_2_33")
    {
    // Business logic



    How can i get the value of SWEField for a particular field list colum. (hw did u get value of SWEfield used In above if statement.

    ReplyDelete
  5. for each field on list applet when drilldown happens,the method invokes is 'Dilldown', but the value for inputPropSet.GetProperty("SWEField") is different.
    so first time , using raise error text or alert, you need to get that value and then put into the code.

    ReplyDelete
  6. Quick question.. what version siebel have this information? Drilldown is a deprecated method in Siebel 7.8, however we can fool siebel script by checking the method name as "Drill" + "down" :). But my issue is that for Applet_PreInvoke method I see only one argument, the MethodName. Does anyone how to achieve the same in Siebel 7.8?

    ReplyDelete
  7. figured it!! You should write this in browser scripts.. and no where in the thread this was mentioned!

    ReplyDelete
  8. if we add new column, sControlId will change.. den in that case.. how it works??

    ReplyDelete
  9. hello, hope you can reply to my question. I notice my ID keeps changing. first try -> s_2_2_47, then second try - > s_1_2_47. and it only happens to 1 applet. every other applet works fine. I am very confused

    ReplyDelete