Article Details
Id:12071
Product:finPOWER Connect
Type:NEW
Version:2.01.01
Opened:16/07/2014
Closed:22/07/2014
Released:31/07/2014
Job: J013641

Page Sets; Can now run an Action Script

A new method, psh.ExecuteActionScript() has been added to the Page Set Handler to allow a Page Set to run an Action Script.

The following example loads a Client and then executes an Action Script that may update the Client's Name:

Public Sub cmdTest_Click(sender As Object, e As finPageObjectClickEventArgs) Handles cmdTest.Click

  Dim Client As finClient
  Dim Ok As Boolean
  Dim RequiresRefresh As Boolean
  
  ' Assume Success
  Ok = True
  
  ' Initialise
  Client = finBL.CreateClient()
  
  ' Load Client
  Ok = Client.Load("paul")
  
  If Ok Then
    ' Show Details
    txtName.Text = Client.Name  

    ' Execute Script
    Ok = psh.ExecuteActionScript("CCASENAME", "Client", Client, Nothing, RequiresRefresh)
    
    ' Has Action Script has updated the Target Object
    If Ok AndAlso RequiresRefresh Then
      Ok = Client.Refresh()
      
      ' Show Updated Details
      If Ok Then
        txtName.Text = Client.Name
      End If
    End If
  End If
  
  ' Error
  If Not Ok Then
    mUI.ErrorMessageShow()
  End If

End Sub

NOTE: If you don't supply a Script Id, the User will be prompted to select the Action Script to run based upon the supplied Target Object Type.