I have created a database view (between attachment & incident table)

utsavjaiswa
Giga Contributor

Hello Everyone, I have created a database view between attachment & incident table..with clause as:-

incident_sys_id=attachment_table_sys_id

By this clause it is working as expected.But suppose if a incident record is having 5 attachments then it is showing same 5 records differently..I want to make it a single to reduce the duplication.

Is there any way??

Warm Regards

Utsav

21 REPLIES 21

@utsavjaiswa 

 

Did you get a chance to review this ?

 

If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

@utsavjaiswa 

 

Thanks for marking the post as helpful.

 

Please review and if my response helped to guide you or answer your query, please accept the solution.

 

Thanks,

Bhuvan

utsavjaiswa
Giga Contributor

Lets suppose instead of incident table I am having case table then what will be my approach...since in the case table we do not have any attachment related field.

Even, I have created it:-

case_sys_id=attachment_table_sys_id

Then, if a case record is having 5 attachments then it is showing same 5 records differently..I want to make it a single to reduce the duplication.

@Ankur Bawiskar @Bhuvan  @Brad Bowman  @M Iftikhar 

Thanks in Advance
Utsav

@utsavjaiswa 

not possible.

it's the same behavior as every table will have linkage with sys_attachment using table_sys_id field

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

A Database View will inherently always show one row for each record in each joined table, that is its purpose.  If you don't want to see repeated rows, use a report or list view on the source or attachment table or your database view table, grouping by an appropriate field.  It really depends on what you are actually trying to achieve by this - you could also run a script/report using GlideAggregate or GlideRecord to return only records that have an attachment...