Record picker component multiple values

I have a record picker component in my form which show records of another application, and i have a record type filed relatedrequest in my application record type so when i select and save into relatedrequest field of my application request filed for multiple values it's showing not available, is it not possible to save multiple values . The fields is type of text and length of 4000 . I tried with integer field that time it only takes one value. Why it's happening even though the component have multiselect options we can't save it. 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Your field must be List of Text or List of Number type to store multiple values.
    A single Text field (even with 4000 length) can only store one value, causing not available for multiple selections.


  •  a!pickerFieldRecords(
       maxSelections: 10,
       label: "Production Issue CMS Number",
       recordType: 'recordType!{e0c12f8e-caab-4b8d-8fb8-810b9e603906}NPPI Request',
      
       labelPosition: "JUSTIFIED",
       placeholder: "Please Enter CMS Number",
    
       value: if(
         a!isNullOrEmpty(
           ri!Request['recordType!{97af410e-2531-4d70-9548-10b202a9d59c}NPDO Request.fields.{8f861e97-4dcd-4b44-a9ac-0c7e3a22e4e5}requestid']
         ),
         local!cmsNumbers,
         a!localVariables(
           local!cmsId:split(
             ri!Request['recordType!{97af410e-2531-4d70-9548-10b202a9d59c}NPDO Request.fields.{43200a57-947e-46c0-8955-075b6040070d}productionissuecms'],
             ";"
           ),
           a!forEach(
             local!cmsId,
             a!queryRecordType(
               recordType: 'recordType!{e0c12f8e-caab-4b8d-8fb8-810b9e603906}NPPI Request',
               fields: {
                 'recordType!{e0c12f8e-caab-4b8d-8fb8-810b9e603906}NPPI Request.fields.{e00ba175-0045-47f7-ac40-dabe37e4b505}requestId'
               },
               filters: {
                 a!queryFilter(
                   field: 'recordType!{e0c12f8e-caab-4b8d-8fb8-810b9e603906}NPPI Request.fields.{e00ba175-0045-47f7-ac40-dabe37e4b505}requestId',
                   operator: "=",
                   value: tointeger(fv!item),
    
                 ),
    
               },
               pagingInfo: a!pagingInfo(startIndex: 1, batchsize:100)
             ).data[ 'recordType!{e0c12f8e-caab-4b8d-8fb8-810b9e603906}NPPI Request.fields.{e00ba175-0045-47f7-ac40-dabe37e4b505}requestId']
           )
         )
       ),
       saveInto: {
         local!cmsNumbers,
         a!save(
           ri!Request['recordType!{97af410e-2531-4d70-9548-10b202a9d59c}NPDO Request.fields.{43200a57-947e-46c0-8955-075b6040070d}productionissuecms'],
           local!cmsNumbers
         )
       },
      
     ),
    

    There is no option to make record field to array .I have tried the above approach  but its allowing duplicate records , 

  • 0
    Certified Lead Developer
    in reply to iswaryan3520

    To store multiple values in a single field, a bad idea by the way, a good approach is to store the list a values as a JSON string.

  • Thanks for the suggestions, how should I do that? Just by using the jason function and saving it in the same field or something else i Have to do .Can you help me? 

  • 0
    Certified Lead Developer
    in reply to iswaryan3520

    In line 44 use tojson() to convert the list into a JSON string.

    In 9 use fromjson() to convert the JSON string into a list of values. You might have to add null-checks as fromjson() fails on invalid JSON.

Reply Children
No Data