Product Hacks

Easily creating a "Select Field" with multiple options on a Database

  • 8 July 2020
  • 1 reply
  • 511 views
Easily creating a "Select Field" with multiple options on a Database
Userlevel 5

Have you already needed to create a Select field with multiple fields on a Database? 

 

Well, there’s a thing called GraphQL mutation that can maybe help you. 

 

GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data. This technology helps you search for information in your organization in a much faster and practical way.

 

Ok, but you are probably asking yourself what should I do? 

 

First, you need to access Pipefy’s GraphQL page: https://app.pipefy.com/graphiql , that should pretty much look like this:

 

SJNatxUTyNRPhd_tgkrqfC8eMA_aIdzj9P9QRW11sy7CX17JladRQxMKbF7D1Fh7kXU3Az9rUIhTprhChdsjjnYsSeQN2R4ZiJgORwMAPfZAYiYAREFn0HpNKSXrzfu2IOxfsY67


 

Now you should paste the query below on the left white side of the page:

 

Query:

 

mutation{

createTableField(input:{

  table_id: "Database ID

  type:"select"

  label:"Name of the field"

  options:["Option 1",

"Option 2",

"Option 3",]

}) {

  clientMutationId

}

}


 

It should look like this (example):

 

1UDq0-WL42j9mfhHEerNrsHE1czMkT4XccMTB2HWXKNW-ZW5Uzuq4FCkkJWLiTWjf-KCpH7wLpBPaIai7wMpILOUtH1uCL0lruVa3P7NE0Z9Z0dD9REwoT90uDcDtMeifAZz-hzL

 

After that, press the execute qpB1oAJY_r7zM-rbPruog807Sqd6_QgRAUzRu63sN55RFJ74hbJ4k-fB2P_d8Y0xw8rFl6y_c0fUCX_ZcpmygEEwK6oQDyTl0j01K9gjViFnYocFGHZ3thS4PB18m67QHiTqYW8U button on the top left side of your screen.

 

There you go! Now refresh your page and check your Database, you have created a new select field with all the options you wanted. 

 

Let me know if you have any questions!


1 reply

Userlevel 3

FYI for anybody reading this, the same can also be done in the database UI :) 

Reply