Siebel Incentive Compensation Administration Guide > Configuring Incentive Compensation >

Adding a Transaction Record Using eScript


While the recommended approach to adding transaction records is to use the Incentive Compensation user interface, there may be times when automation is required for adding third party orders to Siebel Incentive Compensation. In this case, the following code will allow you to add a transaction to the Transaction Workbook.

Sub ButtonNew_Click

dim boICTXN as BusObject

dim bcICTXN as Buscomp

dim bcICTXNITEM as BusComp

dim assocPostnBC as BusComp

dim bcPROD as BusComp

set bcICTXN = TheApplication.ActiveBusComp

With bcICTXN

  ' Re-execute current query

  

  .ActivateField("Id")

  .ActivateField("Input Type")

  .ActivateField("Status")

  .ActivateField("Status Date")

  .ActivateField("Order Sales Team")

  .ActivateField("Order Type")

  .ActivateField("Order Date")

  

  .ClearToQuery

  .ExecuteQuery

  .FirstRecord

  

  .NewRecord NewAfter

  .SetFieldValue "Input Type", "System Add"

  .SetFieldValue "Status", "Booked"

  .SetFieldValue "Status Date", Date()

  ' Add a sales team member          

  set assocPostnBC = bcICTXN.GetMVGBusComp("Order Sales Team").GetAssocBusComp

  With assocPostnBC

    .ActivateField "Active Last Name"

    .SetSearchSpec "Active Last Name", "Conway"

    .ExecuteQuery ForwardOnly

    If .FirstRecord Then .Associate NewBefore

  End With

  Set assocPostnBC = Nothing

  ' Continue setting fields on new Txn Wkbk record

  .SetFieldValue "Order Type", "Sales Order"

  'Write Record

  .WriteRecord

  

  'Get row id of newly inserted record

  rowId = .GetFieldValue("Id")

  set boICTXN = TheApplication.GetBusObject("Incentive Compensation Transaction Workbook")

  set bcICTXNITEM = boICTXN.GetBusComp("Incentive Compensation Transaction Workbook Item")

  

  with bcICTXNITEM

  'Query for newly inserted Txn Wkbk record

  

  .ActivateField "Transaction Id"

  .ActivateField "Product Name"

  .ActivateField "Unit Price"

  .ClearToQuery

  .ExecuteQuery

  .FirstRecord

    ' Insert new transaction workbook detail record

    .NewRecord NewAfter

    .SetFieldValue "Transaction Id", rowId

    .SetFieldValue "Line Number", "1"

    .SetFieldValue "Quantity Requested", "1"

    .SetFieldValue "Unit Price", "10"            

    

    ' Set Product Field

    set bcPROD = bcICTXNITEM.GetPickListBusComp("Product Name")

    With bcPROD

      .ActivateField "Name"

      .ClearToQuery

      .SetSearchSpec "Name", "24 Months Contract"

      .ExecuteQuery

      If .FirstRecord then .Pick

    End With

    

      'Write Trans Detail record

    .WriteRecord

    Set bcPROD = Nothing

  

  End With ' bcICTXNITEM

End With 'bcICTXN

End Sub

Siebel Incentive Compensation Administration Guide