Setting Object relations question

Hi All!

I just wrapped up the Mission - Relations Master 3 “Set Object Relations with API” and have a question which I feel should be easy but can’t figure it out.

How can I set the object relations value without requiring user input?

Specifically, I am creating a polling app where users can submit a poll question. I have a Poll table with a column Status with a 1:1 relation to the Status table. My goal is to set a default value of ‘pending’ for all new poll questions that are submitted.

I replicated the flow from the video in which there is a Selection for the user to choose the Status, which works in saving the relation to the tables, but ideally the default of ‘pending’ without user input.

After loading the objects from the Status table, I am struggling with how to set the value of ‘Pending’ to the property that is returned in setting the object relations.

Appreciate your help!


Screen Shot 2022-07-27 at 4.29.39 PM

Hello, @Max_Guilbert.

If i correctly understand your question you want to set “Pending” value by default?
To do it you can open your table and hit “schema” tab. Then you need edit your column and set “Default Value” to “Pending”.

If you do this, it will default to instantiate the object with a value of “Pending” (no need for the user to manually select this option).

Best Regards, Nikita.

Hi Nikita thanks for the response!

I tried that and it doesn’t quite work for my use case because I am not writing new objects directly to the status table. Instead when the user submits a new poll question it creates a new object in the Poll table which has a relation to the status table.

How it works now is the user sets the status from a selection before submitting the poll so I can take that input and create the relation to the status table. I’d love to automatically set the status to ‘pending’ for the new poll object in the Poll table.

look at this article, I think the deepSave block is suitable for your request:

Best Regards, Nikita.

This is a great article will definitely incorporate.

In the example, it passes a string “New York” , “USA” - any suggestions on how I would pass the status ‘Pending’ which is type multiple choice?

appreciate all your help thus far :slightly_smiling_face:

Also u can do it something like this:

Result:



You just need to add a check. If the user did not select anything, then set the hardcoded value to “Pending” object.

Best Regards, Nikita.

1 Like

Ah that did the trick!

The ‘if’ statement and using the objectId to set the status were the two pieces I was missing.

Thanks for the help Nikita!!

1 Like