Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Broken attachment links

Highlighted
Peter Dent
Frequent Visitor

Broken attachment links

Hi,

I'm running SD 4.5 on SP17.

From time to time we get an error when trying to open an attachment from an existing item.

The link seems to be broken.

Is there a way to recreate the link from the item to the attachment, other that re-attaching the file again?

Thanks
13 REPLIES
Ruth Porter
Honored Contributor

Re: Broken attachment links

Hi Peter,

Have you tried using the Maintenance Tab on Tools>System>System Panel>Attachment settings? This should tell you the ones where the link is broken but not sure it helps!

Have you any idea why it happens? Could you use a hyperlink (file://) to a shared drive instead?

Regards, Ruth
http://www.teamultra.net
Peter Dent
Frequent Visitor

Re: Broken attachment links

Ruth,

No idea why it happens?

I haven't tried the maintenance Tab, maybe I'll run it overnight?

Thanks for the idea of the Hyperlink and shared drive, I'll keep it in mind.
Rory Emmans
Member

Re: Broken attachment links

Did you have this problem before moving to SP17? Just wondering because there is a procedure you have to follow after the upgrade to SP17 because SD stores attachments differently after SP16
Peter Dent
Frequent Visitor

Re: Broken attachment links

Hi,

We started to use SD on SP15 but, we moved to SP17 very soon afterwards so I couldn't say if the problem occured before SP17.

Anyway we were aware of the different attachment method and we ran the script and it seemed to work ok.
Peter Dent
Frequent Visitor

Re: Broken attachment links

After some initial investigation, looking at the data in the DB, I've found that the attchments with the broken links have a different OID than that of the parent item.

I mean it seems as though either the original item (Problem, Service Call etc.) has changed its OID,

OR

The attachment has had the AHS_ATT_OID field changed. This is the field that holds the OID of ITEM that has the attachment.

Basically the attachment no longer points to the original parent item?

I could only find it by searching the database for the name of the attachment.

I don't understand how this can happen?

Any ideas
George M. Meneg
Honored Contributor

Re: Broken attachment links

Hello Peter,

Normally broken links generated when files are deleted and REP_ATTACHMENTS has pointers to non-existing files.

Change of OID cannot happen. Is there any chance that you have a typo in your query?

Run these two queries:

select count (*) from ITSM_SERVICECALLS where SER_ATTACHMENT_EXISTS=1

select distinct ser.ser_id from rep_attachments ahs inner join itsm_servicecalls ser on ahs.ahs_att_oid=ser.ser_oid
where ahs.ahs_ent_oid = (select ent_oid from ifc_entities where ent_name='Service Call')

The number of the rows returned should be the same.
menes fhtagn
Peter Dent
Frequent Visitor

Re: Broken attachment links

George,

I've tried running the SQL you posted the first count returns a number bu the second statement returns nothing?

No errors, just "No Rows Returned"?
George M. Meneg
Honored Contributor

Re: Broken attachment links

Can't be!

The second query returns (distinct) ids for service calls with attachments.
menes fhtagn
Peter Dent
Frequent Visitor

Re: Broken attachment links

George,

I assure you it returns no rows?

Could it be something to do with the fact that we use an Oracle database?

Does the structure differ or is the SQL syntax slightly different?
George M. Meneg
Honored Contributor

Re: Broken attachment links

Nope, the sql is perfectly valid. TOAD for Oracle, validate it.

OK, let's follow a different approach.

Execute first the query

SELECT ent_oid FROM ifc_entities WHERE ent_name = 'Service Call'
to get the ent_oid of Service Call.

Then run this query:

SELECT DISTINCT ser.ser_id FROM rep_attachments ahs, itsm_servicecalls ser
where ahs.ahs_att_oid = ser.ser_oid
and ahs.ahs_ent_oid=
menes fhtagn
Peter Dent
Frequent Visitor

Re: Broken attachment links

George,

OK, I think I know what the problem is, my fault for not being specific.

I'm running this against one of our systems which doesn not use Service Calls!

They use it for Problem Management. So I've run the following:

select distinct ser.pro_id from rep_attachments ahs inner join itsm_problems ser on ahs.ahs_att_oid=ser.pro_oid
where ahs.ahs_ent_oid = (select ent_oid from ifc_entities where ent_name='Problem')

Not pretty I know but it did return something.... 804 rows, (I use Toad by the way).

The first (also amended), query which did the count returned a count of 804.

select count (*) from ITSM_problems where pro_ATTACHMENT_EXISTS=1

So the numbers do match. Its just that not all of them point to the correct OID's.
George M. Meneg
Honored Contributor

Re: Broken attachment links

Hello Peter,

If the numbers match so must be the OIDS. To see that just run this query:

selectpro_oid from ITSM_problems where pro_ATTACHMENT_EXISTS=1 and pro_oid not in
(
select pro.pro_oid from rep_attachments ahs inner join itsm_problems pro on ahs.ahs_att_oid=pro.pro_oid
where ahs.ahs_ent_oid = (select ent_oid from ifc_entities where ent_name='Problem')
)

This query should return no rows.
menes fhtagn
Peter Dent
Frequent Visitor

Re: Broken attachment links

George,

You are correct that query returns no rows.
//Add this to "OnDomLoad" event