Best Answer

Adding an additional field while creating user

  • 13 September 2023
  • 3 replies
  • 96 views

Hi ,

i have a drop down with two custom options. I want to assign a default value during user creation.

i am using /manage/v1/user API. and my additional field object is like this.

"additional_fields": {

"11": "1"

}

 

i also tried with setting up the actual value

 

"additional_fields": {

"11": "my custom option 1"

}

 

how do i set a default value for a drop down

 

 

icon

Best answer by Ian 21 September 2023, 10:12

View original

3 replies

Userlevel 4
Badge +1

 In your first example, you appear to have formatted the value as a string instead of as an integer.

Instead of this:

"additional_fields": {

  "11": "1"

}

Try this:

"additional_fields": {

  "11": 1

}

Or possibly* this:

"additional_fields": {

  "11": 0

}

* 0 is the first item in the list; 1 is the second item.

Hi @Ian ,

Both string and integers are being accepted. 

In mycase some how the values of the drop down are 20 and 21 and NOT 0/1. 

So when i set 20 or 21 as the value of the field it is accepted. I was able to get these values by querying the user additional fields api.

do you know how these values are numbered? im thinking if you delete an option and add again the number gets augmented.

For example: first time when you are creating Yes/No options they take 0 and 1 values. Later if i delete the options and recreate it takes 2 and 3. is my understanding correct? otherwise i dont see a reason why the values are 20/21 in my case.
 

 

Userlevel 7
Badge +3

Hi @Ian ,

Both string and integers are being accepted. 

In mycase some how the values of the drop down are 20 and 21 and NOT 0/1. 

So when i set 20 or 21 as the value of the field it is accepted. I was able to get these values by querying the user additional fields api.

do you know how these values are numbered? im thinking if you delete an option and add again the number gets augmented.

For example: first time when you are creating Yes/No options they take 0 and 1 values. Later if i delete the options and recreate it takes 2 and 3. is my understanding correct? otherwise i dont see a reason why the values are 20/21 in my case.
 

 

It’s not uncommon for your reasoning to hold true, those values have to stay unique and typically just increment always, seems to make sense. Always end up using the field api to look up the details like you said.

Reply