Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Check if reference field is blank

Andrew158
Giga Guru

Hello,

I am currently working on an action script in the flow designer where I want to dot walk to either the RITM table or a custom table based on which reference field is filled out on a form. The problem I am running into, is that when I check the value of these reference fields in my script, I get the error:
ConversionError: The undefined value has no properties.

I have tried using .getValue() as well as .nil() to check these reference fields, but still get the error. Is there a way I can write my script where I can check whether a reference field is blank or not without getting this error?

See script below:

find_real_file.png

1 ACCEPTED SOLUTION

Andrew158
Giga Guru

I figured it out. Simply using the following code without operators will return true or false if the reference field is filled out.

if(inputs.pmd.requested_ritm)
if(inputs.pmd.move_scenario)

View solution in original post

3 REPLIES 3

Abhinay1
Giga Expert

Hello Andrew,

Please use below 2 templates to generate the required value.

fd_data.trigger.request_item.variables.<variable name>.getValue();
fd_data.trigger.request_item.variables.<variable name>.getDisplayValue();

Please advise if this works.

Regards,

Abhinay

Hello Abhinay, 

To clear some stuff up, what I am working with here is a scripted action in a flow (so fd_data.trigger won't do anything for me). I have a table with 2 reference fields to sc_req_item and another custom table. I want to be able to check if either of these reference fields are blank, but when I try and reference one that is blank to check, I get the error "ConversionError: The undefined value has no properties." What I am trying to figure out is how can I check if these reference fields are blank without getting this error when they are. The code in question from my screenshots are those in the if statements.

Andrew158
Giga Guru

I figured it out. Simply using the following code without operators will return true or false if the reference field is filled out.

if(inputs.pmd.requested_ritm)
if(inputs.pmd.move_scenario)