Overview
Due to platform restrictions on data table attachment field access rules, preview images for attachment and signature fields cannot be displayed in views. In this case, we need to process the data and add the following fields to attachment and signature fields.
| Field Identifier | Name |
|---|---|
| appId | Application ID from which the field value originates |
| tableId | Data Table Identifier from which the field value originates |
| fieldId | Field Identifier from which the field value originates |
Scenario Example
Example Data Tables
Assume that in Application A (com.test.a), there are Data Table A (with identifier tablea) and Data Table B (tableb) with the following table structures.
Data Table A
| Field Identifier | Name | Type |
|---|---|---|
| name | Name | Single-line Text |
| attachment | Attachment | Attachment |
| signature | Signature | Handwritten Signature |
Data Table B
| Field Identifier | Name | Type |
|---|---|---|
| name | Name | Single-line Text |
| attachment | Attachment | Attachment |
| signature | Signature | Handwritten Signature |
The data in Data Table B comes from a script as follows.
javascript
export function executeQueryList(ctx) {
var list = informat.table.queryList('tablea', {
includeFields: ['attachment', 'signature'],
});
return list;
}
export function executeQueryListCount(ctx) {
return 100;
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Modify the above query script as follows.
javascript
export function executeQueryList(ctx) {
var list = informat.table.queryList('tablea', {
includeFields: ['attachment', 'signature']
});
// var appId = informat.app.appId(); // Use this method if it's the same application
var appId = informat.app.getAppIdByKey('com.test.a');
var result = list.map(record => {
let attachment = null;
let signature = null;
// If the attachment is multi-select, you need to use forEach to iterate
if (record.attachment) {
// Data copy
attachment = JSON.parse(informat.utils.toJSON(record.attachment));
attachment = {
...attachment,
appId: appId,
tableId: 'tablea',
fieldId: 'attachment'
};
}
// If the signature is multi-select, you need to use forEach to iterate
if (record.signature) {
// Data copy
signature = JSON.parse(informat.utils.toJSON(record.signature));
signature = {
...signature,
appId: appId,
tableId: 'tablea',
fieldId: 'signature'
};
}
return {
id: record.record,
attachment: attachment,
signature: signature
};
});
return list;
}
export function executeQueryListCount(ctx) {
return 100;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
At this point, the platform client will prioritize using the Application ID, Data Table Identifier, and Field Identifier information in the attachment or signature item for rendering.

