Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Writing a code to insert/update a table in a close method of a form.

Posted on by 4
Hi Everyone,
 
I have a requirement like updating or creating a Role Id for a Resource based on a customized field in the Resource setup form in Resource list page, so role Id for a resource is stored in /ResourceResourceCategorySetup/ table, is it a right approach to implement a logic in close method of Resource setup form so once user finishes setting up value in the customized field and closes the form, Role Id will be inserted or updated into ResourceResourceCategorySetup table?
 
Thanks
  • CU26071908-0 Profile Picture
    CU26071908-0 on at
    Writing a code to insert/update a table in a close method of a form.
    Implementing the logic to update or create a Role Id for a resource based on a customized field in the Resource setup form, and storing the Role Id in the /ResourceResourceCategorySetup/ table, can be achieved by placing the logic in the close method of the Resource setup form. This approach ensures that the Role Id is only updated or created once the user has finished setting up the value in the customized field and closes the form. This method can help maintain data integrity and ensures that the information is not prematurely updated during the form interaction. However, it's crucial to ensure that the close method is correctly handling all possible scenarios, including validation checks and potential error handling, to prevent any issues during the data update process. This approach can be considered appropriate if the resource setup form's close method is designed to handle such logic and is a part of the standard workflow for updating resource details.

     
  • Micheal Angel Profile Picture
    Micheal Angel 4 on at
    Writing a code to insert/update a table in a close method of a form.
    Hi @Waed Ayyad,
    Thank you for your response
  • Verified answer
    Waed Ayyad Profile Picture
    Waed Ayyad 3,904 on at
    Writing a code to insert/update a table in a close method of a form.
     
     Depending on your requirement you want to create the Role Id only on this form, so you can implement your solution on the Write method on your form DataSource, but if your logic is not limited to this form, you can add your logic on the insert and update method of the table.
     
     
     
     
     
     
     
    Regards,
    Waed Ayyad
     
    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
     

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans