Display content in Multiline text

shruthi17
Kilo Explorer

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);

}

}

}

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

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.

 

View solution in original post

14 REPLIES 14

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?

find_real_file.png

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.

Can you replace g_form.setValue('File_System_detail', fsDetail); to g_form.setValue('File_System_detail', fsDetail,fsDetail);

 

Second argument is the displayvalue

Hi rajneesh,

I tried the above modification in my script . But still facing the same issue. 

Hemant Goldar
Mega Sage
Mega Sage

Hi,

Check whether you have return some value from Script include.

Regards,

Hemant

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,


From where you get this:

if (complete-partial == 'Partial')

i dont see this in script declared anywhere.

 

Thanks,
Ashutosh