Scripts to Update Asset Custom Fields - Checkboxes & Drop Downs

I know that there is a script snip that can update a custom field, but how can I get a script to modify a custom dropdown field or a custom checkbox field? I can’t seem to find any documentation on this.

Edit: I figured it out, almost completely. Now if I can only figure out how to send a $null option to a dropdown.

Value for checkbox = (0 = Off) (1 = On)

Try setting it to ‘true’

When dealing with a custom asset checkbox, you can use Set-Asset-Field with a value of “true” or “false” (case sensitive). I noticed that when I ran if ($customassetvariable -eq “false”), it would go to the else section regardless if it was checked or not. I found that using “no” in place of “false” worked as intended. Replacing “false” with “yes” is also valid. I tested Set-Asset-Field with a value of “yes” and “no”. The “no” cleared the checkbox, but “yes” did nothing.

In short, you can set a custom asset checkbox with a value of true, false, and no. The conditional statement will accept yes or no, but not true or false.

I actually found that using 0 for unchecked and 1 for checked worked for me. Thank you for your input though.

I actually copied and pasted that from an email I had with Support back a year ago. I had heard 0 and 1 works as well, just weird that it’s so inconsistent between reading the field and setting the field.

I think we actually contacted Support about a bug related to this.
I forget the specifics, but I want to say it was something about the API returning “False” instead of “false” for reports causing it to be treated as “True” - or maybe I have that backwards.

I think that one was under my coworkers account, though and Teams doesn’t want to scroll that far back

Do it another way: create a custom asset field of the type you plan to use and and read it using a script. Then you’d know how Syncro sees it and can reverse the process.