6 Replies Latest reply on May 2, 2016 4:58 AM by [email protected]

    Find number in Subject and copy

    Apprentice

      Hi all,

       

      I would like to find a 6 digits long number in the Subject of an incoming mail and copy this number into a field of the Incident BO.

      This incoming mail is the first mail which is sent by the external Partner with the information of the Call number of their system.

       

      Incoming Subject contains following line:

       

      Call 123456, Rosenber........

       

      I need the bold number and I want to copy this number into a field of the Incident BO.

       

      Any ideas?

       

      Thanks

        • 1. Re: Find number in Subject and copy
          florian1 Expert

          Hi Florian,

           

          I prefer to use regex in these cases:

          $ReplaceRegex("Call 123456, Rosenber........",
          /.*\s([0-9]+),.*/,
          "$1")
          
          

           

          This will basically search for

          "* 123456789,*"
          
          

          and return the numbers as a capture group.

           

          To test the function simply create a dummy Service Request with a text field and paste this function.

          If you don't like it you can try to use find+substring as well.. ;-)

           

           

          Cheers,

          Florian

          • 2. Re: Find number in Subject and copy
            Apprentice

            Hi Florian,

            Thanks for your help so far.

             

            I tried the find+Substing functions. I created a field at BO Journal.Email and a triggerd action in this BO. On insert this field will updated with the Call number. This works fine.

            BUT: Now i need this number in the Incident. I created another triggerd action at Journal.Email on insert. Insert Child Object -> IncidentContainsJournal -> Incident-Field = $(Journal.Email-Field (call-number)).

             

            If this action is active and i write an email with Call 445566 .... , Heat creates a new Incident. If it is not active then not, thats strange.

             

            Thanks for ideas.

            • 3. Re: Find number in Subject and copy
              Apprentice

               

              I need the RT_pA_Call_Auto Value in the pA Callnumber on the Incident Details form.

              • 4. Re: Find number in Subject and copy
                florian1 Expert

                The Regex way is cooler since it's more dynamic, but okay..

                 

                There are many different ways to get this number into your Incident..

                One option (Needs to be extended to completely fit your needs, but as a hint):

                 

                1) add a field in the Journal#Email object: ContainsPACall (bool)

                -> BeforeSave: $(nvl(PACallnumber,"") != "")

                 

                2) In the Incident object, add a relationship to Journal#Email (e.g. IncidentAssocPACalls)
                Relation: RecId = ParentLink

                Condition: $([OtherObject]ContainsPACall)

                 

                3) Add a triggered Action in your Incident:

                On Link: Journal#Email.IncidentAssocPACalls

                -> Update Incident:

                Set (PACallNumber) = $(if IsNull(PACallNumber) then [Journal#Email.IncidentAssocPACalls]PACallNumber) else PACallnumber)

                 

                The advantage of using a relationship in this case: You can add a child tab in the Incident layout and only show the communication with your partner.

                2 of 2 people found this helpful
                • 5. Re: Find number in Subject and copy
                  dcogny Expert

                  Florian D. Get a BIG beer on me!!

                   

                  I am blocked in something completely different, but when I want to reset my mind I come here and I read whatever I find interesting... You just gave me the hint I needed to solve my issue! (I didn't know about the "relationships to fields")

                  Thank you very much!

                   

                  Daniel.

                  • 6. Re: Find number in Subject and copy
                    Apprentice

                    Hi Florian,

                     

                    thanks for your help, I´ve followed all your steps, but I think, I am too stupid.

                    The field at Incident is empty again.

                     

                    It is just a nice to have.

                    Thank you very much.