Form Copy

I am trying to do a copy from or just do a new and programically fill in the data. Here is my code. However, it does not seem like my form go filled in with the new data?

detailForm.editNewRecord();
detailForm.setValue(“status”, “A”);
detailForm.setValue(“type”, oldRecord.getAttribute(“type”));
detailForm.setValue(“name”, “NEW NAME”);

What am I missing?

Thanks,

This looks like it should work fine. setValue() is an appropriate API to set the value of an individual field within the form (It’s a very fundamental method and extremely unlikely to be broken).

Probably best to post a standalone test case demonstrating the problem.

Note: If you do want another approach, another option would be to pass a HashMap of initial values to form.editNewRecord()

That is strange. Because as you can see I force the “name” with a new value.

I tried the HashMap and that seem to work.

Thanks,