Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Not able to fetch the parent field

sushma9
Tera Contributor

Hi Team,

 i am working on a requirement and when i am trying to fetch the parent information i am not able to get the parent.

issue:  Table A has reference to Table B and Table B has reference to Table C but Table C does not have any relation with table A. I am writing a Br on  to fetch the  number field in Table B which is having the reference of Item number in Table c .When i am trying to get the parent of number in C table i am not getting. Please find the script below.

Error :  current.parent is getting as Undefined.

Script :

asyn BR insert and Table is C

gs.info("start----" + current.parent);
    var gr=new GlideRecord("B");
    gr.addEncodedQuery('item_number=' + current.parent);
 
 
2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @sushma9

Can you please elaborate more on "reference" setting, does it means that table B has some columns from table C [ as per table definition ], you said "parent of number in C table" what does it means other than if there is column name parent in table B which is reference type of Table C.  

 

I would rather suggest to "explain your actual business problem" along with some work [screenshot shots ] you has done so far to get better help from community. 

 

Refer 

https://www.servicenow.com/community/itsm-forum/script-to-fetch-all-fields-from-a-table-which-is-not...

 

-Thanks,

AshishKMishra


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Marcus Walbridg
Tera Expert

I don't really see the point to this.

  • A has a reference to B
  • B has a reference to C
  • C does not have a reference to A or B?

 

What is the business rule meant to do, the way this sounds to be set up is difficult to dot walk