This topic contains 5 replies, has 0 voices, and was last updated by JacksonP 7 years, 11 months ago.

  • Author
    Posts
  • #1417

    JacksonP

    I’m trying to set a multiselect field via setText, and it’s not working at all. The documentation says

    If the field type is multiselect:This parameter accepts an array of string values.
    This parameter accepts a null value. Passing in null deselects all currently selected values.
    but strangely it’s not working at all.

    here’s the exact code im using

    Code:
    var prefBrands = customerRecord.getText({
    fieldId: ‘custentity135’
    });
    eventRecord.setText({
    fieldId: ‘custevent32’,
    value: prefBrands
    });
    it’s returning

    [ “American Standard”, “Moen” ] Has anyone else run into this? Am I missing something?
    This is a cached copy. Click here to see the original post.

  • #1418

    ironside

    Perhaps, according to the docs the setText() method takes a fieldId and text (not value)?

  • #1419

    JacksonP

    I’ve tried both ways, with no luck.

  • #1420

    JacksonP

    I’ve been working in a beforeLoad userevent to try and set the values, and I could never get it working. When I tried setting the values in a pageInit client script it worked right away using a getValue, setValue.

    I think it’s because in a beforeload the record isn’t loaded in dynamic mode, and you need to have real time sourcing for a multiselect field to be set.

  • #1421

    david.smith

    I don’t think you can set or manipulate NetSuite fields beforeload. You can for fields that you create for the form on the fly but I don’t think you can otherwise.

    A possible solution would be to create a custom field on the fly with the same options as the NS field and hide the NS field. On fieldchange of the custom field you could set the value of the NS field.

    Maybe I’m wrong…. It tends to happen.


    erictgrubaugh replied on 12/05/2016, 05:17 PM: Correct; in a beforeLoad event, you cannot change any field — native or custom — that is stored with the record (i.e. custom field with "Store Value" checked). If the field is not stored (for instance, a calculated or formula field), then you may modify its value in beforeLoad.

  • #1422

    JacksonP

    To give you a broader view of what is going on, I’ve created a new event form, that sales reps click on a customer record, that pulls fields from the customer record and sets them to the new event. Which is all done in a beforeLoad… except the multiselect field, which I had to do in a pageInit. These fields on the new event record also write back to the customer record via a beforeSubmit. There’s also a sublist that i’ve created on the form in script that writes back to other records. I could only get the values for the sublist in a client script as well.

You must be logged in to reply to this topic.