Forum Discussion

brybott's avatar
brybott
Visitor
9 years ago

ifSGNodeField.setField() fail

I have a situation where setting a field on a node occasionally fails. According to the documentation:


setField(fieldName as String, value as Object) as Boolean

Sets the value of the subject node field identified by fieldName to value. This will fail and stop script execution if the value is not of the appropriate type. Returns true if the field is successfully set, false otherwise.




So, setField() is definitely returning false, and the field type is definitely correct (it's defined as a string, and I'm definitely attempting to set a string on it). Is there anything else that could make setting a value on a field fail besides a type mismatch?

3 Replies

  • Are you sure it is returning False?
    From what i remember, setField() was "silent but deadly", contrary to what TFM says - i.e. it was neither stopping with error nor returning false when called with wrong arguments.
  • The code I used to test this is:


    isFieldSet = m.top.setField("someField", someString)
    print "isFieldSet: "; isFieldSet


    And I see in the console:

    isFieldSet: false



    So, I'm as sure as I can be.
  • "brybott" wrote:
    So, I'm as sure as I can be.

    Splendid. Now give a more complete example, so one can reproduce the issue. I.e. what type is the field, where is it declared, what's assigned and so on.