2 Replies Latest reply on Jul 6, 2013 12:51 AM by willrollo

    set field script issue

      Title

      set field script issue

      Post


           I am experiencing an issue where i am trying to set field during a script. It appears that the one of the set fields work but the other doesn't. I am unsure why as they are on the same table and standard text fields. I have pasted the scipt below and highlighted the issue where the set field is not working. The script is for autocreating a related dposit invoice and then print. (more or less!)

             
      •           Allow User Abort [ Off ]
      •      
      •           Set Error Capture [ On ]
      •      
      •           Show Custom Dialog [ Title: "Deposit"; Message: "Is this client paying a deposit?"; Default Button: “Yes”, Commit: “Yes”; Button 2: “No”, Commit: “No” ]
      •      
      •           If [ Get(LastMessageChoice)=1 ]
      •      
      •           Show Custom Dialog [ Title: "Deposit"; Message: "Please enter the amount the client is to pay."; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No”; Input #1: INVOICE DETAILS::Deposit Amount, "How Much (£)" ]
      •      
      •           #Set up variables
      •      
      •           Freeze Window
      •      
      •           Set Variable [ $OriginalInvoiceID; Value:INVOICE DETAILS::ID_Invoice_pk ]
      •      
      •           Set Variable [ $order; Value:INVOICE DETAILS::fk_Order ]
      •      
      •           Set Variable [ $customerID; Value:INVOICE DETAILS::ID_Customer_Billing_fk ]
      •      
      •           Set Variable [ $DepositID; Value:INVOICE DETAILS::Deposit Amount ]
      •      
      •           Set Variable [ $Ref; Value:INVOICE DETAILS::Reference ]
      •      
      •           Set Variable [ $link; Value:INVOICE DETAILS::Deposit Link ]
      •      
      •           Set Field [ INVOICE DETAILS::Tax_Percentage; invoicedetails_PREF::Tax Rate ]
      •      
      •           Set Field [ INVOICE DETAILS::Tax Code; "Standard" ]
      •      
      •           Set Variable [ $VAT; Value:INVOICE DETAILS::Tax_Percentage ]
      •      
      •           Set Variable [ $VATCODE; Value:INVOICE DETAILS::Tax Code ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Created; "Yes" ]
      •      
      •           #New Invoice details record
      •      
      •           New Record/Request
      •      
      •           #New Invoice record
      •      
      •           Set Field [ Invoices::fk_Invoice details ID; INVOICE DETAILS::ID_Invoice_pk ]
      •      
      •           Set Field [ INVOICE DETAILS::fk_Invoice; Invoices::Invoice Number ]
      •      
      •           Set Field [ INVOICE DETAILS::fk_Invoice Date; Invoices::Invoice Date ]
      •      
      •           Set Field [ INVOICE DETAILS::fk_Order; $order ]
      •      
      •           Set Field [ INVOICE DETAILS::ID_Customer_Billing_fk; $customerID ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Amount; $DepositID ]
      •      
      •           Set Field [ INVOICE DETAILS::Reference; $Ref ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Link; INVOICE DETAILS::ID_Invoice_pk ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Link; $Link ]
      •      
      •           Set Field [ INVOICE DETAILS::Type; "Deposit" ]
      •      
      •           Set Field [ INVOICE DETAILS::Tax Code; $VATCODE ]
      •      
      •           Set Field [ INVOICE DETAILS::Tax_Percentage; $VAT ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Created; "Yes" ]
      •      
      •           Perform Script [ “Copy Shipping to Shipping” ]
      •      
      •           Set Variable [ $InvoiceID; Value:INVOICE DETAILS::ID_Invoice_pk ]
      •      
      •           Freeze Window
      •      
      •           #Set up line items
      •      
      •           Go to Layout [ “Invoice Items” (invoicedetails_INVOICEITEM) ]
      •      
      •           New Record/Request
      •      
      •           Set Field [ invoicedetails_INVOICEITEM::ID_Invoice_fk; $InvoiceID ]
      •      
      •           Set Field [ invoicedetails_INVOICEITEM::Item; "Dep" ]
      •      
      •           Set Field [ invoicedetails_INVOICEITEM::Description; "Deposit for Club Fender" & " " & $Order ]
      •      
      •           Set Field [ invoicedetails_INVOICEITEM::Price; INVOICE DETAILS::Deposit Amount/(INVOICE DETAILS::Tax_Percentage + 1) ]
      •      
      •           #Confirm payment
      •      
      •           Show Custom Dialog [ Title: "Settle Deposit"; Message: "Has the customer paid the deposit?"; Default Button: “Yes”, Commit: “Yes”; Button 2: “No”, Commit: “No” ]
      •      
      •           #Paid
      •      
      •           If [ Get (LastMessageChoice) = 1 ]
      •      
      •           Go to Layout [ “Invoice” (INVOICE DETAILS) ]
      •      
      •           Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICE DETAILS::ID_Invoice_pk: “$OriginalInvoiceID” ] [ Restore ]
      •      
      •           Set Field [ INVOICE DETAILS::Comments Invoice; "Received with thanks, the sum of £" & INVOICE DETAILS::Deposit Amount ]
      •      
      •           Commit Records/Requests [ Skip data entry validation; No dialog ]
      •      
      •           Set Field [ INVOICE DETAILS::Schedule Base; "In Manufacture" ]
      •      
      •           Show Custom Dialog [ Title: "Enter Payment"; Message: "Please add new payment for " & INVOICE DETAILS::Billing_Address to & "."; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           Go to Layout [ “Invoice Print” (INVOICEITEMS) ]
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Print [ Current record; All Pages; Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore: Brother MFC-7840W; No dialog ]
      •      
      •           If [ Get (LastError) = 0 ]
      •      
      •           #Set Print TimeStamp
      •      
      •           Enter Browse Mode
      •      
      •           Go to Layout [ “Order” (INVOICE DETAILS) ]
      •      
      •           Set Field [ INVOICE DETAILS::TimeStamp_Printed Invoice; Get (CurrentTimeStamp) ]
      •      
      •           End If
      •      
      •           Go to Layout [ “Payment List” (PYMNT) ]
      •      
      •           End If
      •      
      •           #Not Paid
      •      
      •           If [ Get (LastMessageChoice) = 2 ]
      •      
      •           Go to Layout [ “Invoice” (INVOICE DETAILS) ]
      •      
      •           Set Field [ INVOICE DETAILS::Comments Invoice; "We shall commence manufacture on receipt of this deposit." ]
      •      
      •           Set Field [ INVOICE DETAILS::Schedule Base; "In Manufacture" ]
      •      
      •           Commit Records/Requests [ Skip data entry validation; No dialog ]
      •      
      •           Go to Related Record [ From table: “invoicedetails_INVOICEITEM”; Using layout: “Invoice Print” (INVOICEITEMS) ] [ Show only related records ]
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Print [ Current record; All Pages; Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore: Brother HL-3070CW series; No dialog ]
      •      
      •           If [ Get (LastError) = 0 ]
      •      
      •           #Set Print TimeStamp
      •      
      •           Enter Browse Mode
      •      
      •           Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICE DETAILS::ID_Invoice_pk: “$OriginalInvoiceID” ] [ Restore ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Link; $OriginalInvoiceID ]
      •      
      •           Go to Layout [ “Order” (INVOICE DETAILS) ]
      •      
      •           Set Field [ INVOICE DETAILS::TimeStamp_Printed Invoice; Get (CurrentTimeStamp) ]
      •      
      •           End If
      •      
      •           Show Custom Dialog [ Title: "Reminder!!"; Message: "Don't forget to chase the customer for the deposit!"; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICE DETAILS::ID_Invoice_pk: “$OriginalInvoiceID” ] [ Restore ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Link; $OriginalInvoiceID ]
      •      
      •           Set Field [ INVOICE DETAILS::Deposit Link; $InvoiceID ]
      •      
      •           Go to Layout [ “Order” (INVOICE DETAILS) ]
      •      
      •           End If
      •      
      •           End If