AnsweredAssumed Answered

Why do Related records not show in portal

Question asked by ChrisCourtney-Stones on Mar 19, 2017
Latest reply on Mar 20, 2017 by keywords

Hi All, When I add records to a quote they may be added in multiples until the Quote is accepted. When a quote is accepted I now have to change any multiple service Products to single products to allow for the creation of the barcodes,(serial numbers), used during the service so that any parts used on the product are recorded against that particular product. I created a script which checks for any service Products that are showing multiples and duplicates them the required number of times. The duplication works fine in the QuoteItems layout but unless after duplication, I select either the department or product, then the items do not show in the QuoteItems portal on the Quotes layout despite the Qty being reduced from whatever it was set at to 1. The Key field is the QuoteId

The first image is of the quote,in the Quote Layout, having been accepted, being amended by the addition of the last two portal rows.

The next image is of the QuoteItems layout showing the items in that quote.

The next image shows the Quote Layout after the items have been duplicated, note the Qty of the last two items in the portal

The next image is of the QuoteItems and shows that the items have been duplicated.


(sorry but the attachments appear to be in reverse order)


Here is the script used to duplicate the Products

Set Error Capture [ On ]

Set Variable
[ $QuoteId; Value:Quotations::__QuoteId ] Go to Layout [ “dLayQuoteItems” (QuoteItems) ]

Enter Find Mode [ Specified Find Requests: Find Records; Criteria: QuoteItems::QTY: “>1” AND QuoteItems::_QuoteId: “$QuoteId” AND QuoteItems::ServiceFlag: “=1” ]
[ Restore ]

Perform Find [ ]
If [ Get (LastError) = 401 ]

Go to Layout [ original layout ]

Exit Script [ ] End If

Go to Record/Request/Page

[ First ]

Set Variable [ $QTY; Value:QuoteItems::QTY ]

Set Field [ QuoteItems::QTY_Count; $QTY ]

Set Variable [ $QTY_Count; Value:QuoteItems::QTY_Count ]

Insert Calculated Result [ QuoteItems::QTY; 1 ] [ Select ]

Commit Records/Requests

[ Skip data entry validation; No dialog; Force Commit ]


Duplicate Record/Request

Insert Calculated Result [ QuoteItems::QTY; 1 ] [ Select ]

Insert Calculated Result [ QuoteItems::QTY_Count; $QTY_Count-1 ] [ Select ]

Set Variable [ $QTY_Count; Value:QuoteItems::QTY_Count ]

Commit Records/Requests

[ Skip data entry validation; No dialog ]

Exit Loop If [ QuoteItems::QTY_Count = 1 ]

End Loop

End Loop