- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 01:53 PM
I need to display some content in Multiline text only when I select particular variable . Currently I have written a Script include and Cliet script for the same. In form level after i select specific variable the Multiline text field is getting displayed but the content in the text is not getting displayed. Below is my Client script please suggest me what ca be done to resolve the issue.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var server_sys_id = g_form.getValue('ServerCI');
var ga = new GlideAjax('fmr_add_backup_FS');
ga.addParam('sysparm_name', 'validateRequestDetails');
ga.addParam('sysparm_tvm', server_sys_id);
ga.getXML(getResponse);
function getResponse(response) {
var fsDetail = response.responseXML.documentElement.getAttribute('answer');
alert(fsDetail);
if (complete-partial == 'Partial'){
g_form.setValue('File_System_detail', fsDetail);
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2020 06:11 AM
Are you getting the results that you expect with your alert of fsDetail? If not, make sure the script include has the Client callable box checked, and post it here for review. Whether you are getting the correct answer back from the server script or not, this line is not correct, so the variable value will never get set since the if statement can never evaluate to true
if (complete-partial == 'Partial'){
What is complete-partial? That is not defined anywhere. If it is a variable, change this line to
if (g_form.getValue('complete-partial') == 'Partial'){
unless this onChange script is running on this variable, then you can just use
if (newValue == 'Partial'){
in either case provided 'Partial' (case-sensitive) is the Value of a select box choice list, or whatever type this is.
If complete-partial is something that is coming back from the server, different syntax is needed to make that work, but I'd need to see the script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2020 05:29 AM
It looks like your if statement should be
if (g_form.getValue('complete_partial') == 'Partial'){
but the test you did setting the value outside of the if statement probably means there is another issue too. What variable is this script running onChange of? In the details of the Catalog UI Policy Action for File_System_detail on the UI Policy pictured above, Is the Clear the variable value box checked?
Can you also try to change Read only to false to see if that makes a difference? The client script should still be able to populate that field, but if this is the hold-up we can take read only out of the UI policy and add it to the client script after the value is populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2020 10:23 AM
Can you replace g_form.setValue('File_System_detail', fsDetail); to g_form.setValue('File_System_detail', fsDetail,fsDetail);
Second argument is the displayvalue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2020 01:17 PM
Hi rajneesh,
I tried the above modification in my script . But still facing the same issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2020 06:44 AM
Hi,
Check whether you have return some value from Script include.
Regards,
Hemant

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2020 08:37 AM
HI,
From where you get this:
if (complete-partial == 'Partial')
i dont see this in script declared anywhere.
Thanks,
Ashutosh