BPM Triggered on Task Agent Schedule - Help Needed

I’ve figured out how to get the custom code in there. Had to read through the following post and some of the comments to figure out the checkboxes allowed or disallowed code.

I am now getting the following error whenever the function runs. I get that its related to my keys in UD02 but past that I don’t understand how the parameter value could be blank:

This is what my current function looks like. I just want to pull in the only item in UD02. I believe that using the GetById is how I would go about this. I then have an assign statement to grab the value of Ud02.Checkbox01 and assign it to a variable. Lastly, I want an email to go out if the function operates correctly.

Thanks again for helping with this.