Why was this change required?
In the remanufactured cartridge industry there is an accepted failure rate of in the region of 2%. So out of 30’000 lines a month, that’s up to 600 returns. With that level of transactions to process, every automation we can apply makes a difference.
In this example I have an issue where the customer services team don’t always mark the ‘return’ flag field correctly when raising the Rma line. As a result the accounts team raise a credit and some of the lines don’t process as they are marked as to be returned and have a returned quantity of zero.
This event had been added to various event handlers on the Rma forms.
- Check if any of the Rma lines are marked as “return” if not end
- if any are marked as return offer the user the option to continue anyway, to clear the return flags or cancel
- if the user chooses to clear the return flags, do this on all related lines using an Ido update request.
Here’s the VB Code
Function PBTI_CheckReturnFlag() As Integer
Dim responsermaitems As LoadCollectionResponseData
Dim result As wsMsgBoxResult = Nothing
responsermaitems = Me.IDOClient.LoadCollection( _"SLRmaitems", _ "RmaNum, EvalCode_2, RmaLine", _ "RmaNum = '" & ThisForm.CurrentIDOCollection.CurrentItem("RmaNum").Value & "' and ReturnItem = 1" _ & " and DerQtyReceived = 0", _"CreateDate Desc", 0)
If responsermaitems.Items.Count > 0 Then
result = Application.ShowMessage(responsermaitems.Items.Count & ” line(s) are set as returns but none have been received. ” _
& vbCrLf & vbCrLf _
& “Press YES if you would like to automatically change all these to not be returned items and credit them.” _
& vbCrLf _
& vbCrLf & “Press NO if you would like them to be left as retrun items and for them not to be credited” _
& vbCrLf _
& vbCrLf _
& “Press CANCEL to abort and change nothing” _
If (result = wsMsgBoxResult.wsYes) Then
Dim updateRequest As UpdateCollectionRequestData
Dim rowcount As Integer = 0
While rowcount < responsermaitems.Items.Count
Dim updateItem As IDOUpdateItem
‘ create a new UpdateCollection request
updateRequest = New UpdateCollectionRequestData(“SLRmaitems”)
‘ create a new update item for the row we loaded
updateItem = New IDOUpdateItem(UpdateAction.Update, responsermaitems.Items(rowcount).ItemID)
‘ add CustNum property from LoadResposne, not modified
updateItem.Properties.Add(“ReturnItem”, “0”, True)
‘ add the update item to update request
‘ save changes
rowcount = rowcount + 1
ElseIf (result = wsMsgBoxResult.wsNo) Then
Application.ShowMessage(“You Pressed No”)