Selection Lists in Web Services

1 minute read time.

The code below is an extract of the simple webservices demo application found elsewhere on this site.

Please note the following assumptions

1) CRM60 is the webservice object
2) CRMCompany is a previous retrieved Company record
2) The code is to retrieve the selection values of the comp_source field and add them to a combobox control on a windows form.




dropdownvalues[] compDropDowns = CRM60.getdropdownvalues("company");
comboBox1.Items.Clear();
for (int i = 1; i
{
// MessageBox.Show(compDropDowns[i].fieldname);
if (compDropDowns[i].fieldname.ToString() == "source")
{
for (int x = 1; x
{
comboBox1.Items.Add(compDropDowns[i].records[x].ToString());
if (CRMCompany.source == compDropDowns[i].records[x].ToString())
{
comboBox1.SelectedIndex = x-1;
}
//MessageBox.Show(compDropDowns[i].records[x].ToString());
}
}
}

Note:

The selection list is defined in meta data as a set of translations in the custom_captions table. The comp_source field discussed here has the options stored in a set of records all belonging to the caption family 'comp_source'.

e.g.

capt_family = comp_source
capt_code = advertisement
capt_uk - advertisement
capt_es = annuncio

capt_family = comp_source
capt_code = email
capt_uk - e-mail
capt_es = Correo electronic

The caption codes (advertisement, email) are what are stored as values in the company record's comp_source field. But the getdropdownvalues actually returns the translation for the caption code.

This is always the translation for the default application language and not the users language.

If in the Admin>System>System Behaviour screen, the default languge is set to Spanish it will return 'Correo electronic' when the value in the comp_source field is email.

When the selection list is updated to "annuncio" and a save occurs it is the capt_code "advertisement" that is saved into the record and not the translation.

Parents Comment Children
No Data