Not able to query the 'Item Produced Records (sc_item_produced_record)' table in Script include.

Pallavi_G
Tera Expert

I am trying to query the table 'Item Produced Records (sc_item_produced_record)' in script include. I want the record producer name from the incident sysid. I wrote the below code. Here 'case_numb' is having incident sysid. But it is not going inside if loop.

Pallavi_G_0-1729682671830.png

 

But if i am hardcoding the sysid it is working fine

Pallavi_G_1-1729683058029.png

 

Can anyone help in it.

 

Thanks is Advance

 

8 REPLIES 8

Brad Bowman
Kilo Patron
Kilo Patron

Is 'case_numb' passed into the Script Include function as an argument, or where is this defined / coming from?  Have you logged 'case_numb' prior to this portion of the script to ensure it contains the expected sys_id value?

Yes it is coming as an argument and i have checked by adding logs and the value is coming correctly. The same 'case_numb' i am using in the same function for Gliding another table and in that it is working fine.

That is odd.  Is the other usage of case_numb in this function before or after this one?  Is it also used on a field that is a reference to the task table?  Did you log it directly before this GlideRecord?  Maybe try 

item_name.addQuery('task', case_numb.toString());

in case it's coming in with a different type somehow

Thanks for the response but case_numb.toString() this did not worked. Other usage of case_numb is before and it is like this below which is working fine
Pallavi_G_1-1729692419322.png