locked
SCSM Popup RRS feed

  • Question

  • On an incident or Change form I am trying to find a way of prompting a user to fill out a word doc, if the priority is set to 1 or 2.

    I have tried workflows, however these run only every 60 seconds (not ideal as the form  may have been closed by the time the workflow fires.

    Is there a Way to customise a form to provide a link?


    kittuk

    Wednesday, October 30, 2019 8:51 AM

Answers

  • It is not possible by default, but you can provide a pop up (default yellow bar or your custom one to point to the file). This requires advanced customization on form.

    YSobhdel


    Wednesday, October 30, 2019 2:57 PM
  • Hi,

    You must have a custom control on the form and use this code to show a yellow bar at top:

    private DependencyObject GetParentDependencyObject(DependencyObject child, string name)
            {
                try
                {
                    //We need the logical tree to get our parent
                    DependencyObject parent = LogicalTreeHelper.GetParent(child);
                    DependencyObject lastparent = null;
    
                    //Is the parent our specified control?
                    if (name != "" && parent.GetType().ToString() == name) return parent;
    
                    //No, process further
                    while (parent != null)
                    {
                        string s = parent.GetType().ToString();
                        if (s == name && name != "") return parent;
                        parent = LogicalTreeHelper.GetParent(parent);
                        if (parent != null) lastparent = parent;
                    }
                    //Return results
                    if (name != "") return null;
                    else return lastparent;
                }
                catch
                {
                    return null;
                }
            }
    
            private bool loaded = false;
            private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                if (FormUtilities.Instance.IsFormInTemplateMode(this)) return;
                try
                {
                    //code to display info bar at top of window
                    if (!loaded)
                    {
                        IDisplayInfoService service = FrameworkServices.GetService<IDisplayInfoService>();
                        if (service != null)
                        {
                            DisplayInfoContext displayInfoContext = new DisplayInfoContext
                            {
                                NodeOrView = GetParentDependencyObject(this, "System.Windows.Controls.TabItem"),
                                InfoBarInfo = new InfoBarInfo()
                                {
                                    Message = "Please set the Priority field accordingly"
                                }
                            };
    
                            service.Show(displayInfoContext, null, null);
                        }
                        loaded = true;
                    }
                }
                catch
                {
    
                }
            }


    YSobhdel

    Wednesday, November 13, 2019 6:10 AM

All replies

  • It is not possible by default, but you can provide a pop up (default yellow bar or your custom one to point to the file). This requires advanced customization on form.

    YSobhdel


    Wednesday, October 30, 2019 2:57 PM
  • Happy to customize the form more than I have, could you point me in the right direction please.

    K


    kittuk

    Wednesday, November 6, 2019 11:25 AM
  • Hi,

    You must have a custom control on the form and use this code to show a yellow bar at top:

    private DependencyObject GetParentDependencyObject(DependencyObject child, string name)
            {
                try
                {
                    //We need the logical tree to get our parent
                    DependencyObject parent = LogicalTreeHelper.GetParent(child);
                    DependencyObject lastparent = null;
    
                    //Is the parent our specified control?
                    if (name != "" && parent.GetType().ToString() == name) return parent;
    
                    //No, process further
                    while (parent != null)
                    {
                        string s = parent.GetType().ToString();
                        if (s == name && name != "") return parent;
                        parent = LogicalTreeHelper.GetParent(parent);
                        if (parent != null) lastparent = parent;
                    }
                    //Return results
                    if (name != "") return null;
                    else return lastparent;
                }
                catch
                {
                    return null;
                }
            }
    
            private bool loaded = false;
            private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                if (FormUtilities.Instance.IsFormInTemplateMode(this)) return;
                try
                {
                    //code to display info bar at top of window
                    if (!loaded)
                    {
                        IDisplayInfoService service = FrameworkServices.GetService<IDisplayInfoService>();
                        if (service != null)
                        {
                            DisplayInfoContext displayInfoContext = new DisplayInfoContext
                            {
                                NodeOrView = GetParentDependencyObject(this, "System.Windows.Controls.TabItem"),
                                InfoBarInfo = new InfoBarInfo()
                                {
                                    Message = "Please set the Priority field accordingly"
                                }
                            };
    
                            service.Show(displayInfoContext, null, null);
                        }
                        loaded = true;
                    }
                }
                catch
                {
    
                }
            }


    YSobhdel

    Wednesday, November 13, 2019 6:10 AM