Absent Member.. emaasalmi Absent Member..
Absent Member..
781 views

Move attachment from Interaction to Incidents

Jump to solution

Hi experts,

SM9.33 in use.

Has anyone implemented a solution for moving an attachment from Interaction to Incident or is this even possible? I've found a couple of different ways for copying attachments from Interaction to Incidents, but this just results in a lot of duplicate data and I'd really get rid of that. I'm also aware of the solution of displaying the Interactions' attachments on Incidents instead of copying them, but that doesn't really help me here.

 

My use case is the following:

An interaction with attachment(s) is created automatically in SM9 by an external application (using webservices). Service Desk escalates the ticket to Incident. The Incident is then assigned to another assignment group which triggers an integration to send the Incident data to a 3rd party system using webservices.

Currently the service desk needs to manually save the Interaction's attachment and add it to the Incident before assigning the ticket to 3rd party. This of course again results in duplicate attachments.

 

Any tips appreciated!

Tags (1)
0 Likes
1 Solution

Accepted Solutions
ALARMus Acclaimed Contributor.
Acclaimed Contributor.

Re: Move attachment from Interaction to Incidents

Jump to solution

You can try to use triggers to change record in SYSATTACHMENT table.

Change value of APPLICATION field from incidents to probsummary and TOPIC field from incident ID to probsummary NUMBER.

6 Replies
ALARMus Acclaimed Contributor.
Acclaimed Contributor.

Re: Move attachment from Interaction to Incidents

Jump to solution

You can try to use triggers to change record in SYSATTACHMENT table.

Change value of APPLICATION field from incidents to probsummary and TOPIC field from incident ID to probsummary NUMBER.

Absent Member.. John Stagaman Absent Member..
Absent Member..

Re: Move attachment from Interaction to Incidents

Jump to solution

There are existing forum posts which include the solution:

Option 1: add an HTML object to the incident to display attachments from related records. This has the advantage of keeping the attachments from the end user at the Interaction and visible to them in self service. 

http://community.hpe.com/t5/Service-Manager-Support-Customer/SM-Tip-SD-attachments-not-auto-moving-in-to-related-IMs/m-p/6416860/highlight/true#M3843

Option 2: move Interaction attachments to the incident at escalation:

http://community.hpe.com/t5/HPE-Service-Manager-Service/Copy-the-attachment-from-interaction-to-incident/m-p/5215621/highlight/true#M69768

Note that the second option in the above thread copies rather than moves the attachments (the blobcopy option).

 

 

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
Absent Member.. emaasalmi Absent Member..
Absent Member..

Re: Move attachment from Interaction to Incidents

Jump to solution

Thank you for the tips, both of you. I was already familiar with John's suggestions as stated in my original post, but a good recap nevertheless 🙂

I ended up creating a button (using displayoption) for copying the attachment from Interaction to Incident, and then automatically deleting the attachment linked to the Interaction table afterwords.

 

Copying of the attachment is now done with the following expression in the displayoption's Post RAD expression tab:

$L.copy.attachments=rtecall("blobcopy", $L.return.code, "incidents", incident.id in $L.file, "probsummary", number in $L.file)

 

Deletion of the Interaction's attachment is done in a new After Add -trigger for SYSATTACHMENTS table with the following JavaScript. Note that the $G_moveAttachments has been set to true in the displayoption's Pre JavaScript tab to make sure that this trigger is only called when the button is used, and not when an attachment is added manually:

if (vars.$G_moveAttachments==true && record.application == "probsummary" && record.segment == 0)
{
    var sysAttach = new SCFile("SYSATTACHMENTS");
    sysAttach.doSelect("application=\"incidents\" and uid=\""+record.uid+"\" and filename=\""+record.filename+"\"");
    
    if ( getLastRC() == RC_SUCCESS )
    {
        sysAttach.getFirst();
        while( getLastRC() == RC_SUCCESS )
        {
            sysAttach.doDelete();
            sysAttach.getNext();
        }
    }
}        

vars.$G_moveAttachments = false;

0 Likes
ALARMus Acclaimed Contributor.
Acclaimed Contributor.

Re: Move attachment from Interaction to Incidents

Jump to solution

If do not use a button.

FC (call JS from calculation) for SYSATTACHMENTS after ADD  (to copy attach from incidents to probsummary)

if (record.application == "incidents")
{
print("_ runing...");
var SourceFile = new SCFile("SYSATTACHMENTS");
var proList=new Array();
proList=findLinkedIM(record);

for (i=0;i<system.functions.lng(proList);i++)
{
var flag =SourceFile.doSelect("application=\"probsummary\" and topic=\""+proList[i]+"\" and type="+record.type+" and segment="+record.segment+" and uid=\""+record.uid+"\"");
if (flag!=RC_SUCCESS)
{
var filename= SourceFile.topic+"_"+SourceFile.filename;
print("FileName: "+filename+" , Copying segment.."+record.segment);

var TargetFile=new SCFile("SYSATTACHMENTS");
system.functions.fduplicate(TargetFile,SourceFile);

TargetFile.application = "probsummary";
TargetFile.topic = proList[i];
TargetFile.filename = filename;

if (TargetFile.doInsert()==RC_SUCCESS)
print("Segment Copy Done...");
}
}
}


function findLinkedIM(record)
{
var IMTickets=new Array();

var screlationFile = new SCFile("screlation");
var probsummary = new SCFile("probsummary");
var QueryStatus = screlationFile.doSelect("depend=\"" + record.topic + "\"");

while (QueryStatus == RC_SUCCESS)
{
if (probsummary.doSelect("number=\"" + screlationFile.source + "\"")==RC_SUCCESS)
{
if (probsummary.problem_status != "Resolved" && probsummary.problem_status != "Closed")
IMTickets.push(probsummary.number);
} 
QueryStatus=screlationFile.getNext();
}
print(IMTickets);
return IMTickets;
}

 

 And then in same line of calculation use one more call of JS to delete (or add this codes lines to one script)

 

0 Likes
ajazkhan
New Member.

Re: Move attachment from Interaction to Incidents

Jump to solution

@emaasalmi:

I am using SM 9.40. I am creating an interaction using webservice (such as soap ui) and interaction is getting created into Service Manager. However, I am not able to create interaction with attachment using webservice. May you help me in solving it. Your response will be appreciated.

Thanks

0 Likes
Absent Member.. emaasalmi Absent Member..
Absent Member..

Re: Move attachment from Interaction to Incidents

Jump to solution

Hi, unfortunately I'm not familiar with that, sorry.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.