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.

Defining a reference field in Fluent

Tommy Jensen
Giga Guru

In a SDK project I am creating two tables with fluent. One table need to have the other as a reference.

How do I define that relationship in fluent?

I have tried a few different things

parent: ReferenceColumn({
label: 'Import Job',
referenceTable: Now.ID['x_devas_importer_job'],
}),

on the parent table I have: 
$id: Now.ID['x_devas_importer_job'],


and I have tried this

parent: ReferenceColumn({
label: 'Import Job',
referenceTable: 'x_devas_importer_job',
}),

the field is created but the reference table is not populated.
1 ACCEPTED SOLUTION

Tommy Jensen
Giga Guru

Figured it out.

it is

referenceTable: 'x_devas_importer_job',

but it failed initially because at first I had used "reference" so the field was created. And once the field is crreated without the reference above update will not change anything. I had to delete the field first then deploy the app again.

View solution in original post

1 REPLY 1

Tommy Jensen
Giga Guru

Figured it out.

it is

referenceTable: 'x_devas_importer_job',

but it failed initially because at first I had used "reference" so the field was created. And once the field is crreated without the reference above update will not change anything. I had to delete the field first then deploy the app again.