3 Replies Latest reply on Nov 17, 2011 6:36 AM by Fagreement

    Notification on Field change

    Fagreement

      Title

      Notification on Field change

      Post

      Hi,

      How can I implement this functionality:

      For certain fields on my layout, when the user change the value of that fields, on layout exit or on change record I want the system notify the user (pop up message Y/N/Cancel) if he really want to save the modification of that particular fields. I don't want this notification for all the fields, only those I want.

      thanks

        • 1. Re: Notification on Field change
          mfs.nishant

          Hi Fagreement,

                If you want to implement this functinality for certain fields,  First Save the old value of that field when enter in layout.

          •           If [not IsEmpty (Main::ChangeTest)]
          •                Set Variable [$$oldValue; Main::ChangeTest]
          •           End If        

               Above Script Steps add onLayout Enter

           

               and  This Script Step add OnLayout Exit

          • If [ not IsEmpty ( Main::ChangeTest ) ]
          • If [ $$Oldvalue ≠ Main::ChangeTest ]
          • Show Custom Dialog [ Title: "Ooopssss!!!"; Message: "You are Trying To change"; Buttons: “No ”, “Yes” ]
          • End If
          • If [ Get ( LastMessageChoice ) = 2 ]
          • Commit Records/Requests [ No dialog ]
          • End If
          • If [ Get ( LastMessageChoice ) = 1 ]
          • Set Field [ Main::ChangeTest; $$Oldvalue ]
          • End If
          • End If

          For Testing I have created Main::ChangeTest return type "Text"

          Note: This Will Work correctely when user change one layout to another layout.

          For Implementing When User "change record" You have to just add Trigger with field and just do some short addition in  2nd script.

            

          • If [ not IsEmpty ( Main::ChangeTest ) and Get ( ScriptParameter ) = "ObjectEnter" ]
          • Set Variable [ $$Oldvalue; Value:Main::ChangeTest ]
          • End If
          • If [ not IsEmpty ( Main::ChangeTest ) ]
          • If [ $$Oldvalue ≠ Main::ChangeTest ]
          • Show Custom Dialog [ Title: "Ooopssss!!!"; Message: "You are Trying To change"; Buttons: “No ”, “Yes” ]
          • End If
          • If [ Get ( LastMessageChoice ) = 2 ]
          • Commit Records/Requests [ No dialog ]
          • Set Variable [ $$Oldvalue; Value:"" ]
          • End If
          • If [ Get ( LastMessageChoice ) = 1 ]
          • Set Field [ Main::ChangeTest; $$Oldvalue ]
          • End If
          • End If

            Trigger This Script OnObjectEnter = "This Script" and Set Parameter Value "ObjectEnter"

            And add this Script OnObjectExist = "This Script" Without any parameter.

           

          Any Problem regarding this You can feel free to mail me at mfs.nishant@gmail.com

          Cheers!!!!

          • 2. Re: Notification on Field change
            philmodjunk

            I use a similar method, but capture the value in the global variable with OnObjectEnter on the specified field. And then use OnObjectSave to trigger the confirmation script on the same field. The script triggers can pass the field's name as a script parameter so both scripts can be used with any number of fields on any number of layouts where you want this feature.

            To keep the first script from being specific to any one field, layout or table, I write it like this:

            Set Variable [$$OldValue ; Value: getField ( Get ( ScriptParameter ) ) ]

            I then use the expression: GetFieldName ( TableOccurrenceName::FieldName ) in the script parameter box so that I can pass the name of any field to my script. (If the field is empty, $$OldValue will be set to empty so my confirmation script checks to see if $$OldValue is empty and only asks for confirmation if $$OldValue is not empty.)

            • 3. Re: Notification on Field change
              Fagreement

              thanks I'll use it