Use case:
After an invoice (database, with original PDF attached to entity) gets approved for payment, an additional PDF is generated within the entity which contains all necessary information for further processing (-> single pager with summary of invoice information plus the approvals (date + person) and cost center).
I would like to quickly open the invoice + approval page of multiple approved invoices at one, with my system viewer (Adobe Reader Pro) and print it.
Is there anyone who could help in creating a script that would open all attached files of an entity with the default system program?
Trying to follow the api documentation:
const Fibery = require('fibery-unofficial');
const fibery = new Fibery({host: "YOUR_ACCOUNT.fibery.io", token: YOUR_TOKEN});
const files = await fibery.entity.query({
'q/from': 'Cricket/Player',
'q/select': [
'fibery/id',
{ 'Files/Files': {
'q/select': ['fibery/secret'],
'q/limit': 'q/no-limit'
} }
],
'q/where': ['=', ['fibery/id'], '$entity-id'],
'q/limit': 1
}, { '$entity-id': '20f9b920-9752-11e9-81b9-4363f716f666' });
Grab the secrets:
[ { 'fibery/id': '20f9b920-9752-11e9-81b9-4363f716f666',
'Files/Files': [
{ 'fibery/secret': 'a71a7f30-9991-11e9-b8d4-8aba22381101' },
{ 'fibery/secret': 'c5815fb0-997e-11e9-bcec-8fb5f642f8a5' } ] } ]
Download Files using these secrets:
const Fibery = require('fibery-unofficial');
const fibery = new Fibery({host: "YOUR_ACCOUNT.fibery.io", token: YOUR_TOKEN});
await fibery.file.download('a71a7f30-9991-11e9-b8d4-8aba22381101', './playing.jpg');
await fibery.file.download('c5815fb0-997e-11e9-bcec-8fb5f642f8a5', './resting.jpg');
Am I correct to assume that:
- Cricket â Space, Player â Database
- I need to save the queried entity ID to a variable, which I use to query for the secret
- I need to save the secret to a variable to download the files using variable as placeholder of the secret in the example
Is there anyone who could help me with the code, or comment on my assumptions?
Thanks a lot in advance for any help!