3 Replies Latest reply on Feb 19, 2017 1:59 AM by arjen.evertse

    Copying field content

    sherab4

      I have a portal that shows items for an order (see picture attached) within the portal is a popup that shows the shipping/postage details for this order.

      The order may have several OrderItems with the same Order ID and Order Date. what I want to do is when the popup is open add the Shipping Date and this should fill in the Dispatch date for all items in the portal that has the same Order ID.

      At the moment I am using a Script on Object Exit as shown in the other picture attached, but it does not fill in all the OrderItems with the same Order ID.

        • 1. Re: Copying field content
          Philip_Jaffe

          Not sure why your dispatch date is an ordritem field and not a field in the order table.  Do certain lines ship on diff dates for the same order? (ie. partial orders)

           

          If you need to set the dispatch date on a line by line basis, then I assume you would NOT want to fill in every line automatically with the same date on exiting the first line.

           

          Next, your script name says copy dispatch date to shipment date, but your set field step does the opposite.  It copies the shipment date to the dispatch date field.

           

          Most importantly to get to the core of your issue, setting the dispatch field via this script step will only work on the active portal row, not every record in the portal.  Again, if every line item on the order is going to have the same dispatch date, then that field really belongs in the Orders table anyway.

           

          But if I am misunderstanding (quite possible) then please correct me.

          • 2. Re: Copying field content
            philmodjunk

            Set Field only modifies a single field of a single record. To update multiple records with the same info requires either looping through the records and doing a set field on each or pulling up a found set and using replace field contents to update them.

             

            But unless it's possible for different items of the same order to have different shipping dates, the shipping date should be a field in orders rather than order items.

            • 3. Re: Copying field content
              arjen.evertse

              From your screen shot it looks like you are gathering much more than the dispatch date for items dispatched.

               

              As pointed out by others, if you do not have partial shipments this belongs to the Order table. If you do have partial shipments you would need a Shipments table to keep track of all the shipment details shown on the popover in your screenshot.

               

              Then you would have have each OrderItems record related to a Shipment record by only storing a key of the Shipment in the OrderItem.