web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

DBsync error on TAMVENDORREBATEAGREEMENTPRODUCTSELECTIONV2ENTITY view: looks like a SCM label issue

(0) ShareShare
ReportReport
Posted on by 326
I'm seeing some odd behaviour deploying a package built on a T1/CHE build box and hoping folks can please offer some thoughts. The package contains 6 VAR models, and we have a continuous deployment pipeline in ADO that uploads the package to LCS then triggers deployment to a T1 'test' box (which has only ever had deployable packages applied, never been used as a dev box.  The first deployment always fails, but if I manually apply the same LCS asset, it succeeds. Same behaviour on another T1 environment I provisioned just to investigate, so I don't think it's intrinsically anything to do with the T1 box, but something about the package. So, I've tried a full build of all VAR models on an actual dev box: no issues. A colleague suggested that the full deployable package will include some checking of referenced packages, so I've tried a build of the models & reference models on the dev box: no errors during compile, but dbsync now gives an error on a standard view. Based on the label reference in there, I would have said something to do with Supply Chain Management, but when I search for @SCM references in K:/AOSService, most of them appear in the ApplicationSuite model folder.
 
CREATE VIEW [DBO].[TAMVENDORREBATEAGREEMENTPRODUCTSELECTIONV2ENTITY] AS SELECT T1.INVENTDIMID AS INVENTDIMID, T1.ITEMID AS ITEMNUMBER, T1.VENDREBATEAGREEMENTREFRECID AS REBATEAGREEMENTREFRECID, T1.UNITID AS PRODUCTUNITSYMBOL, T1.RECVERSION AS RECVERSION, T1.DATAAREAID AS DATAAREAID, T1.PARTITION AS PARTITION, T1.RECID AS RECID, T2.VENDREBATERELATION AS VENDORACCOUNTNUMBER, T2.RECVERSION AS RECVERSION#2, T2.DATAAREAID AS DATAAREAID#2, T2.PARTITION AS PARTITION#2, T2.RECID AS RECID#2, T3.CONFIGID AS PRODUCTCONFIGURATIONID, T3.INVENTCOLORID AS PRODUCTCOLORID, T3.INVENTLOCATIONID AS QUALIFYINGWAREHOUSEID, T3.INVENTSITEID AS QUALIFYINGSITEID, T3.INVENTSIZEID AS PRODUCTSIZEID, T3.INVENTSTYLEID AS PRODUCTSTYLEID, T3.RECVERSION AS RECVERSION#3, T3.DATAAREAID AS DATAAREAID#3, T3.PARTITION AS PARTITION#3, T3.RECID AS RECID#3, (CAST ((@SCM:SqlFieldStringFormat) AS NVARCHAR(20))) AS REBATEAGREEMENTID, CAST(NULL AS NVARCHAR(10)) AS PRODUCTVERSIONID FROM TAMVENDREBATEITEM T1 CROSS JOIN TAMVENDREBATEAGREEMENT T2 CROSS JOIN INVENTDIM T3 WHERE(((( T1.VENDREBATEAGREEMENTREFRECID  =  T2.RECID)  AND ( T1.DATAAREAID  =  T2.DATAAREAID))  AND ( T1.PARTITION  =  T2.PARTITION))  AND ((( T1.INVENTDIMID  =  T3.INVENTDIMID)  AND ( T1.DATAAREAID  =  T3.DATAAREAID))  AND ( T1.PARTITION  =  T3.PARTITION))) |  SQL Exception Number - 137 - System.Data.SqlClient.SqlException: Must declare the scalar variable @SCM.
 
Any thoughts appreciated: I've now got a somewhat broken dev box, and still have my confusing /first deployment fails, second deployment succeeds/ behaviour. The ADO pipeline history looks like all releases have failed, when they succeeded with a little persistence :)
I have the same question (0)
  • MuthukumaranAX Profile Picture
    2,903 on at
    In your 2nd machine (Investigation machine) does it have any data or contain blank DB?
     
    looks like this entity "TAMVENDORREBATEAGREEMENTPRODUCTSELECTIONV2ENTITY" has a duplicate record, can you check the duplicate record ?
     
  • Rich Profile Picture
    326 on at
    Thanks for the input Muthu. The investigation machine had a blank DB when I tried the package deployment that failed.
     
    What leads you to the idea that the view/entity has a duplicate record? The view exists on both my "somewhat broken" dev box and a newly-provisioned dev box (where I've built our VAR models & completed a DBsync, haven't tried building referenced models). For both dev boxes (and for the 'test' box where we deploy packages), querying the view directly through SSMS returns 0 records.  Given that the view exists, I can work back and believe that @SCM:SqlFieldStringFormat in this context should be the text T1.VENDREBATEAGREEMENTREFRECID, and the label search makes some sense of that, since the label text is %1.%2, and the label is used in /DataEntityView/AMVendorRebateAgreementProductSelectionV2Entity/Methods/rebateAgreementIdComputedColumn (code below).  All told, it still feels to me like this method isn't finding the label text to replace the label code.
     
        private static str rebateAgreementIdComputedColumn()
        {
            var rebateAgreementRecIdField = TAMVendorRebateAgreementProductSelectionV2Entity::rebateAgreementRecIdField();
            DictField rebateAgreementId = new DictField(tableNum(TAMVendRebateItem), fieldNum(TAMVendRebateItem, VendRebateAgreementRefRecId));
            
            return strFmt("@SCM:SqlFieldStringFormat", TAMVendorRebateAgreementProductSelectionV2Entity::getViewSQLTableName(rebateAgreementRecIdField), rebateAgreementId.name(DbBackend::Sql));
        }
    
    Think I must have been missing similar errors also thrown on previous DB sync, as I think the same label is causing a problem for 4 other views. Adding Application foundation model to my VAR models on build doesn't change this behaviour: I still see the 5 views below all report the same error.
    • PurchRequestForQuotationReplyScoringCriterionEntity
    • TAMVendorRebateAgreementHeaderEntity
    • TAMVendorRebateAgreementLineEntity
    • TAMVendorRebateAgreementProductSelectionEntity
    • TAMVendorRebateAgreementProductSelectionV2Entity
    Edit: trying again with Application suite in the build list


  • Suggested answer
    Rich Profile Picture
    326 on at
    Looks like Application suite model was indeed the issue: if I build that, my VAR models, and all referenced packages, a 2 hour build plus 30 minute DB sync succeeds, and the dev box now looks good.
     
    Will start another thread for the deployment question to keep things distinct.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans