Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to restrict data from deletion table

(0) ShareShare
ReportReport
Posted on by 2

Hi All,

As per customer requirement i made one form "POProductReceipt". This form opened from 2 locations :

1. Procruement and Sourcing

2. PO -- ALL PO -- Select any PO -- Open PO -- Then add button ( Product receipt print ).

In this form "POProductReceipt" i have used table ""POProductReceipt".

The requirement is after "POProductReceipt"print record should be deleted. So, i wrote code for delete in Form -- init() and canClose().

For this form ""POProductReceipt" i have created 2 menu items and call respectively..

**** My thinking is suppose user open the form from "Procruement and Sourcing" and insert 5 lines and in the same time some one open the same form from point no 2 ( PO...) then what will happened??

****Because i wrote for delete in Form -- init() and CanClose()

So, if the 2nd person going to open form then it will delete record from table ""POProductReceipt" and in the same time User1 is working in same form from "Procruement and Sourcing".

Shall i add userSession() with delete_POProductReceipt in where clause ?

So, i think it will restrict to delete data based on user connection. My concern is i want both user will work properly without any disturbance.

Please give me more shed on this.

Thanks!

*This post is locked for comments

  • @rp@n Profile Picture
    @rp@n 2 on at
    RE: How to restrict data from deletion table

    Thanks Andre and Sukrut

    I mean to say within scope only.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: How to restrict data from deletion table

    Hi Arpan,

    Yes both are doing the same job. If there are just a few records, you can use in memory. If the temp data  becomes larger, in memory will swap the data to disk. Then TempDB might be better.

  • Verified answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,680 Moderator on at
    RE: How to restrict data from deletion table

    Temp tables are automatically dropped when decalred  variable   goes out of scope.    

  • @rp@n Profile Picture
    @rp@n 2 on at
    RE: How to restrict data from deletion table

    Hi Andre,

    The temp table like ( In Memory and TempDB ) both stored data based on current user and current session id ?

    Please give me more shed on this.

    Thanks!

  • @rp@n Profile Picture
    @rp@n 2 on at
    RE: How to restrict data from deletion table

    Thanks Andre

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: How to restrict data from deletion table

    Hi Arpan,

    You can use temporary tables for this purpose. Then you don't have to manually delete it and the data is per session user. However, if you need the records in other processes, you might need to add logic to pass the temporary records or like you mentioned, use a persistent table and add the user or usersession field as distinction.

  • @rp@n Profile Picture
    @rp@n 2 on at
    RE: How to restrict data from deletion table

    No, it's only use for label printing. So, don't worry.

    I am not going to  delete Product receipt from actual table.

    In my form it's showing product receipt based on lookup. It's a completely new form and table.

    The form is only use for label printing

    Kindly suggest me how will manage based on above scenario.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,614 User Group Leader on at
    RE: How to restrict data from deletion table

    Why your customer want to delete product receipts?

    I see that leading to data inconsistency and probably playing with integrity of the system. It is very important document for almost any organization.

    Do yo mind asking your customer why they want to do so? Or may be you would want to copy/paste email of your customer here.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans