Best answer

Zap not sending static dropdown with Post request test

  • 27 February 2020
  • 3 replies
  • 1742 views

Userlevel 2

Hello, I'm having an issue where even though my static drop down is showing up for input, it doesn't get sent to my server while testing, I've attempted to search Google, the Zapier CLI docs, but I honestly have no clue what I'm looking for, and help would be greatly appreciated, here are screenshots:


Options are available to be selected.

image.png

Confirmation:

image.pngWhat is sent(Note how "Profile" is missing):

{

"fields": {

"filename": "Test",

"name": "Test"

},

"files": {

"file": {

"size": 17,

"path": "/tmp/upload_c6d773af96462ff0f9b6e52b4c497948",

"name": ".eJwVjluSgyAQAO8y36IEDCqH2CtYiEOk5OHCZFNJKndf891d1f0Gu6Hd5x2foBW_igtXDdicCBPN9DwQNPxAAz5VMsni7FfQwzT2Ql1kA85jWOdk4tcr-HvHSqe9P0y5VdBvuJdwko3oqLrrXubwWNiKf8z5gLWtsjXRvHIyj9raHDsbPDuCIZdL7FQvBhxxYRKlY_3Ee2Zw4UwM0o1KTIsc-FmLSFs-t-CGBJ_PP6_DRCI:1j7NNU:d_zB6KgnzKcHbV-ORS4HpoblAhg",

"type": "application/octet-stream",

"mtime": "2020-02-27T17:55:20.508Z"

}

}

}


My code:

module.exports = {

key: 'uploadFile',

noun: 'File',

display: {

label: 'Upload File',

description: 'Uploads a file.'

},

operation: {

inputFields: [{

key: 'name',

required: false,

type: 'string',

label: 'Name',

helpText: 'If not defined, the Filename will be copied here.'

},

{

key: 'filename',

required: true,

type: 'string',

label: 'File name'

},

{

key: 'file',

required: true,

type: 'file',

label: 'File'

},

{

key: 'profile',

type: 'string',

required: true,

choices: { firstonly: 'first only', multipage: 'Multipage'},

label: 'Profile'

},

],

perform: uploadFile,

sample: {

id: 1,

name: 'Example PDF',

file: 'SAMPLE FILE',

filename: 'example.pdf',

profile: 'firstonly'

},

outputFields: [{

key: 'id',

type: 'integer',

label: 'ID'

},

{

key: 'name',

type: 'string',

label: 'Name'

},

{

key: 'filename',

type: 'string',

label: 'Filename'

},

{

key: 'file',

type: 'file',

label: 'File'

},

{

key: 'profile',

type: 'string',

label: 'Profile'

},

],

}

};


icon

Best answer by DL_CharlesM 4 March 2020, 16:44

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +12

Hi @DL_CharlesM!

I think that this will need some more technical troubleshooting, so I've escalated this ticket to the Support queue and one of the team will be in touch via email to help you with it as soon as possible. 

Let me know if you have any questions!


Userlevel 2

Thanks for the response @Danvers I'll post here once a solution has been found.


Userlevel 2

Alright folks, I'm back, in my case there is the "uploadFile" function:

const uploadFile = (z, bundle) => {

const formData = new FormData();

formData.append('filename', bundle.inputData.filename);

// file will in fact be an url where the file data can be downloaded from

// which we do via a stream created by NPM's request package

// (form-data doesn't play nicely with z.request)

formData.append('file', request(bundle.inputData.file));

formData.append('profile', (bundle.inputData.profile));

if (bundle.inputData.name) {

formData.append('name', bundle.inputData.name);

}

Even though "profile" was declared in inputFields and outputFields it also needs to be appended to your formdata as in the example above.


Thanks for the direction @Danvers . 😀