Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / get modified records o...
Finance forum
Suggested answer

get modified records only from entity x++

editSubscribe (1) ShareShare
ReportReport
Posted on by 339
I need to create a new custom table like (X table ) and entity with data source of (X table ) then make this entity return only modified records on this table 
I found property (allow row version change tracking) but I can't find how to use it or how it will return the modified records only 
there is any solution ?
  • Martin Dráb Profile Picture
    Martin Dráb 223,155 Super User on at
    get modified records only from entity x++
     Menna, if you want our help, you'll need to tell us more than that you wrote some code and got some errors.
  • Suggested answer
    MuthukumaranAX Profile Picture
    MuthukumaranAX 2,893 on at
    get modified records only from entity x++
  • Layan Jwei Profile Picture
    Layan Jwei 3,029 Super User on at
    get modified records only from entity x++
    Hi Menna,

    Did the errors only appear when u added the computed column? ( as i don't think the issue is from this field)

    you can delete the computed column and do build and sync -- make sure there are no errors, then add the computed column again and do the build and sync to tell
  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 339 on at
    get modified records only from entity x++
    I disabled row change tracking from table and entity also I got the same errors
  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 339 on at
    get modified records only from entity x++
    its a custom table , rec version will appear without enable row change tracking ?
     
  • Layan Jwei Profile Picture
    Layan Jwei 3,029 Super User on at
    get modified records only from entity x++
    Hi,

    Why did u enable row change tracking on the table? did it now work without it?
  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 339 on at
    get modified records only from entity x++
    I got all of these errors when I added your method 
    What's wrong ?
    I added this method and enable row change tracking in table only not in entity 
  • Layan Jwei Profile Picture
    Layan Jwei 3,029 Super User on at
    get modified records only from entity x++
    Hi,
     
    Is your issue fixed? If yes, then please verify the answers that helped.
     
    Thanks,
    Layan Jweihan
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 3,029 Super User on at
    get modified records only from entity x++
    Hi Menna,

    Yes, you should be able to do so.

    Simply, create a new string unmapped field and link it the method you will create in the entity.
    https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/data-entity-computed-columns-virtual-fields#example-create-a-computed-field

    The method will look like sth like this:
     
        public static server str modifiedRecords()
        {
            return SysComputedColumn::if(SysComputedColumn::equalExpression(SysComputedColumn::comparisonField(tableStr(CustCustomerV3Entity),identifierStr(CustTable),fieldStr(CustTable,RecVersion)),SysComputedColumn::comparisonLiteral("1")),SysComputedColumn::returnLiteral(1), SysComputedColumn::returnLiteral(0));
        }
    and now in the data entity project, you can filter this computed field to equal 1


    I think you could also for example, check if modified field != createdDateTime instead of recVersion-- this would also mean that records have been modified

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future.
  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 339 on at
    get modified records only from entity x++
    Can I filter on recVersion without set allow row version change tracking to yes ?
    when I set it to yes I can't use it , it gives me alot of errors like (can create a record on entity)
    so there is a document to how use it ? or can I filter without this property ? 
    If I can filter without it how can I get recVersion of entity to add to fields ?
     

Helpful resources

Quick Links

Take the Community feedback survey!

Answer this brief 15-question survey about your Community experience…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,361 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,155 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans