Question

Input with line item not capturing data

  • 25 April 2023
  • 1 reply
  • 19 views

Badge +1

I created an input externalIds with as single line item employeeNumber:

I’m passing this as the body:

body: {
'name': bundle.inputData.name,
'username': bundle.inputData.username,
'password': bundle.inputData.password,
'phone': bundle.inputData.phone.replace(/[^0-9]/g, ''),
'licenseNumber': bundle.inputData.licenseNumber,
'licenseState': bundle.inputData.licenseState,
'externalIds': {
'employeeNumber': bundle.inputData.externalIds.employeeNumber
}
}

When I test the method, the object is created (via Samsara API), but the externalIds element is missing.

Is this bundle.inputData.externalIds.employeeNumber the correct way to refer to the sole, line-item’s value?


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

1 reply

Userlevel 4
Badge +9

Hey @benjamink9 👋

If the key for employeeNumber is employeeNumber in the Input Designer section, then you would use bundle.inputData.employeeNumber in Code Mode to refer to that line item’s value, even though it is visually displayed within the External IDs line item group in the Input Designer. 

Normal input fields in Zapier add one item each time the Zap runs. Fields inside a Line Item Group, however, are added once per comma separated value added to the field. So in theory, a user could map multiple employeeNumbers into that field in the Zap Editor like this:

And based on the API documents https://developers.samsara.com/reference/createdriver  and how you have configured the body, they would be sent to Samsara API like this:

 

 

More on line items in the Visual Builder here: https://platform.zapier.com/docs/input-designer#how-to-add-a-line-item-group