Forum Discussion

JustinM89's avatar
JustinM89
Contributor
10 years ago

Blank custom property?

Is it possible to have a blank custom property? I have an endpoint from which I am grabbing two values, but sometimes the 2nd value is blank -- this is fine. A few steps later I hit another endpoint using both of these values, and I want to pass the blank value as a parameter.

 

The problem is, if the 2nd value  is blank, when I make the property transfer it gets set to null. When I hit my endpoint with this null value as opposed to a blank, I'm not getting the correct response. I've hardcoded this request with the blank and it works great, so I know it's not an issue with passing blank parameters, the problem is the property transfer.

 

I've tried adding a groovy script to check for null, change it to "" (also tried a single blank space), and then re-set it to a property, but it still uses null, not to mention it adds like 3 extra steps of work for one simple task. I have legitimate reasons for wanting to do this, as it would eliminate a large chunk of work as well as prevent me from having to use a clunky conditional.

 

EDIT - Rookie mistake -- in my Groovy script I was checking against null and not "null" as a string...This fixed my issue, although I wish there were a way to treat nulls as blanks or something, it would make my script a lot cleaner.

 

On that note, is it possible to make a property transfer within a Groovy script? As it stands, I have to:

-grab my values

-property transfer to custom properties

-groovy script with null check

-property transfer to request

 

I could at least eliminate the last property transfer if I could do it within the script.