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

I got it!!!   yayy thank you!     i had to find this right here: <field_name_that_holds_application_id_in_the_record>);



It's working now!


chenelle
Kilo Expert

Thank you Guran. We actually are just going to not worry about it unless you can help.   So on the variable set 1, it was used as part of the requestor's information.   And that was on the form and selected before clicking order now.   So the script that I had for that did run successfully when on variable set 1.   However, they wanted it on variable set 2 which is on the ritm and task level in the item details, but only for the fulfillment groups use only after the ritm was created.   So once the ritm was created after clicking order now.   The fulfillment group could then go on the ritm or the task and select a business application and an Application id would populate, however the same script for variable set 1, doesnt pull the app id, for variable 2.   This was the script I used.





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


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


     


      return;


    }


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



function populateAppID(application) {


      g_form.setValue('v_app_id_num',application.u_app_id);


}


    //Type appropriate comment here, and begin script below


   





}




Thanks!


Chenelle,



I got your scenario. Looks like you need the onChange script to execute on the RITM/TASK forms. So for this you have to enable the check boxes 'Applies on Requested Items' and 'Applies on Catalog Tasks' respectively in the onChange catalog client script you have.



Please mark the response as helpful if it answers


I did that the same day I had the issues, but it still didn't work. The


script won't filter through



Chenelle Stewart


252-544-4404


could you please replicate ur scenario in a demo instance? so that I can check whats going wrong