FirstSelected Method for a Business Component

The FirstSelected method makes the first record of the multiple selection in a business component active. It also calls any associated events. It returns the same information as the FirstRecord method. For more information, see FirstRecord Method for a Business Component.

Format

BusComp.FirstSelected

No arguments are available.

Used With

COM Data Server, Server Script

Examples

The following examples use the FirstSelected method and the NextSelected method to allow you to customize multirecord deletion. If the user clicks a custom button in an applet, then Siebel CRM can call this code and it can call the Delete Selected custom method.

The following example is in Siebel eScript:

function BusComp_PreInvokeMethod (MethodName)
{
   if (MethodName == "Delete Selected")
   {
      with (this)
      {
         var iRecord = FirstSelected();

         while (iRecord)
         {
            DeleteRecord();
            iRecord = NextSelected();
         }

      }

      return (CancelOperation);
   }

   return (ContinueOperation);
}

The following example is in Siebel VB:

Function BusComp_PreInvokeMethod (MethodName As String) As Integer

   Dim iRtn As Integer

   iRtn = ContinueOperation
   If MethodName = "Delete Selected" Then

      With me
         Dim iRecord As Integer

         iRecord = .FirstSelected

         While iRecord
            .DeleteRecord
            iRecord = .NextSelected
         Wend

      End With

      iRtn = CancelOperation

   End If

   BusComp_PreInvokeMethod = iRtn
End Function