XRM-OSS/D365-UI-Test

Save entity failed

Opened this issue · 4 comments

Hi.

When I run this code:

await xrmTest.Navigation.openCreateForm("contact");
await xrmTest.Attribute.setValue("lastname", "UI test");
await xrmTest.Entity.save(true);

Then gives that the following error:

Basic operations UCI › Create and save new contact

page.evaluate: Evaluation failed: Objectpage.evaluate: Evaluation failed: Object

  48 |         await xrmTest.Attribute.setValue("lastname", "UI Test");
  49 | 
> 50 |         await xrmTest.Entity.save(true);
     |            ^
  51 | 
  52 |         // await xrmTest.Attribute.setValue("primarycontactid", [{
  53 |         //     id: "C0A634A1-42C5-EB11-BACC-0022487FBED8",

  at Entity.save (node_modules/d365-ui-test/src/xrm/Entity.ts:91:39)
  at Object.<anonymous> (spec/demo-ui-test.spec.ts:50:9)

Is this a known error or do I something wrong?

I simply want to open a create form, set some field values and save the record.

But that fails..

Kind regards,

Henk Rademaker
D365-UI-Test error

Hi @HenkRademaker,

can you check whether there are other required fields on the form which you missed filling out?
Usually this is the reason for this type of error.

Kind regards,
Florian

Hi Florian,

Thanks for reply.
But.. there are no other required fields than only lastname.
I've record a video, so you can see the flow.
At the end, very briefly you can see that save action does start.. but immediately ran into the error.

Kind regards,

Henk Rademaker

Media1_Trim.mp4

Hi @HenkRademaker,

I'm currently working on improving the failure message when saving fails so that we can see the exact error in your case.

In our instances saving still works, so in the mean time you might want to try on a different entity?
It might also be that you have a custom script on the form which prevents saving for doing some asynchronous action and starts saving again.

Kind regards,
Florian

Also experienced the same issue. Solved it with a workaround by using customButton and the data-id of the 'Save' button.