4 Replies Latest reply on Feb 6, 2015 7:15 AM by weedonpaul

    Is there a way to alter a record IF it appears in a portal

    weedonpaul

      Title

      Is there a way to alter a record IF it appears in a portal

      Post

      I have a table called 'lines' which is linked to 'invoices' via clientID, i would like to add an invoice number to the 'lines'  record when it is added to an invoice, but be able to remove it (without removing the 'lines' record)if the invoice is deleted or a particular line item is removed from the invoice. (we have pain in the arse clients that will ask us to part invoice after invoices are created or bill separately for different things)

        • 1. Re: Is there a way to alter a record IF it appears in a portal
          philmodjunk

          I don't quiet see why you would retain a line item record but delete the invoice record it is related to. I can see splitting an invoice or moving an existing line item from one invoice to another, but not creating an "orphan" line item that is not linked to any existing invoice as such a record cannot be billed until it is associated with another invoice record.

          Scripts can do all of the above. You can also do them manually by editing the value of the Match field in the line item table, but I do not recommend that you do that manually as a mistake can easily produce such "orphan" line items.

          So yes, you can change line item records in the portal, this is another case where you simply edit a field in the portal, but I don't think that it's a good idea to do so without some scripted support.

          • 2. Re: Is there a way to alter a record IF it appears in a portal
            weedonpaul

            my line items essentially are tracking time, at some point usually at the end of the month I will run an invoice, where i will put in the dates when the invoice period starts and the end point. I want to then gather all the line items up that are in that period and put them in an invoice. at that point I want to assign a invoice number so that I can look for line items that haven't been billed and avoid line items going on two invoices.

            are there any scripting commands that look at a portal?

             

            • 3. Re: Is there a way to alter a record IF it appears in a portal
              philmodjunk

              Then you can use a combination of client ID and a date range to link an invoice to a new set of billing entries. You can perform a find on the line items table for them and use replace field contents to link them to a new invoice.

              Say you create a new invoice and select the customer for it from a value list. Then enter the desired dates into a pair of date fields to specify the range and click a button that performs this script:

              Set Variable [$CustID ; Value: Invoices::_fkCustomerID ]
              Set Variable [$DateStart ; Value:Invoices::DateStart ]
              Set Variable [$DateEnd ; Value: Invoices::DateEnd ]
              Set Variable [$InvoiceID ; Value: Invoices::__pkInvoiceID ]
              Go to Layout ["LineItems" (LineItems) ]
              Enter Find Mode [] ---> clear the pause check box. Do not specify find criteria here
              Set Field [LineItems::_fkClientID ; $CustID ]
              Set FIeld [LineItems::Date ; DateStart & "..." & DateEnd ]
              Set Error Capture [on]
              Perform Find []
              If [Get (foundCount ) ]
                 Replace Field Contents [no dialog ; LineItems::_fkInvoiceID ; $InvoiceID ]
              Else
                 Show Custom Dialog ["No records were found"]
              End If

              • 4. Re: Is there a way to alter a record IF it appears in a portal
                weedonpaul

                you are a star i will try that over the weekend:-)