Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / How to delete usage da...
Finance forum

How to delete usage data for a specific form in D365FO

(0) ShareShare
ReportReport
Posted on by 1,433

In Purchase order there is a generate confirmation which brings up a form, and there is a Confirm button under the Action group which just confirm and doesn't bring up the PurchEditLines form.

SalesOrder doesn't have this feature. So I have created a confirmation that doesn't bring up the SalesEditLines form. However, when I run this confirm first and then the generate confirmation, I have to clear my usage data before the Generate confirmation brings up the SalesEditLines form again.

I can call the below logic, but it clears all usage data for the current user:

SysLastValue lastValue;
    userId  userId = curUserId();

    ttsbegin;
    delete_from lastValue
        where lastValue.UserId == userId;
    ttscommit;

I don't see the "SysLastValue" table in the AOT in Visual Studio to see if it has other fields to use in the criteria.

Purchase Order must do it somewhere because I can flip between the action confirm and the Generate Confirmation with Generate Confirmation always showing the form. I cannot see where it is doing it though because it also runs purchformLetter.forceSaleLast(), same as SalesFormLetter.

Does anyone know what I'm missing? Thanks.

  • Retha Profile Picture
    Retha 1,433 on at
    RE: How to delete usage data for a specific form in D365FO

    Martin I've run a query against SysLastValue and both the generate confirmation button and my new confirmation button creates the sysLastValue record with elementName = 'Salesformletter_confirm' and Designname = 'SalesTable'. Thus the reason why when my action confirm button is run first and then the generate confirm button, the dialog isn't shown for the generate.

    Now Purchase Order pass in the enum PurchOrder for the action Confirm and ConfirmationRequest for the generate confirmation. So I assume that is the reason why the one's lastValue doesn't influence the other one.

    However PurchFormLetter is a lot easier than SalesFormLetter in the way the latter was changed for D365. To do the same I have to add a new EnumValue to the baseEnum, then I have to figure out where all the places are I need to change to talk to this new enumValue. So I'm using Confirmation as the Enum parameter for my new class.

    My new class derives from SalesformLetter, same as SalesformLetter_Confirm derives from SalesformLetter. However when I add the construct to my class and let it instantiate my new class, it gives me an error that it cannot cast salesformletter_confirm to my new class. Looking at SalesformLeeter_Confirm.Newconfirm , which is now obsolete according to the comment just above the method, it casted salesformLetter back as salesformLetter_Confirm. I don't have time in my deadline to figure out with the new changes to SalesformLetter in D365 where to add the new enum parameter if I add it to the base enum.

    So for now I'm deleting SysLastValue where the userID is the current user and elementname = "salesformletter_confirm" and designName = "Salestable".

  • Martin Dráb Profile Picture
    Martin Dráb 230,842 Most Valuable Professional on at
    RE: How to delete usage data for a specific form in D365FO

    The fact that you must delete something from SysLastValue every time is highly suspicious. Isn't it merely hiding a bug that should be fixed?

  • Retha Profile Picture
    Retha 1,433 on at
    RE: How to delete usage data for a specific form in D365FO

    That was what I was thinking but because I couldn't find SysLastValue in the AOT to get the fields, I wasn't sure it was the way to go. Don't want to mess with an internal table

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans