3 Replies Latest reply on Jul 30, 2009 2:51 PM by timothy2k

    Scripting Question for a Found Record

    timothy2k

      Title

      Scripting Question for a Found Record

      Post

      I want a script that searches all records for an existing quote_id, and if it already exists it will reset a field then just exit, if it does not exist it will create a new record, then reset a field, then exit. I have seen several examples that are similar to what I am trying to do, but I can't seem to get my script working exactly right. It's probably obvious- can anyone chime in on what needs to be adjusted for this to actually loop through every record and do the "Perform Find"? I tried wrapping a loop around it, but I miust be doing it wrong. Or maybe I don;t even need to loop this?

       

      *The "Perform Find" below does the following: Find records where Quote:quote_id= Left($record_id_variable;5) & $vendor_lookup

       

      Go to Layout ["Quote"(Quote)]

      Set Error Capture [on]

      Perform Find [Restore] 

      If [Get (FoundCount) > 0]

         Replace Field Contents [No dialog; Estimate::vendor_code_variable;""]

         Exit Script []

      Else

         New Record/Request

         Set Field [Quote:quote_id;Left($record_id_variable;5)&$vendor_lookup]

         Commit Records/Requests [Skip data validation; No dialog]

         Replace Field Contents [No dialog; Estimate::vendor_code_variable;""]

      End if

      Exit Script []