6 Replies Latest reply on Oct 31, 2017 6:38 AM by Jessamine

    How to make Comments field in Survey be Mandatory

    Jessamine Rookie

      Hi,

       

      I'm just new here. Need your advise how can we make Comments field in Incident survey be mandatory if the user select "Dissatisfied" and "Very Dissatisfied"?

      How to set this is Object Designer.

       

      Thanks!

        • 1. Re: How to make Comments field in Survey be Mandatory
          KRYS-GROUP Apprentice

          Define a new attribute for a window calculation (with type window calculation)

          Next in the calculation copy something like that :

           

          import System

          static def GetAttributeValue(_IncidentSurvey):

               CompulsoryRemark = false

               LectureSeule = true

               // If user connected is not the raise user block writing

               if _IncidentSurvey._Incident.RaiseUser.Name == _IncidentSurvey.GetCurrentUserName():

                    ReadOnly = false

               Texte = ""

               // If bad quotation in incident survey

               if _IncidentSurvey._Question1 != null:

                    if _IncidentSurvey._Question1 < 8 :

                         CompulsoryRemark = true

                         Texte = "Merci de nous préciser pourquoi vous n'étiez pas totalement satisfait(e)   "

          return String.Format(":SetMandatory(_Remarque, {0});:SetReadOnly(_Question1,{2});:SetReadOnly(_Remarque,{2});", CompulsoryRemarke, Texte,ReadOnly)

           

          Regards

          Laurent Dané

          KRYS-GROUP

          • 2. Re: How to make Comments field in Survey be Mandatory
            Julian Wigman ITSMMVPGroup

            KRYS-GROUP

             

            I notice "Texte" isn't actually referenced in the String.Format (i.e. parameter 1) so wondering what you intended this to do; did you remove from the design before posting?

             

            Julian

            @MarXtar

            • 3. Re: How to make Comments field in Survey be Mandatory
              KRYS-GROUP Apprentice

              Yes I apologize for this mistake during translation

              • 4. Re: How to make Comments field in Survey be Mandatory
                Jessamine Rookie

                Hi Laurent/KRYS-Group,

                 

                Thank you! Sorry for the delayed response. Do you have an English translation of the code? Will test this on the coming days.

                 

                Regards,

                Jess

                • 5. Re: How to make Comments field in Survey be Mandatory
                  Julian Wigman ITSMMVPGroup

                  I translated for you if that helps.  I removed the references to the TEXT variable as that was assigned but never used in the return value.

                   

                  Julian

                  MarXtar Ltd

                   

                  Import System
                  Static def GetAttributeValue(_IncidentSurvey):
                       CompulsoryRemark = false
                       ReadOnly = true

                       // If user connected is not the raise user block writing
                       if _IncidentSurvey._Incident.RaiseUser.Name == _IncidentSurvey.GetCurrentUserName():
                            ReadOnly = false

                       // If Bad quotation in Incident Survey
                       if _IncidentSurvey._Question1 ! = null:
                            if _IncidentSurvey._Question1 < 8:
                                 CompulsoryRemark = true

                       return String.Format (":SetMandatory(_Note,{0});:SetReadOnly(_Question1,{1});:SetReadOnly(_Note,{1});",CompulsoryRemark,ReadOnly)

                  • 6. Re: How to make Comments field in Survey be Mandatory
                    Jessamine Rookie

                    Hi Julian,

                     

                    Thanks! I can test this within this week & let you know how it goes. I'm learning. I remember that we only have 1 question for our survey. =)

                     

                    Regards,

                    Jess