This function is called shortly after execution returns from the ChooseRecord entry point. It is called a number of times to retrieve the data from the individual fields of the selected record in the answer source application.
This function was introduced with the release of HotDocs 2009 to support Unicode strings. Earlier versions of HotDocs will not call this function.
long GetField ( long key, LPCWSTR fieldName, long typeID, LPCWSTR data, long maxLen )
Parameters | Description |
key | The record key returned by ChooseRecord. |
fieldName | The name of the field whose value is requested. |
typeID | The variable type of the field whose value is requested. (See HotDocs Data Types.) |
data | A buffer to contain the field value, as an 8-bit Unicode string. Pass the string <^UNANSWERED^> to indicate that the field should be set to unanswered in HotDocs. If you pass an empty string, HotDocs will not change the current answer for that variable. |
maxLen | The maximum size (in bytes) of the data buffer. |
Return HD_SUCCESS (1) if successful, and HD_FAILURE (0) if otherwise.
The following Visual C++ example returns a field value.
long WINAPI GetFieldW( long key, LPCWSTR fieldName, long typeID, LPWSTR data, long maxLen )
{
if (key == 129)
{
if (_wcsicmp(fieldName, L"First Name") == 0)
{
wcsncpy_s(data, maxLen, L"Greg", maxLen);
data[maxLen-1] = '\0';
return HD_SUCCESS;
}
else if (_wcsicmp(fieldName, L"Last Name") == 0)
{
wcsncpy_s(data, maxLen, L"Jones", maxLen);
data[maxLen-1] = '\0';
return HD_SUCCESS;
}
}
return HD_FAILURE;
}