Please help to achieve below scenario.
I have created one request in one of my application in serena. I have added multiple file attachments to this request.
Now I need to create a sub request from this request in the same application. I have achieved his through sub task transition. However I need to post all attachments to new sub request automatically after transition happened.
I know this direct mapping is not available. So I have created below script and added as post transition action.
While performing transition, script is executing without any error, but the attachments are not getting posted to new request. Please let me know what is wrong with my script and how to achieve this.
dim OriginalRequestId, NewRecordTS_ID
dim NewAttachment, AuthID, Type, Title, Contents, SRCTABLEID, FILENAME, ACCESSTYPE, subType, output
NewRecordTS_ID = Shell.Item.GetId()
Call Shell.Item.GetFieldValue ("ORIGINATING_WORK_REQUEST", OriginalRequestId)
Set sysRec = Ext.CreateAppRecordList(Ext.TableID("TS_ATTACHMENTS"))
whereClause = " ts_type = 16 AND TS_SRCTABLEID = 1028 AND ts_caseid = "& OriginalRequestId
If sysRec.ReadWithWhere(whereClause) Then
Call Ext.LogErrorMsg("First "+whereClause)
For Each rec in sysRec
set NewAttachment = Ext.CreateAppRecord(Ext.TableId("TS_ATTACHMENTS"))
call rec.GetFieldValue ("TS_AUTHORID", AuthID)
call rec.GetFieldValue ("TS_TYPE", Type)
call rec.GetFieldValue ("TS_TITLE", Title)
call rec.GetFieldValue ("TS_CONTENTS", Contents)
call rec.GetFieldValue ("TS_SRCTABLEID", SRCTABLEID)
call NewAttachment.SetFieldValue("CASEID", NewRecordTS_ID)
output = NewAttachment.Add()
If output = 0 Then
Call Ext.LogErrorMsg("Error copying attachement")
Accepted AnswerEmployeeLynn MattieOffline
Accepted AnswerRoger JensenOffline0A different option would be to embed a report in subtask pointing back to the master record and include attachments in the report. Then anyone viewing the subtask would see a list of attachments on the main record.
It would avoid the messiness of trying to parse out the attachment table, plus it would stay correct if someone edited the attachments on the main project.
I don't believe a transition event is triggered on editing attachments, so someone could delete attachments on the main record and you would have no way of catching it and updating the subtask (plus the code would be very tricky to find the added/removed attachment).