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

  • 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  

  • 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.

  • 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).