How to get the text of a selection field instead of the code

Has anyone any idea how in an on change event I can get the text value from a selection field instead of the code?

All I'm trying to do is set the comm_subject to the text of a selection field to add a quick way of setting BUT still allow manual entry into comm_subject if required.

So my new field is comm_qsubject and is a selection but I have for example codes of 2 digits with detailed text, eg SM = Social Media.

If I enter into the OnChange Script on the comm_qsubject : comm_subject.value=comm_qsubject.value; The comm_subject is being set to 'SM'.

All I need to know is how to get 'Social Media' instead...

Thanks

  • The clientside API enables this easily

    var x = crm.fields("comp_type");

    console.log(x.text());

  • Thanks but if I use that in an On Change script my comm_subject field is not changing??

    Code used:

    var x = crm.fields("comm_qsubject");
    comm_subject.value = x.text();

    Should this work?

  • In the comm_qsubject OnChange script:

    document.EntryForm.comm_subject.value=this.options[this.selectedIndex].text;

  • Thanks Paul that works a treat!!!

    Just in case anyone wonders why I needed this.... I saw that a CRM administrator had added a 'Purpose of Call' selection to the communication screen and users were selecting from it then copying the text into Subject. When asked why, it was for 2 reasons, 1. no changes had been made to any communication lists so they could not see what they had selected. 2. When the communication showed in Outlook the subject was blank unless they did this.

    The onchange event has delighted this group of users (a telesales team) as it makes their task of adding communications so much easier.....