I added one field "myinventlocationId" in InventTable. I need write logic for filling this filed by inventlocationid in Inventlocation using event handler.
I think there is a relations between Inventtable - "ItemId" -inventtrans - "inventDimId" -inventDim - "InventlocationId" -Inventlocation
Can you please help me to fill this new myinventLocationid field in InventTable.
InventTable having display method - Inventlocationid () can we use that method for filling myinventlocationId field through event handler.
Can suggest me which event handler will I use for this?
First create the extension to add a new field.
Then create new class and copy the oninserted eventhandler and copy the onupdated eventhandler decoration to the same method. Then write code to get the value which you require using some select statement.
To get the value you need to go to those tables and find the relations and get the value.
But this only works for new records as I said or updating a record/records but doesnt work for earlier records.
I hope the same answer I said you earlier.
Then build sync.
Requirement:
Add a new field that is named MyInventLocationId to the InventTable table through extension. implement the logic of filling the new field through event handler.
Unique Index in InventSum is on fields ItemId and InventDimId. There will be multiple records in InventSum for same ItemId, so you can't use InventSum just be ItemId.
If you can provide exact requirement (not pointing to tables and also not referring that you need value in myInventLocationId field) like from where are you expecting InventLocationId (Warehouse) to be filled in your custom field then we can help you. I understand its a practice task for you but If its not clear to you then I suggest to please clarify the requirement.
InventTable and InventSum those both tables having common ItemId.
InventSum table having Inventlocationid
Can we fill myinventlocationId field with Inventlocationid through these two tables using event handlers
learner.d365 Any updates? Do you still need any help in your requirement.
Exactly this is what I want to understand. In this case, as the field is table level, as Mohit suggested write the runnable job code to populate the new field. Then all the db records will have values for new field. Then if they add a new record, then you have to use either event handlers or COC to populate the values like we have to write code for insert and update.
For getting exact buffer or relation you can go to the InventTable and check all the method like you may find some kind of find method() which will help you.
For assignment this design is okay. But if you get the same requirement then one problem arises if it is in real time scenario.
In that case, you need to add logic in event handlers for new records. To update existing records, You can create a runnable class and execute directly from URL
community.dynamics.com/.../running-runnable-class-through-url-in-dynamics-365-for-operations
InventTable alredy consists no of records we are adding one new field myinventlocationId to inventtable through extension. I need to implement the logic for filling new field (of old records in database) with inventlocationid through event handler.
Actually this is a practice task for me but I'm unable to getting exact solution.
I'm using legal entity - USMF
Inventlocationid means Wearhouse like 11,21,23...
We understood your requirement that you need to add or populate the data to that new field. But my question is if you use event handler, only when inserting new record or updating a record only that change comes but not for records already in the db. So I am asking what is the exact requirement is it simply for one line or real time or how? Please let us know requirement than you can ask your issue.
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156