8 Replies Latest reply on Aug 8, 2017 10:27 AM by wynnb

    Update another child of the grandparent object

    wynnb Specialist

      I'm looking for a way to run an action on another child of the grandparent object. For example: when a specific release milestone task ('Deploy to Prod') is complete, I want to prompt and run an action in all Change records that are linked to the Release. The Release is the grandparent of the task, and the Changes are other children of that release.

       

      What I'm hoping to do could be triggered from a status change on the parent Release (when closed, run this action on the linked Changes), but I really want to trigger it from a prompt when the Milestone task is completed - 'Yes' would run one action on the linked changes, 'No' would run another.

       

      Can this be done?

        • 1. Re: Update another child of the grandparent object
          AlasdairRobertson ITSMMVPGroup

          Yes this is very do able, you can make use of business rules and the run for child auick actions.

           

          1. Create a new business rule on task, this will only run for ReleaseMilestones with a Subject of "Close Phase"

           

          2. The action is to set the Milestone to Completed.

           

           

          3. Create a new business rule in ReleaseMilestone to start the closure process, feel free to add some futher rules for example only if the Milestone name is "Shutdown Phase" for example.

           

           

          4. Now create a Run for Child Quick Action as the action (yes I know its not a child but run for child is miss-leading it will run both upwards and downwards through a relationship, it should be called Run for Relationship really)

           

           

          3. The action to run here is another Run for Child action and select the Release Change relationship

           

           

          5. the Quick Action run in my example just closes a change which has been set to Implemented but you can run whatever you want performing other checks on the change record or filling in additional information etc.

           

          The key is understanding the Run for Child quick action, if you run in to problems just shout.

          1 of 1 people found this helpful
          • 2. Re: Update another child of the grandparent object
            wynnb Specialist

            Thank you Alasdair!  Yes, I was hung up on the 'run for child' thing.

             

            I'll give this a try and then see if I can include a prompt. I have actions in Change to create a success or failed PIR, so what I'm attempting here is to trigger one of those based on a prompt (triggered when the task is marked complete) that asks whether the deployment successful. In our case, all the changes in a Release are part of a code build, so the answer to that question would apply to all linked changes.

            • 3. Re: Update another child of the grandparent object
              AlasdairRobertson ITSMMVPGroup

              I would avoid Prompt and Execute, it appears to have been depreciated and therefore may be removed in a future version.  In my example i added a prompt in the Change Close Quick action, on the Status field it asks the user if they wish to close the changes, if they select yes then it sets the statuses to closed.

               

              $(if Prompt('Would you like to close associated changes?','YesNo') == 'Yes' then Status == 'Closed' else Status)

              • 4. Re: Update another child of the grandparent object
                wynnb Specialist

                Yeah, the 'Task Incident Workflow' triggered action uses that, and this nice thing is that it can run different actions based on the user's selection. I hope they replace 'prompt and execute' with something that can do that.

                • 5. Re: Update another child of the grandparent object
                  AlasdairRobertson ITSMMVPGroup

                  You can write your own version easily enough, create a trigger value field on you business object and then define a set of actions as business rules.  This field can be hidden on the object but driven from a prompt on save of the record in certain states driven by business rules.

                   

                  Action - Close Changes, sets the trigger value to "CloseChanges" that runs one set of business rules

                  Action Close Incidents, sets the trigger value to "CloseIncidens" which runs another set of rules

                   

                  You can grow this out in lots of different ways or plugin a workflow with a switch block to drive it for you.

                  1 of 1 people found this helpful
                  • 6. Re: Update another child of the grandparent object
                    wynnb Specialist

                    Alasdair,

                     

                    I'm still not fully understanding "This field can be... driven from a prompt on save of the record in certain states driven by business rules". The system doesn't process prompts in workflow, and even when the workflow trips the trigger for a rule - where the rule's action includes a prompt -  it either throws an exception or doesn't run the action.

                     

                    Let me better explain my scenario. I built workflows for Release templates that automatically handle setting milestones to completed, release to closed, and linked changes to implemented. I want to add a way to automatically create PIR records for those linked changes. To do that, I need the person who completes the 'deploy' task to answer two questions when they complete the task: did it complete successfully, and when did you start and finish (or back out)? For the automation to work, I need to trigger those questions at that point (task status) and run the appropriate action (in the release-linked changes) based on the answers - and that action has to run after the changes are updated to 'Implemented'.

                     

                    Based on your suggestions (thank you!), I've tried several things, but they either break the workflow (update blocks fail to set the status), or the triggered rule just doesn't run. I've been testing with the trigger value field and rule in the Release object, but maybe it would be better to put those in Change? I'll keep at it, but I'm starting to think this will have to be manually triggered. Would love for someone to prove me wrong! ;-)

                     

                    Something I haven't tried yet is to create "Actual Outage" start/end DateTime and DeploymentResult fields in Release, then use those to trigger the PIRs via rules. Hmmm...

                    • 7. Re: Update another child of the grandparent object
                      AlasdairRobertson ITSMMVPGroup

                      So when the user sets the last task to completed you could prompt them for the values you require at that point using a task business rule.  Once you have those values you can save them on the task or milestone or release record (playing with the run for child function).  Then those values can be evaluated by your workflow and actions accordingly?

                       

                      Adding the PIR should be a simple run for child against the change records linked.

                      • 8. Re: Update another child of the grandparent object
                        wynnb Specialist

                        Yes, that makes sense, and matches with my last comment about the new fields. I do have actions to create the PIRs, that isn't the issue, just how to trigger them. I was trying to put too much into the actions/rules, rather than saving the answers in fields and processing from there.