web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Error when pasting Excel lines into form grid

(1) ShareShare
ReportReport
Posted on by 2

Hi Experts,

 

I’m facing an issue while pasting records from Excel into a custom line table grid in D365FO.

My line table has a unique index on (LineNum, HeaderRef).

  • In initValue(), I assign default values when the user clicks New Line:
    • LineNum is assigned starting from 1, and increases by 1 each time a new record is created.
    • HeaderRef= Header.RecID After that, the user pastes records from Excel.

After that, the user pastes records from Excel.

  • If the pasted records also contain the same values (e.g., LineNum = 1 and HeaderRef = Header.RecId), I get this error message:
    “Changes to a previous row cannot be saved until you fix a validation issue. Continue working until you’re ready to fix this.”
  • If the Excel file doesn’t contain that same combination, the paste works fine.

Questions:

  1. How is this scenario handled in standard forms like PurchTable/PurchLine where pasting works fine?
  2. Is there a way to detect paste in the form so I can skip default initialization?
  3. What’s the best practice to avoid this duplicate issue (e.g., handling in initValue() or elsewhere)?

Thanks in advance for your help !

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    297,670 Super User 2025 Season 2 on at
    Error when pasting Excel lines into form grid
    Hi,

    Can you tell us if you used the initValue() on the form datasource? You can try to move it to the insert() method and check if the values are empty. Then only set the values.
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 878 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 681 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 496 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans