0 Replies Latest reply on Mar 22, 2012 10:30 AM by hobbiesdeveloper

    Script Trigger not working



      Script Trigger not working



      I need help in getting the Script Trigger working correctly. The problem that i'm having is whenever the script that I have running for the Script Trigger on onObjectSave tries to go to a different field it runs the same script again, basically runs the script non-stop. I need the Script Trigger to stop running the Script once it leaves the text field that the script trigger is on.

      I currently have a text field called Product::Features which i need to add "*" per each line in the beginning of all the text in the line. I tried to use the Script Debugger and Data Viewer which shows that it the Script gets re-run again, never ending.

      Here is the Script Code that is attached to the Set Script Trigger "OnObjectSave" option.

      if ( not $$no_trigger )

      Set Variable ( $$no_trigger; Value:True )

      Set Variable ($$all_lines; Value:Product::Features )

      Set Variable ($count: Value:0)


      Set Variable ($count; Value:$count + 1)

      Set Variable ($line; Value:GetValue( $all_lines ; $count))

      if( not isEmpty( $line ))

           Set Variable ($bullet_point; Value:"*" & GetValue( Product:Features ; $count))

           Go to Field (Product:Features)

           Perform Find/Replace( No Dialog; $line; $bullet_point; Replace All )

      End If

      If (IsEmpty ( $line ))

           Set Variable ( $$no_trigger; Value:False )

           Go to Field (Product:Title )

           Exit Script (Result: False)

      End if

      End Loop

      End if


      As you can see at the last if end statement, i'm trying to end the script and leave to the Product:Title text area so that the Script stops running, i have also included the Exit Script option but it still seems to run the same script again causing the never ending adding of the "*" to each line.

      If someone please review the code that i have included and let me know how to fix the Script Trigger from running it everytime i try to go to a different field. I did try attaching the code to the OnObjectExit but still runs the Script non stop.


      Please help.Frown