2 Replies Latest reply on Dec 10, 2013 10:56 AM by Fabian Schmidt

    How can i make fields Conditional Mandatory

    Rookie

      Hello,

       

      I am using 7.6.2.

       

      There are two fields on my incident window. I want at least 1 fields out of these two must be filled by user.(kind of conditional mandatory)

       

      Any suggestion/help will be appreciated.

       

       

      Thanks,

      Shehzad

        • 1. Re: How can i make fields Conditional Mandatory
          Expert

          7.6.2 does have conditional attributes and are used in the new Dynamic Windows.  Their done thru calculations so that when a checkbox is checked, code runs.  In the code it could make an attribute mandatory and at the same time make the second attribute hidden so it doesn't get filled out. The documentation and examples in the calculation section give pretty good examples and are easy to follow.  It's kind of an involved in that several things must be done but at the same time their small easy steps.  Just keep in mind that nothing happens unless the user does one of the trigger events FIRST.  Just filling out a text box won't set off the calculation.

           

          See the Designer or NewFeatures manual and look for Dynamic Windows for more detailed info.  If you have not used calculations yet, see: https://community.landesk.com/support/community/servicedesk/calculations

          Lots of good examples there.

          • 2. Re: How can i make fields Conditional Mandatory
            Fabian Schmidt Expert

            Something like this could help:

             

            import System
            static def GetAttributeValue(Incident):
                      // Raise User selected but Severity AND Urgency not --> Both Attributes Mandatory
                      if Incident._IncidentUrgency == null and Incident.Severity == null:
                                return String.Format(":SetMandatory(_IncidentUrgency,true);:SetMandatory(Severity,true);")
                      // Raise User selected, Severity null, but Urgency not --> Only Urgency mandatory
                      if Incident._IncidentUrgency != null and Incident.Severity == null:
                                return String.Format(":SetMandatory(_IncidentUrgency,true);:SetMandatory(Severity,false);")
                      // Raise User selected, Severity not null, but Urgency null --> Only Severity mandatory
                      if Incident._IncidentUrgency == null and Incident.Severity != null:
                                return String.Format(":SetMandatory(_IncidentUrgency,false);:SetMandatory(Severity,true);")
                      // Raise User, Severity and Urgency selected --> Nothing mandatory
                      if Incident._IncidentUrgency != null and Incident.Severity != null:
                                return String.Format(":SetMandatory(_IncidentUrgency,false);:SetMandatory(Severity,false);")
                      return return String.Format(":SetMandatory(_IncidentUrgency,true);:SetMandatory(Severity,true);")
            
            

             

            My example changes the mandatory property of Incident Urgency and Severity wether one of the fields is selected.

            To initiat the calculation I have the Raise User as Dependency additional.

            The necessary dependencies are Incident Urgency and Severity and all three reference lsist have the option "Is calculate on change" set to true.

             

            Maybe this gives you an idea how dynamic windows can work.

             

            Regards

            Fabian