11 Replies Latest reply on Jun 26, 2018 9:07 AM by WDooli

    Yes/No Prompt to run Quick Action

    WDooli Rookie

      I'm using HEAT 2016.1.1000.16119

       

      I have a composite action within a Service Request that I would like to prompt that user on whether or not they would like to run a quick action within the same Service Request BO. I currently setup the composite action to execute a workfow to run said quick action but it does so without prompting.

        • 1. Re: Yes/No Prompt to run Quick Action
          rspahr@communitymedical.org Apprentice

          We tried something like this a long time ago, I don't think a workflow cares about a prompt condition on a Quick Action, if it's set to run it runs. It won't stop (Halt the Workflow) give a prompt to the runner, then continue after prompt.

          We didn't end up doing this, but a thought we had was Have the workflow (hold) jump to quick action in your composit that would  prompt Yes/No that updated a field in the object (In your case SR) , and have the workflow do a 1 minute loop checking the condition of that field (path it maybe 5 times, giving them 5 minutes and 4 opportunities, (If  True, proceed, if False, Wait another 1 minute, If Yes, Proceed, if No wait another 1 minute, 5 times). IF the QA prompt was Yes, it flagged as true so when the workflow looped back and saw "true" it carried on. If it was false it would STOP.

           

          There is probably a more elegant approach, and we didn't end up going with this but it it was what I recall us throwing around as a "quick and dirty" solution to that. Either way might be worth a shot.

          • 2. Re: Yes/No Prompt to run Quick Action
            Terry Douglas Apprentice

            Hi WDooli,

             

            Workflows are queued and run by the Workflow Service, completely independently of the user/front end. If you want to interact with the end user then you could do it via a Trigger Action.

             

            Your use case sounds like a job for PromptAndExecuteAction.

             

            Hope this helps!

            • 3. Re: Yes/No Prompt to run Quick Action
              WDooli Rookie

              The PromptAndExecuteAction sounds exactly what I'm looking for. The only issue is I've been looking high and low on where I can insert said action. I don't see it available under the 'Add new action' dropdown for my composite action. My first guess would be in a UIAction but the compatibility list shows it wouldn't support that.

              • 4. Re: Yes/No Prompt to run Quick Action
                SusanJS Specialist

                PromptAndExecuteAction, contrary to its name, is not actually an action, but a function.  You would need to build a boolean field that would utilize it in an Update Object action.  This is a great KB article on how to use this function:

                Revised Content Fixes for Supporting the Incident-Task Workflow (2014.3 Release)

                • 5. Re: Yes/No Prompt to run Quick Action
                  WDooli Rookie

                  Excellent, I'm very close now but for some odd reason I'm getting the following error when running the composite action:

                   

                  Business object could not be saved due to following error(s):

                   

                  Object reference not set to an instance of an object.

                   

                  My Expression in the UpdateObject action is: $(PromptAndExecuteAction("$(Parent(Service Request#.ServiceReq))",   "Do you want to run Send Windows 10 info email?",   "Windows 10 Computer Replacement",   "Windows 10 Computer Replacement"))
                  The Yes and No actions are the same for now as I'm just testing.
                  I looked within the admin help but saw nothing related to object instances, just workflow instances to which this function does not work in. Thank you for all the help again!
                  • 6. Re: Yes/No Prompt to run Quick Action
                    Terry Douglas Apprentice

                    Hi WDooli,

                     

                    Object reference errors occur when you try to reference something that doesn't exist. In this case it looks like the first parameter is the cause.

                     

                    From the help section for PromptAndExecuteAction for the first parameter:

                    Parameters

                    objectRef

                    A reference to the business object instance to which the two quick actions apply.

                     

                    NOTE: This built-in function will be deprecated in a future release because of the unusual way in which it handles this first parameter.

                     

                    This parameter behaves differently than any other function parameter. It looks like an expression, but it is not. This built-in function is the only one that uses this syntax.

                     

                    The value for this parameter must always be inside quotes. This parameter is a string in this form: '$(Parent(RelationshipReference)' where the relationship reference is of the form BusinessObjectName#.InternalReferenceName. However, the function ignores the InternalReferenceName value and only looks for the parent of the BusinessObjectName#.

                     

                    Note that the Business Object is 'ServiceReq' even though the Display Name is 'Service Request'. As the last sentence also states that the relationship's Internal Reference Name is ignored, see whether this works:

                     

                    $(PromptAndExecuteAction("$(Parent(ServiceReq#.))",   "Do you want to run Send Windows 10 info email?",   "Windows 10 Computer Replacement",   "Windows 10 Computer Replacement"))

                     

                    (fingers crossed)

                    • 7. Re: Yes/No Prompt to run Quick Action
                      WDooli Rookie

                      I did forget to mention I tried a bit of experimentation with the objectRef variable and I tried what you mentioned but unfortunately the same error occurs. The error unfortunately shows no additional details.

                      • 8. Re: Yes/No Prompt to run Quick Action
                        SusanJS Specialist

                        I think the problem here is that PaEA is meant to be run from a child object against a parent, but your situation describes the main parent object trying to run it against itself.  I was not successful using this particular function to do that.  It's been awhile, but as I recall, I had to build a series of triggered actions based on the resulting answer to a regular prompt using business rules.  Not sure of your exact situation, but here is what I can remember of it:

                         

                        1. Based on a change (like status), trigger a regular prompt function using a Triggered Business Rule to update the boolean field FieldX.
                        2. On change of the boolean field FieldX, trigger another business rule to run the appropriate quick action.

                         

                        Hope this helps.

                        • 9. Re: Yes/No Prompt to run Quick Action
                          WDooli Rookie

                          I set up some trigger actions but unfortunately it set off the same error as before: Object reference not set to an instance of an object.

                          I also have the action setup under the child object 'FulfillmentItem' and so I have the composite action do it's normal action first and for the second action I have the Run for Child action run the Update Object action that's under FulfillmentItem that runs the Prompt and Execute Action.

                          I went over the function in the help guide a half dozen times already and the only other thing I noticed was that the feature will be depreciated so I'm guessing that may have already occurred and it simply doesn't work anymore.

                          • 10. Re: Yes/No Prompt to run Quick Action
                            Terry Douglas Apprentice

                            Hi again WDooli,

                             

                            Sorry, I thought I'd already responded to this post but it seems my post was swallowed by a Windows 10 automatic reboot.

                             

                            I think the easiest way to handle the situation is with two Quick Actions and a little user education.

                             

                            Either:

                            - Create a Quick Action which does the first things you need

                            - Create a second Quick Action which does the additional things you need

                            - Train the users to run the first one, then optionally also run the second one if appropriate.

                             

                            Or:

                            - Create a Quick Action which does the first things you need

                            - Create a second Quick Action which does both the first things you need AND the additional things you need

                            - Train the users to run the appropriate one, based on the use case.

                             

                            - Rest easy knowing you haven't spent hours over-engineering the issue. :-)

                             


                             

                            Given that PromptAndExecuteAction is going to be deprecated at some point, it's probably not the best idea to implement the following workaround, making the Service Request its own parent by creating a Link field called ParentLink on ServiceReq and filling it using an Editing Rule on change of RecId set ParentLink = RecId.

                             

                            ParentLink Field:

                             

                            Editing Rule:

                             

                            Composite Quick Action which also prompts:

                             

                            Test quick action when user selects Yes:

                             

                            Test quick action when user selects No:

                             

                            Running the quick action, select Yes:

                             

                            Result:

                             

                            Running the quick action, select No:

                             

                            Result:

                             

                             


                             

                             

                            If, however, you're like me and like a challenge, then you could implement something like this:

                             

                            1. Create a trigger field

                             

                            2. In your Composite Action, use the Prompt() function to set the trigger field to an appropriate value (a unique string to indicate that this business process should be executed):

                             

                             

                            3. Implement a Trigger Action which run when the trigger field contains the given value:

                             

                             

                             

                             

                            4. Run the Composite Quick Action:

                             

                             

                            Save the record and observe the result of the Trigger Action:

                             

                             

                             

                            I hope one of these solutions works for you!

                            1 of 1 people found this helpful
                            • 11. Re: Yes/No Prompt to run Quick Action
                              WDooli Rookie

                              I setup your last recommendation that utilizes the Prompt function to set the trigger field to an appropriate value. Worked very well. Thanks!