The CreatorCon Call for Content is officially open! Get started here.

Populating information in a single line text variable field from the Reference icon

chenelle
Kilo Expert

I created a   single line text variable for called "application id" but the application id is also available if you hover over the reference icon.   How can i take the application id that was selected and showing from the reference icon and populate it to the variable field on the form i created so the user doesn't have to hover over the reference field.   When I create the variable as a reference...the table is not available to select, but a parent of that table is able to be selected.   Seems like i can use some type of catalog client script or something to populate the info.       See below when you hover or click the more information for the .Net Services and Console App, the Application ID is available, however the users want it to to be directly on the form and not have to hover.   Please advise.   Thanks!

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

guhann
Mega Guru

Cenelle,



Have an onChange catalog client script on the reference variable 'What is the Business Application ID?'. and using the getReference() method you can get the application id and populate the same in the single line text variable you have created.



Code inside the onChange script:


var application = g_form.getReference('<reference_variable_name>',populateAppID);



function populateAppID(application) {


      g_form.setValue('<text_variable_name>',application.<field_name_that_holds_application_id_in_the_record>);


}


View solution in original post

18 REPLIES 18

guhann
Mega Guru

Cenelle,



Have an onChange catalog client script on the reference variable 'What is the Business Application ID?'. and using the getReference() method you can get the application id and populate the same in the single line text variable you have created.



Code inside the onChange script:


var application = g_form.getReference('<reference_variable_name>',populateAppID);



function populateAppID(application) {


      g_form.setValue('<text_variable_name>',application.<field_name_that_holds_application_id_in_the_record>);


}


Yes Perfect! Thank you Guhan!   I will try this out!  


Sure. Do let me know if any doubts. Please mark the thread as helpful/answered if it was helpful.


So the script is working its just saying [object Object]   instead of the app id.   I have left something out///


find_real_file.png



My script is :



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


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


     


      return;


    }


var application = g_form.getReference('v_business_app_id',populateAppID);



function populateAppID(application) {


      g_form.setValue('v_app_id_number',application);


}


    //Type appropriate comment here, and begin script below


   





}



Please advise