Ok, I’ve been trying to figure this out for a week now.
I’m trying to hide elements based on the result of a dropdown. At different times it works, but mostly it doesn’t.
In this example, the error seems to come from trying to hide the “fetch” button.
The debug log has this in it:
07:50:14 [Warn] PowerShellExecutionService Error executing endpoint eGetADAcctDisposition. You cannot call a method on a null-valued expression.
at , : line 66
07:50:14 [Debug] ComponentController ConvertToActionResult() {“Error”:{“message”:“You cannot call a method on a null-valued expression.”,“location”:null,“type”:“error”,“id”:null,“refreshInterval”:0,“autoRefresh”:false,“hasCallback”:false}}
This is the code that gets called:
# Hide the element…
$attributes = $null
$TheUDElement = Get-UDElement -Id ebtnFetch
$attributes = $TheUDElement.Attributes
if ((!(IsNull($attributes))) -and ($attributes.ContainsKey(“style”))){ $attributes.Remove(“style”) }
$attributes.Add(“style”, @{display = “none”})
Set-UDElement -Id “ebtnFetch” -Attributes $attributes
$TheUDElement = $null
It seems that Get-UDelement doesn’t return the attributes, so its null (pardon my IsNull function, thats me testing stuff).
Am I not using Get-UDElement correctly? I’ve tried it with no-quotes, single quotes, double quotes, directly, indirectly.
I’m going to try putting in a loop to try 5 times grabbing the attributes. Wanted to put this out there though to see if anyone else came across it.
In this particular case, its crashing on a button. But I’ve seen it crash at other places too. (I reset text boxes and other dropdowns too)
I’m running this in UD 2.9 on IIS.
Thanks.