'undefined' value is populating on string fields when are copied from other record.

kirthi1
Tera Contributor

'undefined' value is populating on string fields when they are copied from other records.

When the record producer related to purchase request catalog item is submitted from the portal, the 'undefined' is not seen.

But when the record is submitted from the application, the 'undefined' field is seen as below.

find_real_file.png

When the 'New' button is clicked under the funding code the new record copies fields from the first record.

find_real_file.png

This is code that copies the field values on the Funding code from first inserted record to the second inserted record.

find_real_file.png

10 REPLIES 10

Balaji Jagannat
Kilo Guru

Hi In this script, you are loading the scratch pad variable. There will be a OnLoad client script for the Funding Code table where you will be assigning the scratchpad value to the forms field like object, unit and department etc. Check that script and see, if by mistake, activity, program and the other field with undefined value is getting getting set. Then that could be the cause for this issue. You may need to check for the valid value (!=undefined) before setting it.

 

** Mark this response as accepted answer and helpful, based on impact:

Hi Balaji, 

Sorry for the delayed response. 

You were right there is a client script for the g_scratchpad, but there is no 'undefined' value set here. 

Should I modify the script here?

defining only g_scratchpad variable in if block will not work. 

 

comment the line number 4 if block, and then try. 

another question , why are you using another if block in line number 4 ? try to comment that as well.

 

If my answer helped you, kindly mark it as correct and helpful.

 

Hi, for the 3 fields that you get undefined, comment the line 12, 13 & 14.

 

OR alternatively, you can do a if check and then have each of those line

like

if(g_scratchpad.program){

g_form.setvalue('u_program_code', g_scratchpad.program);

}

Repeat this code for other 2 fields.

 

**Mark this response as accepted answer and helpful, based on impact.