Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

How to revert a field back to its previous value

Posted on by 54
Dear All,
 
I have added two fields in PO line - Status(Enum) and Rejected(Checkbox), If I reject the line, its status should change to Rejected, however, If I later uncheck the Rejected checkbox, the status to change to its previous value(Submitted, approved, canceled.. etc). 
I can achieve the first condition, however, I cannot revert the status using xrec.
 
Any suggestion?
 
Thank you in advance!
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,696 Super User 2024 Season 2 on at
    How to revert a field back to its previous value
    Another way is to enable the Change log, find the old value of this field in the code, and update it to your table.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,696 Super User 2024 Season 2 on at
    How to revert a field back to its previous value
    Because there is no concept of caching, as mentioned by several experts above, you must use another field to save this value for restoration.
     
    Hope this helps as well.
    Thanks.
    ZHU
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,559 Super User 2024 Season 2 on at
    How to revert a field back to its previous value
    Hi,
     
    You must create another field to save the last value of enum when you reject the line !
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 17,965 Super User 2024 Season 2 on at
    How to revert a field back to its previous value
    Hi,
     
    In that case you will have to create an additional field like status.
     
    OnValidate of Rejected, you need to save status value to New Field and then reset the Status field.
     
    Regards,
    Saurav Dhyani
  • Suggested answer
    gdrenteria Profile Picture
    gdrenteria 12,183 Most Valuable Professional on at
    How to revert a field back to its previous value
    Hi
    You could save the previous state in a different field. You will always have the previous state there to revert if necessary.
    BR
    GR

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans