Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Is it possible to copy string field values into a choice list??

Vimal Priya
Giga Guru

Hi All,

I have a customized table ,users can enter a value in string field those values has to be copied in another field which is of choice datatype in the same table .

Please provide your suggestions.

Thanks in advance.

1 ACCEPTED SOLUTION

Vimal Priya
Giga Guru

Hi Kalpesh,


My Requirement is a customized table ,users can enter a value in string field those values has to be copied in another field which is of choice datatype in the same table .



I used script include and client script to do this .



Script Include will insert data into the choice table and returns value .



Return value will be added in client script as an option in current table.


View solution in original post

8 REPLIES 8

Harish Murikina
Tera Guru

Hi VimalPriya,



Are you looking to set the value from field A to field B .


Ex: Field A --> Single line text


          Field B --> Choice list .



What ever user entered text that should be copied to Choice List(Field B) .



That is the case user entering text value should match the one of your choice list value. Else it wont get copy .



Regards,


Harish Murikinati.


Hi Harish,



Yeah you are correct but I want to add new values in string and that is to be copied in Choice field as well the choice list .



Thanks.


ankitbadola
Giga Expert

Hi VimalPriya S,



I have created two field A(u_a) as string and B (u_b) as Choice Type ,





Client-Script: onChange


On-field : A(u_a)



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue === '') {


          return;


    }


  var getFieldValue =   g_form.getValue('u_a');


g_form.addOption('u_b', abbc, abbc);


 


}




Regards


Ankit Badola




PS: Hit like, Helpful or Correct depending on the impact of the response


Vimal Priya
Giga Guru

Hi Harish/Ankit,



I achieved this in alternative way.Thanks for your ideas