Search code examples
siebel

Delete All records in a Siebel List View


I need to Delete All the records in a list applet by a button clicked method. In order to achieve this, I have added a button to the list applet with "DeleteAllRecords" method and added a script to BC PreInvokeMethod function as below. Once clicked on the button all the records will get deleted, but the applet won't get refreshed. How Can I achieve that?

try
    {
    if(MethodName == "DeleteAllRecords")
    {
                var EmpBO = TheApplication().GetBusObject("XXXX");
                var EmpBC = EmpBO.GetBusComp("XXXX");
                
                with(EmpBC)
                {
                    SetViewMode(AllView);
                    ActivateField("EmployeeID");
                    ClearToQuery();
                    SetSearchExpr("[XXXX] <> ' '");
                    ExecuteQuery(ForwardOnly);
        
                    var Frecord = FirstRecord();
    
                    while(Frecord)
                    {   
                        Frecord = DeleteRecord();
                        Frecord = FirstRecord();
                    }
                }
                //BC.InvokeMethod("RefreshBuscomp");
                return (CancelOperation);

    }
    }       
    catch(e)
    {
        throw(e);
    }
    finally
    {
        EmpBO = null;
        EmpBC = null;
    }

    return (ContinueOperation);

Solution

  • You could try a few things. 1: A simple null query in the end after all deletions are done. ClearToQuery() and ExecuteQuery(); 2: There is a BC method for RefreshBusComp (check documentation) which can be used with InvokeMethod(). Does pretty much the same thing as 1. I see you already tried it and probably did not work.

    3: There are Business services which can refresh applets , like FINS Teller UI navigation.

    4: You could also try a null query in browserscript/javascript, put that in InvokeMethod, so that it runs after the BC escript. Genb has to be run to generate bscripts.

    One of these should work .