How to Display a Prompt if a Parent Record does not have Child Record(s) linked to it

Version 1

    Details

    This article goes over how to display a prompt that asks the user if they are sure they want to Resolve the Incident if Tasks are not linked to it. 


    For example, when an Incident is Resolved, but does not have any Tasks linked to it, you can configure a quick action to display a prompt asking if the user wants to resolve the Incident even though no Tasks are linked. This quick action is configured to validate if there are any records linked to it. If there are not - the prompt displays. If there are - there is no prompt. 


     


    Resolution

     

    This scenario will go over using the Incident business object and prompting the user if they are sure they want to Resolve the Incident because there are no Tasks associated with it (linked). 

     

    Before you start, make sure that you Incident B.O has a field that holds the value of whether or not the Incident has task(s). In this most cases, the field is “HasTasksCount”

    This field is updated by a trigger action on the Incident B.O with the following expression: $(ChildFold("Incident#", RecId,   "Task#Assignment.Rev3",   "$(iif(Status == 'Cancelled',0,1))",   "+")) 

    Screenshot below is the trigger action for the field HasTasksCount.

    OK - now begins the design: 



    1.      1.  Create a field that will hold the prompt expression on the business object  - in my case, I’ve created a field called “PromptNotice” in Incident - this is a Text field (you should make a Unicode if you plan on using a pick-list for the prompt action

    2.      2. Next, create a quick action within the business object Incident. 

    3.      3. Select the Update Object quick action

    4.      4. Name it (I’ve named mine HasTasksPrompt)

    5.      5.Using the field created in step 1, select that as your field Name (PromptNotice)

    6.      6. Then for field value, use this expression

     

      $(if Status == "Resolved" && HasTasksCount == "0" then Prompt("There are no tasks associated with this incident, are you sure you want to close?",  "")  else "Resolved")

     


     

    7.       7.  Now, go to Configure Application and pull up Incident Business Object

    8.       8.  Go to Business Rules

    9.       9.  Add a Trigger Action

    10.    10. Set Status to Resolved as the trigger

    11.    11. Click Next

    12.    12. Use copy of existing action.

    13.    13. Select the quick action HasTasksPrompt (assuming you named the quick action that as in the screenshot above)

    14.    14. Now go and test it. Resolve an Incident that has no Tasks. You will get that prompt asking if you are you want to resolve that Incident because it has no tasks.

    15.    15. Now put it back into Active and add a new task. Now Resolve. You will not see the prompt.


    Note, the field PromptNotice can also be a validated field with a pick list, you can use pick lists within a prompt. You could do this if you wanted to control the Answers (example: Yes or No)