- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2015 01:31 PM
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!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2015 01:42 PM
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>);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2015 10:09 AM
We have just decided to move forward with out it. Thank you for your time
and effort and your answer is correct for the variable set 1.
Vstream TV Distributor
Chenelle Stewart
252-544-4404
Absolutely Free TV, Movies, Sports & PPV
<http://nrbuilder.com/i/CS11100/vstream.html>
On Fri, Oct 30, 2015 at 5:33 PM, guhann <community-no-reply@servicenow.com>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 12:21 PM
Guhan, Ok so I have another one just like the one you helped me with except it has an additional need for more populated fields from the reference icon. For this I am currently populating the Application ID, thanks to your help, however I also need to populate the "Primary IT Owner" information into the "App Owner" field, as well but its seems to be sitting on another table on the configurations items table versus the application table. Will I be able to do that? Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 01:10 PM
Onchange client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('ApplicationUtils');
ga.addParam('sysparm_name','getApplicationDetails');
ga.addParam('sysparm_application_id', g_form.getValue('v_app_id_name'));
ga.getXML(populateAppID);
function populateAppID(response) {
var answer = response.responseXML.documentElement.getAttribute("answer").split('|');
g_form.setValue('v_app_id_number',answer[0]);
g_form.setValue('<name_of_app_owner_variable>',answer[1]);
}
}
Script Include: (Ensure client callable check box is checked)
var ApplicationUtils= Class.create();
ApplicationUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getApplicationDetails: function() {
var appID = this.getParameter('sysparm_application_id');
var application = new GlideRecord("<table_name_of_business_application_record>");
application.addQuery('sys_id',appID);
application.query();
if(application.next())
{
return application.<Application_ID_Field_Name>+ '|' +application.<Application_IT_Owner_Field_Name>.getDisplayValue();
}
},
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2015 11:30 AM
ok, I will try this! MANY THANKS!!!!
Chenelle Stewart
On Tue, Nov 10, 2015 at 4:10 PM, guhann <community-no-reply@servicenow.com>