Requirement is to concatenate the string field

Community Alums
Not applicable

Hi Experts,
Requirement is to concatenate the five field values and display the value in one field
1.First part is From the first filed need to select first letter 'A' from the first word and First letter 'A' from the second word. I'm unable to achieve this >> Auto Attendant should give 'AA', If for example Call Queue should give 'CQ'.I'm trying it on on change client script.
2. And the next fields I had worked on it and I'm getting an expected result in Auto Attendant name filed but my aim is to get the value in Upper case for example result should be like "AL-TIR-Operation-EN"

and the final result including 1st and 2nd part I'm expecting is for Auto Attendant it should display as "AA-AL-TIR-Operation-EN"  and If user selects 'Call Queue' in first question Auto Attendant should be "CQ-AL-TIR-Operation-EN"

Kindly help me on achieving this

 

find_real_file.png
Thanks in advance,
Chaithra

8 REPLIES 8

SumanthDosapati
Mega Sage
Mega Sage

Hi Chaithra,

For converting existing text to uppercase, you can try this

var text = "abcDeFgH";
var upper_case_text = text.toString().toUpperCase();

//now upper_case_text will have "ABCDEFGH"

 

For getting first letter of words, you can try this

var str = "Auto Attendent";
var matches = str.match(/\b(\w)/g); 
var new_str = matches.join(''); 
//new_str will have value as 'AA'

 

Mark as correct and helpful if it solved your query.

Regards,

Sumanth

Community Alums
Not applicable

Hi @Sumanth Dosapati 

Thanks for the reply.
 The code is working good in background script, but when I applied it in client script instead of "AA" for Auto Attendant it is showing as "3" where 3 is a value, Request call queue variable type is "Select box". so that in the screenshot  3 is showing is based on value instead of text

Please have a look into it.

find_real_file.png
Thanks,
Chaithra

Community Alums
Not applicable

Hi

Request call queue variable type is "Select box". so that in he screenshot  3 is showing is based on choice number.

Thanks,
Chaithra

That is may be because you are using g_form.getValue() to get the Auto Attendant.

Try this

var value = g_form.getValue('request_call_queue'); //check variable name
var displayValue = g_form.getOption('request_call_queue', value).text);

 

Now you can apply the logic of getting first two letters on 'displayValue'

You can share your script if you are not able to get it.

 

Mark as correct and helpful if it solved your query.

Regards,

Sumanth