Question / Problem:
Is it possible to modify a field value of a document or folder outside of its normal process?
Answer / Solution:
The API can be used to get and set field values of any folder and document. This is commonly used within processes and forms as part of the normal flow of data in a solution. However, the API can be used at any point as long as you have a document or folder ID.
Consider an example where a solution used a hidden field that cannot be edited by users in validation. The field is normally populated by automated means, but a problem occurred in a job and it has an incorrect value. Design changes might mitigate or prevent this situation in the future, but in terms of immediately fixing a field value to let the job move forward, the UpdateDocumentFieldValue or UpdateFolderFieldValue API functions can be used.
The attached package contains UpdateDocumentField.form, which you can use to get and set document fields (and folder fields). This example was created in KTA 7.8, and thus can be imported into KTA 7.8 and higher, however the same concept and APIs (UpdateDocumentFieldValue or UpdateFolderFieldValue) are available in all previous versions.
SessionID: This is already populated with the logged in user’s session ID.
Doc or Folder ID: You can get a folder or document ID from the variables page of the job details of a job using it. If you need to get the ID of a specific document within a folder, you may need to use the Repository Browser.
FieldName: Name of the field you want to get or set.
TableRow/TableColumn: If FieldName does not specify a table field, then these must be set to -1.
FieldValue: The field value you wish to set, or this textbox will be populated with the result of a get.