Selection Lists in Web Services

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.

Anonymous
  • Dave

    This might be different if you are working with Sage CRM web services that are configured to use "Dropdown fields as strings in WSDL file" to No rather than 'Yes'.

    BUT I suspect that this is still the case. The getdropdownvalues() method will only return the translation for the caption code based on the default application language and not the users language. The value submitted has to match that lookup value.

  • Hi, is there any way in web services to extract the caption codes in web services so that if you use this to uddate it back to CRM you put in a valid value rather than the translation ?