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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Synchronization error on computed column

(0) ShareShare
ReportReport
Posted on by 9,228 Super User 2026 Season 2

Hi All,

I am trying to add new computed field to standard data entity, what I want to return to this field NO or Yes based on if current record has data in related table (I want to do select statement to find if current record has related data  and return yes or no based on it . I am truing this but synchronization issue appear 

return SysComputedColumn::if(
SysComputedColumn::isNotNullExpression(expression),
SysComputedColumn::returnLiteral(NoYes::Yes),
SysComputedColumn::returnLiteral(NoYes::No));

expression contain sql statement to check if it has data in the related table.

Any hint?

  • André Arnaud de Calavon Profile Picture
    308,274 Super User 2026 Season 2 on at

    Hi Waed,

    What is the exact error and when does this appear?

  • Verified answer
    huijij Profile Picture
    19,813 on at

    Hi,

    As mentioned, please provide us with the more details.

    Please check SysComputedColumn class in MS document:

    learn.microsoft.com/.../gg945162(v=ax.60)

    And the method isNotNullExpression() is not mentioned in the class.

    Nevertheless, it is recommended that you split the 3 expressions in if condition, and then debug to see the root cause of the error.

  • Waed Ayyad Profile Picture
    9,228 Super User 2026 Season 2 on at

    Hi Andre,

    this is the error  and appear when I am trying to build and sync code

    pastedimage1675952282741v1.png

  • Waed Ayyad Profile Picture
    9,228 Super User 2026 Season 2 on at

    Hi Judy,

    Can I debug it? I tried to export data and put break points, but the debugger did not hit. Any hints?

  • Martin Dráb Profile Picture
    241,656 Most Valuable Professional on at

    It would help if you shared all your code and the result of the method. The problem is likely caused by what you have in the expression, which you told nothing about.

    But from what I know, your code looks logically wrong to me. The expression DirPartyView.RoleType = 1 will never return NULL, will it?

  • Mariano Gracia Profile Picture
    on at

    Write a simple runnable class, call the method and print the result in a screen, in the end is a string with the SQL syntax that will be added into the entity, which is a view in SQL, I do it each time I have to write a computed column, execute the query in SQL management studio (take notice that you'll have to add the query to the underneath sql code from the view), this way you'll see where is the error, fix it and then you'll know what to do in x++

  • Waed Ayyad Profile Picture
    9,228 Super User 2026 Season 2 on at

    Hi Martin,

    this the code that I call on Computed field:

           str expression;

           str roleTypeValue = SysComputedColumn::returnLiteral(DirPartyRoleType::Customer);

           expression = strFmt(@"SELECT DirPartyView.RecId FROM DirPartyView

               JOIN DIRPARTYTABLE on DirPartyView.PARTY = DIRPARTYTABLE.RECID

               WHERE DIRPARTYTABLE.PARTYNUMBER = %1

               and DirPartyView.RoleType = %2",

               SysComputedColumn::returnField(tableStr(DirPartyV2Entity),

               dataEntityDataSourceStr(DirPartyV2Entity, DirPartyBaseEntity), fieldStr(DirPartyV2Entity,

              PartyNumber)), roleTypeValue);

           return SysComputedColumn::if(

           SysComputedColumn::isNotNullExpression(expression),

           SysComputedColumn::returnLiteral(NoYes::Yes),

           SysComputedColumn::returnLiteral(NoYes::No));

  • Waed Ayyad Profile Picture
    9,228 Super User 2026 Season 2 on at

    Hi Mariano,

    Yes I tried it on SQL and it is working from SQL

  • Verified answer
    Martin Dráb Profile Picture
    241,656 Most Valuable Professional on at

    I think it doesn't generate correct SQL code - you need to put the subquery to parentheses. For example:

    str roleTypeValue = SysComputedColumn::returnLiteral(DirPartyRoleType::Customer);
    
    str expression = strFmt(@"SELECT DirPartyView.RecId FROM DirPartyView
        JOIN DIRPARTYTABLE on DirPartyView.PARTY = DIRPARTYTABLE.RECID
        WHERE DIRPARTYTABLE.PARTYNUMBER = %1
        and DirPartyView.RoleType = %2",
        SysComputedColumn::returnField(tableStr(DirPartyV2Entity),
        dataEntityDataSourceStr(DirPartyV2Entity, DirPartyBaseEntity), fieldStr(DirPartyV2Entity, PartyNumber)),
        roleTypeValue);
    
    return SysComputedColumn::if(
        SysComputedColumn::isNotNullExpression(strFmt('(%1)', expression)),
        SysComputedColumn::returnLiteral(NoYes::Yes),
        SysComputedColumn::returnLiteral(NoYes::No));

    By they way, please use Insert > Code to paste code to this forum (as I did).

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 239 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 221

#3
Subra Profile Picture

Subra 166 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans