Highlighted
New Member.
404 views

Copy closure comment from Change ticket to interaction using triggers

Hello Experts,

 

I have to copy the closure comment from change ticket to interaction (only closure comment) after closing the change ticket. Can anyone suggest me the same. I would like to use the triggers.

 

thanks ,

Prasad

0 Likes
3 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Copy closure comment from Change ticket to interaction using triggers

Hi,  

Create new trigger for cm3r table, type, after update;

put following in Script section 

 

if (status.record=="closed" &&  oldrecord.status!="closed") lib.YorSLName.copyClosingComments(record.number, record.closing_comments);

should be one string

 

In your SL for YourSLname 

add

bellow code

function copyClosingComments(id, solution){
var scRelFile = new SCFile("screlation",SCFILE_READONLY);
var incFile = new SCFile("incidents");	 
var closureComments = "Closure comments from related change "+id+":\n"+solution;
if (scRelFile.doSelect("source=\""+ id +"\" and depend.filename=\"incidents\"")==0){
	do{ if (incFile.doSelect("incident.id=\""+scRelFile.depend +"\"")==0){
		incFile.resolution=system.functions.insert(incFile.resolution,1,1,closureComments)
		incFile.doUpdate();
		}else continue;//continue if screlated record exist, but interaction not found    
	} while (scRelFile.getNext()==0)
	return; //exit when finish; 
} else return; // exit if no interaction related  
}

HTH  

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Copy closure comment from Change ticket to interaction using triggers

I'd also recommend checking out the tables called ioevents and ioaction. That duo is covered in SM help under the topic "Interoperability". It works pretty much like triggers but in my opinion it's more maintenable than triggers are.

 

One advantage is that (at least the help file promises) is the usage of schedule. I have not tested this feature thoroughly, but it should prevent the failed updates that are caused by other users locking tickets. To my knowledge, if the resource to be updated is locked by another user, the schedule record should be rescheduled and therefore it's safe to use.

---
Moving on, this account is no longer active. Best regards, Kelalek
- So Long, and Thanks for All the Fish
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Copy closure comment from Change ticket to interaction using triggers

There actually isn't a need to configure a trigger or use interoperability for this task.

 

In the SD Environment Record, there is a section of post back links that define which fields should be copied back to an interaction at escalated record closure (they copy the Incident resolution code to the Interaction, for example). You can update the post back link for changes to post the closure comments to the SD solution field. 

 

Update the field mapping in the link line detail of the ChM Post Back Link (cm3r.incident.post.back) to include the fields you want to copy back. I've seen some delays with this taking effect (I think they are caching the link record at process start, so I'd recommend restarting the SM service before testing).

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
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.