This topic contains 3 replies, has 0 voices, and was last updated by jonallenaz 7 years, 6 months ago.

  • Author
    Posts
  • #976

    CREECE

    Hello,

    I am having an issue where I am trying to set a custom field value of type integer number on new record using the N/record.record’s setCurrentSublistValue. This is usually extremely straight forward. The value is initially read as a string so when it is time to set the value, it is of type string. I’ve tried Number(), String() and parseInt() and all of the return the same error of :

    “You have entered an Invalid Field Value for the following field: ” which for example if it the value i am trying to set is 36, it is trying to set this as 36.0 whether string or number. Has anyone ran into this? This is the ONLY field that is causing this type of issue. I know that for the most part, fields are happy with string values but this one is causing me problems
    This is a cached copy. Click here to see the original post.

  • #977

    david.smith

    Have you tried hard-coding a string/number to the field? I will do this sometimes just to make sure my code is trying to set the field correctly before trying to fix the variables that should go in there. Once I know the specific format the api is looking for I can account for it a lot easier.

    Maybe something like String(Math.trunc()) ??


    CREECE replied on 04/06/2017, 08:03 PM: I did try to just put ’36’ in there and it threw the same error which is all the more baffling. I have no idea why it is doing this to be honest.

  • #978

    david.smith

    In the past I’ve seen issue where I had to recreate the field and/or records to solve problems with the database. Hopefully that’s not the case anymore but if you can, maybe try adding a new field, same as this one and see if you can set that one.


    CREECE replied on 04/07/2017, 12:36 PM: You aren’t the first person that has suggested that. That may be what I have to try.

  • #979

    jonallenaz

    I was having the same problem and was hoping to find the answer here. After playing around with it for a while, I found something that works! If you format the data as an integer with the format module, the field was saving fine with the exact same data.

    Example:

    .setValue({fieldId: ”, value: format.format({value: , type: format.Type.INTEGER})});

You must be logged in to reply to this topic.