11 Replies Latest reply on Feb 23, 2017 10:04 PM by vee

    How can you auto-populate E-mail Subject from the parent?

    joetetley Apprentice

      I would like to set the Subject of a new e-mail to be the ParentLink_Category followed by the relevant ID.  I've done this successfully for the reply and forward functions using this sort of expression:

       

      $(if ParentLink_Category == "ServiceReq"  then "Case: " + [ServiceReq#.JournalEmailAssocServiceReq]ServiceReqNumber + " RE: " + Subject

        else "Incident: " + [Incident#.JournalEmailAssocIncident]IncidentNumber + "RE: " + Subject)

       

      I tried an initialisation rule of:

       

      $(if ParentLink_Category == "ServiceReq"  then "Case: " + [ServiceReq#.JournalEmailAssocServiceReq]ServiceReqNumber

        else if ParentLink_Category == "Incident" then "Incident: " + [Incident#.JournalEmailAssocIncident]IncidentNumber

             else ParentLink_Category)

       

      But this doesn't work as the initialisation takes place before the parent link is in place.  I tried adding this as a trigger based on update of parentlink which works but the subject isn't updated until you save and go back into the e-mail.

       

      I've looked at pushing the subject in through a relationship directly from the object but this only allows you to push from 1 field into another field, not using an expression.

       

      The only way I can think of is to create a concatenated field in the Incident or Service Request and then push that but this seems a bit clunky - can anyone think of a better way of doing this?

        • 1. Re: How can you auto-populate E-mail Subject from the parent?
          florian1 Expert

          Hi Joe,

          I've added an E-Mail tab to each business oject with its own object templates so I don't have to care about initialization rules etc.

          Is there a reason why you don't want to use object templates?

           

          • 2. Re: How can you auto-populate E-mail Subject from the parent?
            joetetley Apprentice

            Thanks Florian but this isn't really what I wanted to do.  This would mean we would then have to administer templates and have e-mails on a separate tab from the other Activity History which I can see leading to confusion.

             

            There is already a function where they can insert blocks of text from an autofill business object I created and this can also set the subject for them if they want it.  This could be used in conjunction with templates but it really negates the need for individual templates as the blocks of text can be used universally regardless of the object you are calling the e-mail from.

             

            I would like to be able to put parameters around the 'New' function on e-mail to ensure that it includes the parent object and reference so that any replies always go to the right place.  I will try doing this through another field, concatenate the information and then push it in the relationship as it doesn't seem there is another way.

            • 3. Re: How can you auto-populate E-mail Subject from the parent?
              dnotti2@gmail.com Apprentice

              Hey Joe,

               

              The issue you are having is that you are using an initialization rule and as you said, with this type of rule you will run before the parentlink is populated through the relationship.  You should instead try using a calculation rule and set it to 'Always' calculate; I have done this for the Incident emails with the following calculation rule; the Find function in my rule will check to see if there is already that proper syntax in the subject and if there is it will ignore otherwise it will add the syntax:

               

               

              $(if ParentLink_Category == "Incident"

                then if Find("Incident#",  Subject) == -1

                     then "Incident# " + ToString([Incident#.]IncidentNumber) + " " +

                          Subject

                     else Subject

                else Subject)

               

               

               

               

              To add change or another object it would look something like (I have not tested this just threw in a quick example):

               

              $(if ParentLink_Category == "Incident"

                then if Find("Incident#",  Subject) == -1

                     then "Incident# " + ToString([Incident#.]IncidentNumber) + " " +

                          Subject

              else if ParentLink_Category == ³Change"

              then if Find(³Change#", Subject) == -1

              then ³Change# " + ToString([Change#.]ChangeNumber) + " " + Subject else Subject

                else Subject)

               

              I hope this helps you resolve the issue.  Let me know if this brings up any other questions

              1 of 1 people found this helpful
              • 4. Re: How can you auto-populate E-mail Subject from the parent?
                daveb1 Apprentice

                Hi Joe

                 

                Copy your Journal.Email form to another name like Journal.Email.IncidentOnly

                 

                Then create a form level initialization rule for this new form where you set the subject to something like:

                $("Regarding Incident# " + [Incident#.]IncidentNumber)

                 

                Then in your incident form view layout use this form for email on the child tabs instead of the current one.  It is in a few places, like activity history tab.

                 

                I did this for Incident/Service Request/Task/Problem/Change/Knowledge

                1 of 1 people found this helpful
                • 5. Re: How can you auto-populate E-mail Subject from the parent?
                  joetetley Apprentice

                  Thanks to all for responses.  I've been working on something else so not had time to look at this properly.   David's response works best for me and I think will be the best solution for us going forward.

                   

                  Many Thanks!

                   

                  Joe

                  • 6. Re: How can you auto-populate E-mail Subject from the parent?
                    chooi Apprentice

                    You may find your solution in

                    Issue and Resolution #12734

                    Just extend expression to objects you use.

                    • 7. Re: How can you auto-populate E-mail Subject from the parent?
                      SusanJS Specialist

                      I have this in the Journal.Email object as an editing rule on change of the ParentLink_RecID set Subject:

                       

                      $(if ParentLink_Category == "Incident"

                        then "Incident# " + ToString([Incident#.]IncidentNumber) + ": " + [Incident#.]Subject

                        else if ParentLink_Category == "ServiceReq"

                             then "SR# " + ToString([ServiceReq#.]ServiceReqNumber) + ": " +

                                  [ServiceReq#.]Subject

                             else if ParentLink_Category == "Problem"

                                  then "Problem# " + ToString([Problem#.]ProblemNumber) + ": " +

                                       [Problem#.]Subject

                                  else if ParentLink_Category == "Change"

                                       then "Change# " + ToString([Change#.]ChangeNumber) + ": " +

                                            [Change#.]Subject

                                       else if ParentLink_Category == "Task.Assignment"

                                            then "Task# " + ToString([Task#Assignment.]AssignmentID) + ": " +

                                                 [Task#Assignment.]Subject

                                            else if ParentLink_Category == "FRS_Knowledge.QandA" ||

                                                    ParentLink_Category ==

                                                    "FRS_Knowledge.IssueResolution" ||

                                                    ParentLink_Category == "FRS_Knowledge.Document"

                                                 then "KB# " + ToString([FRS_Knowledge#.]KnowledgeNumber) +

                                                      ": " + [FRS_Knowledge#.]Title

                                                 else "")

                      • 8. Re: How can you auto-populate E-mail Subject from the parent?
                        vee Apprentice

                        Hi Susan,

                         

                        Apologies for replying to the old thread however this is exactly what I'm trying at the moment. The issue I am facing is that ParentLink_Category seems to be blank. I've even tried to just print it as the email body to see what it contains but there's just no value.

                         

                        I've been trying :

                        $(if ParentLink_Category == "Incident" then ... else ...)

                        as an initialisation rule on Journal#Email but it always fails to the else because it's blank. Even if I just go $(ParentLink_Category) as the rule to see the contents, there's nothing.

                         

                        Something for the vendor?

                        • 9. Re: How can you auto-populate E-mail Subject from the parent?
                          SusanJS Specialist

                          Hi Vee,

                          Sounds like when the relationship is created, it's not auto-populating that field like it should.  If you have the Email workspace on the application side, you could run a search that states Find 'Email' where Email ParentLink_Category Is Not Empty.  See what it brings back.  If it's not bringing back anything, then I would contact support as I believe that is a system function that is not working properly for your tenant.  It could be that the relationship is not set properly.  You could also create a new relationship between Journal and Incident objects and test too.

                          1 of 1 people found this helpful
                          • 10. Re: How can you auto-populate E-mail Subject from the parent?
                            vee Apprentice

                            Hi Susan,

                             

                            Thank you very much for your speedy response!

                            I've ran that search and it all seems OK. I've just recalled that I am using ParentLink_Category in the Subject line which is working correctly, so I think perhaps something is just up with my Body portion. I'll keep playing!

                             

                            Thanks again for your assistance.

                            • 11. Re: How can you auto-populate E-mail Subject from the parent?
                              vee Apprentice

                              Ah! Update on this.

                              The Subject BR is an Editing rule, while my EmailBody BR is an Initialisation rule. It would seem that the ParentLink_Category is set after the Initialisation rule is run, hence my issue. Well that's perfect, I'll just move it into an Editing rule.