cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Optional strings in a schema

bboren
Deputy Chef III
Deputy Chef III

I am trying to create a custom REST API call.  I am able to get the JSON payload required and use Workato to generate a schema form that.  However, I am stuck when dealing with fields that are allowed to have blank values.
If I make the field optional it is not being included in the payload if blank.  If I make it mandatory it won't let me not populate it and run the recipe.

Any ideas?

2 ACCEPTED SOLUTIONS

meghan-legaspi
Community Manager
Community Manager

Hey @bboren,

If you 'skip' the fields that are left blank when you run the recipe, are they still included in the payload?
You can learn more on that here: https://docs.workato.com/formulas/other-formulas.html#skip

This section on creating a new access profile for API may also be helpful: https://docs.workato.com/api-mgmt/api-client-mgmt.html#create-new-access-profile

Please let me know if neither of these resources are helpful in your case. I may need more info on your specific use case in order to better assist.

If you would like to submit a ticket for support, you may do so here.

View solution in original post

mppowe
Executive Chef I
Executive Chef I

One weird trick I've had to use in the past for things like this is to define a variable called "empty", leave it null, and then assign it to the required parameters.  That way the recipe will save, but it doesn't pass anything at runtime.

View solution in original post

4 REPLIES 4

meghan-legaspi
Community Manager
Community Manager

Hey @bboren,

If you 'skip' the fields that are left blank when you run the recipe, are they still included in the payload?
You can learn more on that here: https://docs.workato.com/formulas/other-formulas.html#skip

This section on creating a new access profile for API may also be helpful: https://docs.workato.com/api-mgmt/api-client-mgmt.html#create-new-access-profile

Please let me know if neither of these resources are helpful in your case. I may need more info on your specific use case in order to better assist.

If you would like to submit a ticket for support, you may do so here.

mppowe
Executive Chef I
Executive Chef I

One weird trick I've had to use in the past for things like this is to define a variable called "empty", leave it null, and then assign it to the required parameters.  That way the recipe will save, but it doesn't pass anything at runtime.

bboren
Deputy Chef III
Deputy Chef III

This worked too.  The skip option in the scripting allows you to avoid creating a variable just to handle a blank value.

mppowe
Executive Chef I
Executive Chef I

Yea I probably should've qualified that more.. the times I've used the "blank" variable has really just been in Unit Tests when calling recipes that have a required input that I wanted to be blank in certain Test Scenarios.  But in "normal" recipes I've used the skip function as Meghan described.