Skip to content

Commit bfaf482

Browse files
author
Olha Virolainen
authored
Fix polling trigger metadata (#2)
1 parent c031565 commit bfaf482

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

component.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"type": "polling",
4141
"dynamicMetadata": true,
4242
"fields": {
43-
"object": {
43+
"sobject": {
4444
"viewClass": "SelectView",
4545
"label": "Object",
4646
"required": true,
@@ -82,6 +82,7 @@
8282
"label": "Include linked objects",
8383
"viewClass": "MultiSelectView",
8484
"required": false,
85+
"require": ["sobject"],
8586
"model": "linkedObjectTypes",
8687
"prompt": "Please select any linked objects that should be included in the query"
8788
},

lib/entry.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ module.exports.process = async function process(message, configuration, snapshot
3333
} else {
3434
this.logger.trace('Got snapshot: %j', snapshot);
3535
}
36-
37-
configuration.sobject = configuration.object;
3836
const { linkedObjects = [] } = configuration;
3937
const singlePagePerInterval = (configuration.singlePagePerInterval !== 'no');
4038
const maxTime = configuration.endTime ? ` AND LastModifiedDate <= ${configuration.endTime}` : '';

lib/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ exports.processMeta = async function processMeta(meta, metaType, lookupField) {
115115
await fields.forEach((field) => {
116116
if (metaType === META_TYPES_MAP.lookup && field.name === lookupField) {
117117
inProp[field.name] = createProperty(field);
118-
} else if (metaType !== META_TYPES_MAP.lookup && field.createable) {
118+
} else if (metaType !== META_TYPES_MAP.lookup && metaType !== META_TYPES_MAP.polling && field.createable) {
119119
inProp[field.name] = createProperty(field);
120120
}
121121
outProp[field.name] = createProperty(field);

spec/triggers/entry.spec.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const metaModelDocumentReply = require('../testData/sfDocumentMetadata.json');
1111

1212
const configuration = {
1313
secretId: testCommon.secretId,
14-
object: 'Document',
14+
sobject: 'Document',
1515
};
1616
const message = {
1717
body: {},
@@ -71,4 +71,15 @@ describe('Polling trigger test', () => {
7171
expect(emitter.emit.withArgs('snapshot').callCount).to.be.equal(0);
7272
scope.done();
7373
});
74+
75+
it('should success generate metadata', async () => {
76+
const result = await polling.getMetaModel.call(emitter, configuration);
77+
expect(result.in.properties).to.deep.equal({});
78+
expect(result.out.properties.Id).to.deep.equal({
79+
default: null,
80+
required: false,
81+
title: 'Document ID',
82+
type: 'string',
83+
});
84+
});
7485
});

0 commit comments

Comments
 (0)