Custom Piece Creation Questions

I’ve got a few questions about creating some new Pieces:

  • When using an Array Prop and adding additional Props inside it, adding a Dropdown Prop gives an error. Most other Prop types seem fine in this context, but not Dropdown. Is this intended?
  • I’ve been struggling with how to share data between Props. Basically, I need to load a large schema, and then have a bunch of Dropdown Props which are all based on that schema and on other selections. I know that I could just do a query each time, but I think that’s going to give a really poor user experience if there are multiple several second long wait times.
  • What is the best way to accept an Array or an Object as a Prop input? The best I’ve been able to come up with is to use a ShortText Prop and then try to JSON.parse() the value, but it feels like there ought to be a different way of handling this.
  • Does anyone have an example of a Custom Property? I haven’t been able to get this working at all. The example given in the docs doesn’t render properly, and I haven’t been able to do things like get the value or print to console. I’d like to be able to create a custom dropdown and populate it by doing a query. If someone could show me a working example of this, I’d appreciate it!

Hello @s_f , Welcome to the community :wave:,

Dynamic dropdown is not supported yet in Array prop. We have ticket open for it.

You can pass that value in refreshers field in dropdown.

You can use JSON or Object property.

You can refer Airtable Base Dropdown field code.

You can join our Developer Channel on discord for any queries regarding building the piece.

Hey, thanks for your reply. Some follow-ups:

You can pass that value in refreshers field in dropdown.

Let me expand a bit more. I’ve got a schema that looks like

{
  tableName1: {
    "fields": {
      fieldname1: {
        property1: {
          value: "abc"
        },
        property2:  {
          value: "xyz"
        }
      }
    }
  }
}

The User needs to select a Table, then a Field on the Table, then some other options depending on the type of Field selected. I know that I can pass table, but the other Props need the schema in order to populate their options. I’m aware that I can make each subsequent Prop do a query, but I think this will be a poor user experience, and I’d prefer to just fetch the schema once.

You can use JSON or Object property.

  • With a JSON Property, when I try to add a variable from another piece, it inserts it in a way that is not parsed as valid JSON. For instance:
    { myKey: {{trigger['callbackUrl']}} }
    If it’s just me doing this, I know how to get around, this using some additional Pieces, but I’m trying to build something simple to give to my Users, and I can’t expect them to know how to do this
  • With an Object property, it requires that the User enter a key for each value, and also it allows them to add multiple values when I just need a single one.

So with both Object and JSON, it’s not really a great experience for my Users. It would be great if there was a field which just accepted a single Object or Array.

You can refer Airtable Base Dropdown field code.

This is actually demonstrating a Property.Dropdown. My question was about Property.Custom

You can create a dropdown field for selecting the table, and then use a DynamicProperty Dropdown to display the fields based on the selected table. You might still need to fetch the table schema dynamically based on the selected table ID.

I understand. Have you tried using the Array property? It might be closer to what you’re looking for.

Got it. Property.Custom is still in beta and may not function as expected. Could you please describe the specific scenario you’re trying to achieve using this property?

You can create a dropdown field for selecting the table, and then use a DynamicProperty Dropdown to display the fields based on the selected table. You might still need to fetch the table schema dynamically based on the selected table ID.

Ah, I see what you’re saying. This is probably doable, but will be quite complex given my particular circumstance.
I’d like to request the ability to share some context between Props aside from just their values. Currently this workflow will require my Users to wait for Dropdown options to load like 4-10 separate times while configuring a Piece, and it would be way more helpful if we could just do a query once and share its result among Props.

I understand. Have you tried using the Array property? It might be closer to what you’re looking for.

I have, but unfortunately as you noted above, Dropdown Props can’t currently sit inside Array Props, and I need to use both in conjunction.

Got it. Property.Custom is still in beta and may not function as expected. Could you please describe the specific scenario you’re trying to achieve using this property?

Basically I’m trying to create a custom Conditions Builder. Here are some of the features we need:

  • Add Groups of Condition tems which have an AND/OR property
  • For each Condition Item:
    • Select a field from a nested schema, similar to the dynamic variable select that ActivePieces uses (ie, select the path table1.table2.table3.field)
    • Depending on the data type of the selected field, select an Operator from an appropriate list
      • ie, if the data type is String, have options like “Starts With”, whereas if the data type is Number, have options like “Greater Than or Equal To”
    • Also depending on the data type of the selected field, enter a value using the appropriate Input Type.
      • ie, if the data type is String, have a Text Input, but if the data type is Array, select an Array from available variables.

Having the ability to do this will probably be the determining factor in whether I can offer ActivePieces to my users.

You can create a dropdown field for selecting the table, and then use a DynamicProperty Dropdown to display the fields based on the selected table. You might still need to fetch the table schema dynamically based on the selected table ID.

I realized I might have misunderstood what you were saying earlier, so I just tried this out. I thought your suggestion probably would work with some effort, but unfortunately, it looks like Property.DynamicProperties ALSO cannot be nested inside an Array. I need the User to be able to create between 0 and x items, each of which show dynamic options from the schema.

Dynamic dropdowns/properties are not supported inside array fields. As a workaround, you can use a text field and input the item ID directly, if that aligns with your use case.

Oof, yeah, unfortunately that does not align with our use case at all.

Our users need to be able to select multiple fields to query or insert data into, but those fields have display names which may not match their actual names. For instance, the User might want to query the field labelled Name, but the actual name of the field is my_custom_field_123. In some cases, the Users might not even have the ability to go into the other application to look up what the actual field names are.

Also, sometimes these fields are nested, and they need to select a path which looks to them like Table 1 > Table 7 > Table 3 > Field Name, but which must be formatted to the API like table_1.relation_field_1.table_7.relation_field_2.table_3.my_custom_field_123.
99% of our Users will never be able to figure how to write this themselves. This is what I was hoping to be able to use a Custom Prop to do- create a nested dropdown menu.

There’s probably a workaround here where we allow the Users to define these queries within our application, and use Pieces with Dynamic Properties to let the Users fill out the variables, but that’s going to be a substantially worse experience for them.

Does ActivePieces have an ETA for either supporting Dynamic Dropdowns/Properties within Arrays, or for having Custom Properties more operational?