Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / How to add a field wit...
Finance forum
Answered

How to add a field with xSysLastValue to salesEditLines (for invoice posting)

Posted on by 13
Hi All,
 
I have added a field on the salesEditLines form for invoice posting purposes. Using https://www.linkedin.com/pulse/storing-last-form-values-m-imran-qasmi-xme0c I managed to save/retrieve the last values. So far so good.
 
Next I created two batch jobs for automatic invoice posting; One for invoices in USD and one for invoices in CAD. What happens ? When I set my new field to Yes on the USA invoice job, it will automatically set it to Yes on the CAD invoice job as well. And vice versa:
 
I open the invoice job USD, go to parameters, change my new field to Yes and click OK.
I open the invoice job CAD, go to parameters and notice that my new field is set to Yes here as well. I set my new field to No and click OK
I open the invoice job USD, go to parameters and notice that my new field is set to No here as well
Etc.
 
If I understand the modifications from https://www.linkedin.com/pulse/storing-last-form-values-m-imran-qasmi-xme0c correctly, this might be caused by the fact that these modifications look at dataAreaId, curUserId, MenuItem and name are the unique combination. And when these modifications are called from the Batch jobs, they are the same and therefore changing one will automatically change the other.
So, this might not be the correct approach for this, but I cannot find any examples on google on how to achieve this in the correct way.
 
What I need is a field on the salesEditLines form which value will be remembered when it is changed in the parameters of an invoice Batch job.
 
Would you point me in the right direction ?
 
Thanks,
Gerard Verbruggen
 
 
 
Categories:
  • Martin Dráb Profile Picture
    Martin Dráb 228,251 Most Valuable Professional on at
    How to add a field with xSysLastValue to salesEditLines (for invoice posting)
    Note that storing last used parameters in SysLastValue is a standard feature of batch frameworks (both RunBase and SysOperation).
  • CU13081248-0 Profile Picture
    CU13081248-0 13 on at
    How to add a field with xSysLastValue to salesEditLines (for invoice posting)
    Thanks  Martin for you reply. So indeed the wrong approach.
     
    I'm going for a different approach where we store the required values in a parameter table and retrieve the values in the DP class. Makes live easier.
     
    Cheers,
    Gerard
     
     
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 228,251 Most Valuable Professional on at
    How to add a field with xSysLastValue to salesEditLines (for invoice posting)
    The behaviour you see it's what you implemented, but you apparently want something else and therefore your change is wrong. You store the last value you selected in the form, e.g. if you used No, you'll see No when you open the form again.
     
    But what you seem to want is actually storing the value as a parameter of your batch, not just the form (shared by batches). Please realize that the posting processes is backed by FormLetter and batch frameworks; ignoring them doesn't sound like a good idea.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,353 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans