Manage Document Records
You may need to manage documents that employees submit for various organizational requirements. Documents such as birth certificate, driver's license, passport, and visa are attached in an employee's document record. You can use the documentRecords
resource to create, update, and delete document records and attachments for employees.
Let's discuss these scenarios:
Create a Document Record with Attachment
Let's say that Jason needs to travel on business and is required to submit his passport details. Denise Parker, Jason's HR representative, creates a document record for him with the passport attachment.
To create a document record with attachment:
- Perform a POST operation on the
documentRecords
resource by providing the person number, document and attachment details in the request body. - Verify that the document record and its attachments are created for the worker in Oracle HCM Cloud.
Example URL
Use this resource URL format.
POST
hcmRestApi/resources/11.13.18.05/documentRecords
Example Request
Here's an example of the request body in JSON format.
{
"PersonNumber": "955160008189504",
"DocumentCode": "GLB_PASSPORT_23-05-2019",
"DocumentName": "Passport",
"DocumentNumber": null,
"DateTo": null,
"DocumentType": "Passport",
"IssuingCountryName": "United Kingdom",
"attachments":[
{
"FileName": "Passport_Front.jpg",
"FileContents": "SGksIFRoaXMgaXMgYSB0ZXN0"
}
]
}
Example Response
Here's an example of the response body in JSON format.
{
"DocumentsOfRecordId": 300100205670943,
"DocumentTypeId": 100100001750041,
"SystemDocumentType": "GLB_PASSPORT",
"DocumentType": "Passport",
"Country": null,
"CategoryCode": "PPT_INFO",
"SubCategoryCode": null,
"PersonId": 300100009471199,
"PersonNumber": "300100009471199",
"ListName": null,
"DisplayName": null,
"FullName": null,
"DocumentCode": "GLB_PASSPORT_23-05-2019",
"DocumentName": "Passport",
"DocumentNumber": null,
"DateFrom": null,
"DateTo": null,
"IssuingAuthority": null,
"IssuingCountryName": "United Kingdom",
"IssuedDate": null,
"IssuingLocation": null,
"Comments": null,
"Publish": null,
"PublishDate": null,
"RelatedObjectId": null,
"RelatedObjectIdColumn": null,
"RelatedObjectName": null,
"CreatedBy": "VMOSS",
"CreationDate": "2019-08-19T06:58:52.032+00:00",
"LastUpdatedBy": "VMOSS",
"LastUpdateDate": "2019-08-19T06:59:01.498+00:00",
"attachments": [
{
"AttachedDocumentId": 300100205670945,
"LastUpdateDate": "2019-08-19T06:59:04.772+00:00",
"LastUpdatedBy": "VMOSS",
"DatatypeCode": "FILE",
"FileName": "Passport_Front.jpg",
"DmFolderPath": null,
"DmDocumentId": "UCMFA00070379",
"DmVersionNumber": "43787",
"Url": null,
"CategoryName": "MISC",
"UserName": null,
"Uri": null,
"FileUrl": "/content/conn/FusionAppsContentRepository/uuid/dDocID%3a43787?XFND_SCHEME_ID=1&XFND_CERT_FP=7449E776CEB417F2657A6E0C6C83E417AB4E4154&XFND_RANDOM=-1402329482924644951&FND_EXPIRES=1566198545695&XFND_SIGNATURE=RnnYsypdKXwAk24dyXpR0eV4MlHk9skALOP0SQG2kWvCZyMQyoJqRr5xrgmL6CCqFYEy6~qVMeuJNorWFAJwj4WIEILHgcheaH3vdyHubX40SdTJmx4TfR07M9--Uzt-~LxBDUU~6G1PK5p9aaPMcXx9P62UAKI4D9tvsZrODRMuaGZTdZ6Al4117-ig~8T5hGncFpMxgdVm~Q6nqvWX8LpX1Tmv615dVEhltF3b3d9l61nEmRyrfRXiJMo0gpvJripfEUqDvKwZgurQF2XbR9SS8E1hzre~wp5otTFlo3ya0uBgCE-n6vhP46mfPMt5daZKgsYB2mzhbFunTm4s~w__&Id=43787&download",
"UploadedText": null,
"UploadedFileContentType": "image/jpeg",
"UploadedFileLength": 18,
"UploadedFileName": "Passport_Front.jpg",
"ContentRepositoryFileShared": "false",
"Title": "Passport_Front.jpg",
"Description": "",
"ErrorStatusCode": null,
"ErrorStatusMessage": null,
"CreatedBy": "VMOSS",
"CreationDate": "2019-08-19T06:58:55.746+00:00",
"ExpirationDate": null,
"LastUpdatedByUserName": "Veda Moss",
"CreatedByUserName": "Veda Moss",
"links": : [
{...
}
}
]
}
Update a Document Record with Attachment
After creating Jason's document record, Denise realizes that she's entered the incorrect issuing country. She needs to update and correct the issuing country details in the document record.
To update a document record:
- Query (GET) the document records of the worker by using a query parameter (for example,
/documentRecords?q=PersonNumber=955160008189504
). - Identify the document to be updated.
- Perform a PATCH operation against the URL for the specific document record by providing the details to be updated in the request body.
- Verify that the document record and its attachments are updated for the worker in Oracle HCM Cloud.
Example URL
Use this resource URL format.
PATCH
hcmRestApi/resources/11.13.18.05/documentRecords/300100205670943
Example Request
Here's an example of the request body in JSON format.
{
"IssuingCountryName": "Japan",
"attachments":[
{
"AttachedDocumentId": "3000000000000",
"FileName": "Passport_Back.jpg",
"FileContents": "SGksIFRoaXMgaXMgYSB0ZXN0"
}
]
}
Example Response
Here's an example of the response body in JSON format.
{
"DocumentsOfRecordId": 300100205670943,
"DocumentTypeId": 100100001750041,
"SystemDocumentType": "GLB_PASSPORT",
"DocumentType": "Passport",
"Country": null,
"CategoryCode": "PPT_INFO",
"SubCategoryCode": null,
"PersonId": 300100009471199,
"PersonNumber": "300100009471199",
"ListName": "ZHRX_SG02_emp002__, ZHRX",
"DisplayName": "ZHRX ZHRX_SG02_emp002__",
"FullName": "ZHRX_SG02_emp002__, ZHRX",
"DocumentCode": "GLB_PASSPORT_23-05-2019",
"DocumentName": "Passport",
"DocumentNumber": null,
"DateFrom": null,
"DateTo": null,
"IssuingAuthority": null,
"IssuingCountryName": "Japan",
"IssuedDate": null,
"IssuingLocation": null,
"Comments": null,
"Publish": null,
"PublishDate": null,
"RelatedObjectId": null,
"RelatedObjectIdColumn": null,
"RelatedObjectName": null,
"CreatedBy": "VMOSS",
"CreationDate": "2019-08-19T06:58:52.032+00:00",
"LastUpdatedBy": "VMOSS",
"LastUpdateDate": "2019-08-19T07:06:31+00:00",
"links": : [
{...
}
}
]
}
Delete a Document Record with Attachment
Jason's visa has expired and Denise needs to delete this document from his document record as it'is no longer relevant.
To delete a document record and its attachments:
- Query (GET) the document records of the worker by using a query parameter (for example,
/documentRecords?q=PersonNumber=955160008189504
). - Identify the document to be deleted.
- Execute a DELETE operation against the URL for the specific document record. No payload is required for this operation.
- Verify that the document record and its attachments are deleted for the worker in Oracle HCM Cloud.
Example URL
Use this resource URL format.
DELETE
hcmRestApi/resources/11.13.18.05/documentRecords/300100137357366
Example Response
Here's an example of the response body in JSON format.
Status: 204 - No content
Get All Document Records with Attachments
Denise wants to retrieve all the document records that are available for Jason to verify if his documents are up-to date and accurate.
To retrieve all the document records of an worker:
- Query (GET) the document records of the worker by using a query parameter such as person number (for example,
/documentRecords?q=PersonNumber=955160008189504
- Verify the details returned in the response.
Example URL
Use this resource URL format.
GET
hcmRestApi/resources/11.13.18.05/documentRecords/?q=PersonNumber='300100009471199'
Example Response
Here's an example of the response body in JSON format.
{
"items": [
{
"DocumentsOfRecordId": 300100009471608,
"DocumentTypeId": 100100001749964,
"SystemDocumentType": "GLB_BIRTH",
"DocumentType": "Birth",
"Country": null,
"CategoryCode": "LEGAL_DOC",
"SubCategoryCode": "LEGAL_DOC_PERSONAL",
"PersonId": 300100009471199,
"PersonNumber": "300100009471199",
"ListName": "ZHRX_SG02_emp002__, ZHRX",
"DisplayName": "ZHRX ZHRX_SG02_emp002__",
"FullName": "ZHRX_SG02_emp002__, ZHRX",
"DocumentCode": "fff ",
"DocumentName": "fff",
"DocumentNumber": null,
"DateFrom": null,
"DateTo": null,
"IssuingAuthority": null,
"IssuingCountryName": null,
"IssuedDate": null,
"IssuingLocation": null,
"Comments": null,
"Publish": null,
"PublishDate": null,
"RelatedObjectId": null,
"RelatedObjectIdColumn": null,
"RelatedObjectName": null,
"CreatedBy": "ZBEN-USER-117",
"CreationDate": "2012-04-28T00:35:20.332+00:00",
"LastUpdatedBy": "ZBEN-USER-117",
"LastUpdateDate": "2012-04-28T00:36:17.071+00:00",
"links": : [
{...
}
}
]
}