Professional > Interview scripting > Sample management > Sample management functions > AuthenticateSampleRec
 
AuthenticateSampleRec
This function is called by UNICOM Intelligence Interviewer - Server at authentication. For details about when authentication occurs, see When does authentication take place?.
Syntax
Function AuthenticateSampleRec(SampleFields, SampleRec)
Parts
SampleFields
Input parameter of type SampleFields.
SampleRec
Output parameter of type SampleRec. In case of failure, SampleRec must be set to Nothing within this function.
Example 1
The function in this example calls the Queues.AuthenticateSampleRec method, which looks in the sample table for a sample record with matching authentication fields. If a matching record is found, the function sets the return value to SUCCESS and returns the sample record (SampleRec object). Any sample fields passed in the SampleFields input parameter overwrite the corresponding sample fields on the returned sample record. If a matching record is not found, the function sets the return value to FAILURE and returns a SampleRec object with a value of Nothing. The function does not explicitly need to set the SampleRec object to Nothing because the Queues.AuthenticateSampleRec Queues.AuthenticateSampleRec method automatically does this when a matching record is not found.
Function AuthenticateSampleRec(SampleFields, SampleRec)
  Set SampleRec = Queues.AuthenticateSampleRec(SampleFields)
  If SampleRec Is Nothing Then
    AuthenticateSampleRec = FAILURE
  Else
    AuthenticateSampleRec = SUCCESS
  End If
End Function
Example 2
The function in this example calls the Queues.AuthenticateSampleRec method like the previous example. However, if a matching record is found, the function performs an additional test. If the matching sample record is in the COMPLETED queue, the function sets the return code to REJECT and the SampleRec object to Nothing.
Function AuthenticateSampleRec(SampleFields, SampleRec)
  Set SampleRec = Queues.AuthenticateSampleRec(SampleFields)
  If SampleRec Is Nothing Then
    AuthenticateSampleRec = FAILURE
  Else
    If SampleRec.Fields("Queue") = "COMPLETED" Then
      Set SampleRec = Nothing
      AuthenticateSampleRec = REJECT
    Else
      AuthenticateSampleRec = SUCCESS
    End If
  End If
End Function
For more information about Queues.AuthenticateSampleRec, see Sample Management Object model.
See also
Sample management functions