1 2 Previous Next 15 Replies Latest reply on Feb 23, 2018 2:19 AM by Bo.Rimpler

    Most recent xslt template to update incident

    Pandor Apprentice

      Hi All,

       

      I'm currently working on updating incidents via xslt. 

      Does anyone have the most recent xslt template to update incidents, if so I kindly request for it. 

       

      Thank  You

        • 1. Re: Most recent xslt template to update incident
          AlasdairRobertson ITSMMVPGroup

          Hi Pandor

           

          This article will help you, works out of the box you may need to tweak it for your system requirements.

           

          Email Listener XSLT to update all objects

          • 2. Re: Most recent xslt template to update incident
            Pandor Apprentice

            Hi AlasdairRobertson,

             

            Thanks for your quick response. I have the template, just that I anticipated a more recent one.

             

            Thanks again

            • 3. Re: Most recent xslt template to update incident
              AlasdairRobertson ITSMMVPGroup

              That one works in the latest 2017 version I tested it a couple of days for a customer.

              • 4. Re: Most recent xslt template to update incident
                Bo.Rimpler Employee

                Hi Alasdair

                It seems to be a common challenge to get incoming emails to update Service Requests and other objects.

                Is it possible that you could briefly outline the steps to make this work, both in terms of Inbox configuration and how and where to add the XSLT if using the one above to update all objects?

                • 5. Re: Most recent xslt template to update incident
                  Pandor Apprentice

                  Hi Bo.Rimpler

                   

                  Below is how I set up the email listener incoming record creation settings.

                  This to allow users to send emails formatted in XML to ISM. The system uses an XSLT script to convert the XML-formatted email into the supported XML format that ISM uses to create,or update an incident or any other business object.Select the EmailXML with XSLT data import connection.

                  To support Unicode characters within the email body, I checked the  Compress Message checkbox.

                  For setting up the data import connection, go to Integration Tools and make sure the selected EmailXML with XSLT data import connection is activated.

                  Set up the configuration as below. Under main XSLT, copy and paste your XSLT or upload the XSLT file. Test connection and on success,save

                  Send an XML email to the email listener address. Check the integration log to check the processed emails as well as failed statistics to check where the error was,if any.

                  From the front end,check the email top level tab. Open the email you sent,depending on what the XSLT does, either creating a new object or updating it; click on open parent to open the object record. In the instance below,the XSLT is updating the incident record. As indicated,opening in parent, the parent record to be updated(Incident# 11090) is opened

                   

                  That's how far I have gone. However I'm open to any additions and corrections.

                  3 of 3 people found this helpful
                  • 6. Re: Most recent xslt template to update incident
                    AlasdairRobertson ITSMMVPGroup

                    hehe that looks good to me, I started writing this morning the response but you beat me to it.

                    • 7. Re: Most recent xslt template to update incident
                      brimpler Rookie

                      Good stuff, Pandor, thanks a lot!

                      • 8. Re: Most recent xslt template to update incident
                        Pandor Apprentice

                        AlasdairRobertson, Hahaha! Funny how I managed to beat you to it. Thought I was late.

                        Bo.Rimpler

                        brimpler

                        Glad it helped!

                        • 9. Re: Most recent xslt template to update incident
                          Bo.Rimpler Employee

                          Hi Pandor

                          I have been testing this, and in general it works fine, e.g. associating incoming emails to Incidents and Service Requests correctly.

                          Only one thing is not working for me, which is Service Request Approval by replying "Approved" to an email.

                           

                          Looking at the processed emails, the email seems to be processed as expected, and is even associated to the correct Service Request and Approval

                           

                          However the Approval is never updated to Approved status, but stays at Pending:

                           

                          The header of the Approval - Status is blank...

                           

                          As you see the email subject is formatted as "Approval# 1562 for ServiceReq# 10194"

                          Any ideas?

                           

                          Best regards

                          Bo

                          • 10. Re: Most recent xslt template to update incident
                            AlasdairRobertson ITSMMVPGroup

                            Here you go Bo.Rimpler

                             

                            Update the content of Approval_Update.xsl and re-upload it to the Data Import transformation, delete the old file, click save then upload it and click save.  It is based upon the sample one which is slightly flawed around the selection of the email body value.  This version should be used with just a single word in the email body Approved or Denied.  I usual use a mailto: link in the outgoing mail to correctly format the mail I want to be returned, then the sender can check their approval decision and press save.

                             

                            <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
                            <xsl:template match="/" name="Approval_Update">
                            <BusinessObjectList SchemaVersion="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="HierarchicalObjects-1.0.xsd">
                            <!-- BEGIN: Define Variables -->
                            <!-- find the profile link recid of the email sender -->
                            <xsl:variable name="profilelink_recid">
                            <!-- for each RelatedBusinessObject -->
                              <xsl:for-each select="BusinessObjectList/BusinessObject/RelatedBusinessObjectList/RelatedBusinessObject/BusinessObject">
                            <xsl:choose>
                              <xsl:when test="@Name = 'Employee'">
                            <xsl:for-each select="./FieldList/Field">
                              <xsl:choose>
                            <xsl:when test="@Name = 'RecId'">
                              <xsl:value-of select="."/>
                            </xsl:when>
                              </xsl:choose>
                            </xsl:for-each>
                              </xsl:when>
                            </xsl:choose>
                              </xsl:for-each>
                            </xsl:variable>
                            <!-- find the profile link category of the email sender -->
                            <xsl:variable name="profilelink_cat">
                              <!-- for each RelatedBusinessObject -->
                              <xsl:for-each select="BusinessObjectList/BusinessObject/RelatedBusinessObjectList/RelatedBusinessObject/BusinessObject">
                            <xsl:choose>
                              <xsl:when test="@Name = 'Employee'">
                            <xsl:value-of select="'Employee'"/>
                              </xsl:when>
                            </xsl:choose>
                              </xsl:for-each>
                            </xsl:variable>
                            <!-- find subject and subjectID -->
                            <xsl:variable name="emailSubject" select = "BusinessObjectList/BusinessObject/EmailMessage/Subject" />
                            <xsl:variable name="emailSubjectID" select = "BusinessObjectList/BusinessObject/EmailMessage/SubjectID" />
                            <xsl:variable name="emailBody" select = "BusinessObjectList/BusinessObject/EmailMessage/Body" />
                            <xsl:variable name="EmailStatus" select="substring-before($emailBody,' ')"/>
                            <!-- END: Define Variables -->
                            <xsl:for-each select="BusinessObjectList/BusinessObject">
                            <xsl:element name="BusinessObject">
                            <xsl:attribute name="Name"><xsl:value-of select="'FRS_ApprovalVoteTracking'"/></xsl:attribute>
                            <xsl:element name="Transaction">Update</xsl:element>
                            <!--Unique Key List-->
                            <xsl:element name="UniqueKeyList">
                            <xsl:element name="UniqueKey">
                            <xsl:element name="Field">
                            <xsl:attribute name="Name"><xsl:value-of select="'TrackingID'"/></xsl:attribute>
                            </xsl:element>
                            </xsl:element>
                            </xsl:element>
                            <FieldList>
                            <!-- Fields -->
                            <xsl:for-each select="EmailMessage/node()">
                            <xsl:choose>
                            <xsl:when test="name() = 'SubjectID'">
                            <xsl:element name="Field">
                            <xsl:attribute name="Name"><xsl:text>TrackingID</xsl:text></xsl:attribute>
                            <xsl:attribute name="Type">System.Int32</xsl:attribute>
                            <xsl:value-of select="."/> 
                            </xsl:element>
                            </xsl:when>
                            <xsl:when test="name() = 'Body'">
                            <xsl:element name="Field">
                            <xsl:attribute name="Name"><xsl:text>Status</xsl:text></xsl:attribute>
                            <xsl:choose>
                            <xsl:when test="$emailBody = 'Approved'">
                            <xsl:text>Approved</xsl:text>
                            </xsl:when>
                            <xsl:when test="$emailBody = 'Denied'">
                            <xsl:text>Denied</xsl:text>
                            </xsl:when>
                            <xsl:otherwise>
                            <xsl:text></xsl:text>
                            </xsl:otherwise>
                            </xsl:choose>
                            </xsl:element> 
                            <xsl:element name="Field">
                            <xsl:attribute name="Name"><xsl:text>Reason</xsl:text></xsl:attribute>
                            <xsl:choose>
                            <xsl:when test="$emailBody = 'Denied'">
                            <xsl:text>Denied by Email</xsl:text>
                            </xsl:when>
                            <xsl:otherwise>
                            <xsl:text></xsl:text>
                            </xsl:otherwise>
                            </xsl:choose>
                            </xsl:element>
                            </xsl:when>
                            </xsl:choose>
                            </xsl:for-each>
                            </FieldList>
                            <!-- Copy the RelatedBusinessObjectList element-->
                            <xsl:element name="RelatedBusinessObjectList">
                            <xsl:for-each select="RelatedBusinessObjectList">
                            <xsl:copy-of select="node()"/>
                            </xsl:for-each>
                            </xsl:element>
                            </xsl:element>
                            </xsl:for-each>
                            <!--</xsl:element> -->
                            <!--</xsl:element> -->
                            </BusinessObjectList>
                            </xsl:template>
                            </xsl:stylesheet>
                            
                            1 of 1 people found this helpful
                            • 11. Re: Most recent xslt template to update incident
                              Bo.Rimpler Employee

                              Thanks a lot Alasdair

                              Just to avoid mistakes, can you clarify your comments regarding the email - do you mean that I should change the Service Request Approval Notification email, and how do you use the mailto: link?

                               

                              • 12. Re: Most recent xslt template to update incident
                                AlasdairRobertson ITSMMVPGroup

                                Keep the outgoing mail the same its the incoming mail that my comments apply to...here is the mailto: link you can add to your outgoing mail.

                                 

                                 

                                <a href="mailto:[email protected]?subject=Approval# $(TrackingID)&Body=Approved">Approved</a>

                                • 13. Re: Most recent xslt template to update incident
                                  Bo.Rimpler Employee

                                  Sorry for being stupid, I am not really familiar with this email stuff, but where do I put that?

                                  • 14. Re: Most recent xslt template to update incident
                                    AlasdairRobertson ITSMMVPGroup

                                    In the body for the outgoing email, when clicked it should open a new mail in the local mail client pre formated:

                                     

                                     

                                    here is a link to the mailto command details: mailto | HTML mailto link

                                    1 2 Previous Next