How can I add to value to storeValue()?

HI Team,

I would like to create an approval tool through REST API linkage with the in-house system using Appsmith.

I want to save the Select value output in API Request to ‘storeValue.approvallist()’

However, only the latest Select values are stored in the code below.

Is there a way to save the value continuously?

my JS Objects configured like belows.

[JS Objects]

export default {
	myFun2: async () => {
		await storeValue('approvallist',undefined,false);
		await storeValue('approvallist',[{
			'userinfo' : Select_User.selectedOptionLabel,
			'uniqueId' : Select_User.selectedOptionValue


    "userinfo": "UserInfo from REST API",
    "uniqueId": "UniqueID from REST API"

[ I want to make like below ]

    "userinfo": "UserInfo_1",
    "uniqueId": "UniqueID_1"
    "userinfo": "UserInfo_2",
    "uniqueId": "UniqueID_2"
    "userinfo": "UserInfo_...N",
    "uniqueId": "UniqueID_...N"

I have not been able to resolve this issue for more than 2 weeks.

Please help me solve this problem.

Hey @younggoel. Welcome to Appsmith community!

The requirement is a little confusing, so let’s get some more info here.

  1. Are you using select widget? (Select_User) Share screenshot?
  2. Do you have a POST API where you want to pass the selected values?

If above is true, the problems are -

  1. You need to use multi select widget where you can select more than one value
  2. The JS function you are writing is also not going to work. The rewrite would be -
await storeValue('approvallist', Select_Users. => {
 const user = Select_Users.options.find(u => u.value === uId);
 const { label, value } = user;
 return ({ userinfo: label, uniqueId: value });
}), false);