SBX - Search With Button

SBX - Forum Post Title

Customize BI.AIC.00 default value

Microsoft Dynamics SL Forum

mmack_ asked a question on 30 Jul 2018 12:41 PM

Question Status

Unanswered

Hi All,

I have a customization on the Invoice and Adjustment Maintenance screen (BI.BAM.00) which updates the TermsID value with one populated by a SQL query.  This customization works for me on that screen but when I run Automatic Invoice Creation page (BI.AIC.00) my custom value is lost.

I'm not sure where to re-implement my customization for (BI.AIC.00). Does this require a SQL side change or I set a default value in that screen using VBA?

For a bit of background the BI.BAM.00 screen is using the following code to populate TermsID:

Sub SetTerms()
    Dim strSQLStmt As String
    Dim strTermsID As String
    Dim strProjectID As String
    
    strProjectID = GetObjectValue("cbill_project")
    
    strSQLStmt = ""
    strSQLStmt = "SELECT CASE WHEN c.termsid IS NULL OR c.termsid = '' THEN '00' ELSE c.termsid END AS termsid " & _
                 "FROM pjproj as p LEFT OUTER JOIN pjcont as c on p.contract = c.contract " & _
                 "WHERE p.project = " & SParm(strProjectID)
    
    'We use SqlFetch1 because we are using the data structure we defined for this query: bContResult
    serr1 = SqlFetch1(c1, strSQLStmt, bContResult, LenB(bContResult))
    'MsgBox "Sql executed successfully: " & serr1
    
    'SqlFetch returns 0 if records are returned or NOTFOUND if no records are returned
    If serr1 = NOTFOUND Then
        'Call MessBox("Error Locating Project " + SParm(strProjectID), MB_OK, "Can't Assign TermsID")
        Exit Sub
    Else
        'Check to see if the terms field is enabled or not so we don't modify posted records
        If cTerms.Enabled = True Then
            strTermsID = bContResult.termsid
            'Call MessBox("Assign TermsID: " + strTermsID, MB_OK, "Terms to assign")
            Call SetObjectValue("cTerms", strTermsID)
            'Call SetBufferValue("bpjinvhdr.ih_id18", strTermsID)
            
        End If
    End If
    
End Sub


Reply
Carolyn Froton responded on 8 Aug 2018 12:30 PM
My Badges

Since the parameters are being passed to the invoice via the EXE, you will have to either use VBA to insert the new data in as well OR use a trigger to populate the data.

Reply

SBX - Two Col Forum

SBX - Migrated JS