Hi All,
I have a requirement to select mutiple check box at once and save the values in CDT/database . Issue here is the value is not getting saved into my cdt ri!user.
It just saves the current selected value and ignore others . Whats wrong here ? Any suggestions?
a!checkboxField( label:"checkbox", choiceLabels:index(rule!HD_getAllHelpdesk(),"name",{}), choiceValues:index(rule!HD_getAllHelpdesk(),"id",{}), value:ri!user.helpdeskId, saveInto:ri!user.helpdeskId, )
Thanks in advance
Discussion posts and replies are publicly visible
Hi Anu - helpdeskId should be of array type in user CDT. If still it does not save then check if rule getAllHelpdesk rule is returning appropriate values.
I tested your code and its working fine for me.
Hi Chitra, please help me with Why helpdeskId should be of array type ? let say When i select first two option . It should generate two different id's with helpdesk id 1 and helpdesk id 2 . If i give helpdeskid as array type , id will be same for both .
To save two/multiple values you need a array container. If you won't make multiple it will always store 1 value.
So when you make it array, all selected values will be added to helpdeskId.
Each label save its corresponding ID and the same will be stored in your array.
Sure , i got this now . It created a new table when i made as array and saving the value in new table but it saves null in the old table for that id . How would i fetch this details now ? because i m querying my old table to get the data and its null
first screen is my old table from where i get the details based on username which is returning null because the details is getting saved in new table (second screen). How would i get these helpdeskid based in username ?
You have to query the table in second screen by passing the PK of first screen table in helpdeskId_id column.
Also, if you are saving information to DB with a CDT containing array type of field, I would recommend to create separate CDT with all fields and map it to parent CDT PK. In this way maintaining CDTs in future would be good. Thanks!
Oops ..looks like In that case , i need to change my table design .because my requirement is to get helpdesk id's based on username .
Hi Anu,How about changing the type of that column to text and storing all the ids separated by #. In that case, you won't need any extra tables.
If you do this, I recommend using a JSON array to store the array value, as this takes the guesswork out of formatting and/or parsing the data for writing to and reading from DB.