GetFieldValue of a boolean (yes/no)

Forums SPJS-Utility GetFieldValue of a boolean (yes/no)

Viewing 2 reply threads
  • Author
    Posts
    • #32920
      DougMcCourt
      Participant

      Hi Alexander –

      Im trying to evaluate a Yes/No on a dispform – and set a SPFieldBoolean (yes/no) on a list item im inserting in another list

      The below test is always evaluating to true – irrespective of whether the yes/no checkbox (Req_x0020_Has_x0020_PII_x002f_MN) is checked

      if(getFieldValue(“Req_x0020_Has_x0020_PII_x002f_MN”)){
      data.PII = true;
      }

      If i try straight assignment of data.PII = getFieldVal(“Req_x0020_Has_x0020_PII_x002f_MN”);
      I get the sharepoint error that im trying to assign an invalid value to a Yes / No

      Is getFieldValue perhaps not liking the SPFieldBoolen type?

      Thank you

    • #32922
      Alexander Bautz
      Keymaster

      What do you get if you hit F12 > Console and type in this?:

      getFieldValue("Req_x0020_Has_x0020_PII_x002f_MN");

      In my test it returns true or false, but if you have an older version of DFFS you might get the actual text (Yes or No).

      Please note that when you use spjs.utility.addItem you must pass the boolean value as “1” or “0” and not true or false.

      Alexander

    • #32924
      DougMcCourt
      Participant

      Hi Alexander –

      That was it! changed my test to if (getFieldValue(xxxxx) === “Yes”) and works as expected

      Thank-you

Viewing 2 reply threads
  • You must be logged in to reply to this topic.