Install and Configure ServiceMax > Customizing ServiceMax > Custom JavaScript Snippets Support > Sample Code Snippets > Scenario 5: Access Information About Attachments for a Record
Scenario 5: Access Information About Attachments for a Record
The information on this topic is specific to the ServiceMax Go mobile app.
Attachment information related to the SFM and detail lines are included in the $sfm_records.get() response. The following table provides information on the objects.
Response Body
Name
Type
Description
attachments
Object
Collection of Attachment objects in the SFM.
detailAttachments
Object
Collection of Section objects that contain a collection of detail lines that contain a collection of Attachment objects.
Attachment Object
Name
Type
id
string
name
string
lastModifiedDate
string
contentType
string
downloaded
boolean (optional)
parentId
string (optional)
description
string (optional)
processId
string |null | undefined (optional)
documentID
string |null | undefined (optional)
isVersioned
boolean | null | undefined (optional)
userId
string |null | undefined (optional)
Example for attachments and detailAttachments in $sfm_records.get() response
{
"header": {
// Header information

},
"details": {
// Details

},
// **** New "attachments" property ****
// Attachments for header object
"attachments": {
// Attachment 1
"0681R00000StVTcQAN": {
"id": "0681R00000StVTcQAN",
"parentId": "a1d360000063brZAAQ",
"name": "IMG_0003.jpg",
"userId": "0051R00000HiCg2QAF",
"lastModifiedDate": "2021-09-16T23:55:03.000+0000",
"processId": "",
"documentId": "0691R00000PlLNAQA3",
"isVersioned": false,
"description": "",
"contentType": "image/jpeg",
"contentLength": 587299,
"downloaded": true

},
// Attachment 2
"SFMEngine_LOCAL_ByPbpPLmF": {
"id": "SFMEngine_LOCAL_ByPbpPLmF",
"name": "IMG_0004.jpg",
"lastModifiedDate": "2021-09-20T20:20:14.906Z",
"description": "",
"contentType": "image/jpeg",
"contentLength": 380514.6,
"downloaded": true

}

},
// **** New "detailAttachments" property ****
// Attachment for details lines.
"detailAttachments": {
// Section 1
"a0e1R00000UkBXXQA3": {
// Child line 1 with no attachments.
"SFMEngine_LOCAL_B11fTvUmF": {
},
// Child line 2 with 1 attachment.
"SFMEngine_LOCAL_H1JXpwLQF": {
// Attachment 1
"SFMEngine_LOCAL_BypMTDI7Y": {
"id": "SFMEngine_LOCAL_BypMTDI7Y",
"name": "IMG_0001.jpg",
"lastModifiedDate": "2021-09-20T20:20:36.875Z",
"description": "",
"contentType": "image/jpeg",
"contentLength": 568872,
"downloaded": true

}

},
// Child line 3 with 2 attachment.
"a1c1R000005vmsZQAQ": {
// Attachment 1
"0681R00000StVThQAN": {
"id": "0681R00000StVThQAN",
"parentId": "a1c1R000005vmsZQAQ",
"name": "IMG_0003.jpg",
"userId": "0051R00000HiCg2QAF",
"lastModifiedDate": "2021-09-17T22:12:55.000+0000",
"processId": "",
"documentId": "0691R00000PlLN5QAN",
"isVersioned": false,
"description": "Updated",
"contentType": "image/jpeg",
"contentLength": 587299,
"downloaded": true

},
// Attachment 2
"SFMEngine_LOCAL_SJjm6PUmK": {
"id": "SFMEngine_LOCAL_SJjm6PUmK",
"name": "IMG_0001.jpg",
"lastModifiedDate": "2021-09-20T20:20:50.570Z",
"description": "",
"contentType": "image/jpeg",
"contentLength": 568872,
"downloaded": true

}

}

}

}
}
Was this helpful?