Add Button (save and open new form) on Form EcoResProductCreate

Kranthi,

Now I have no error on method, but the form is closed and saved record, in my scenario I want to prevent of closing form just new record and clear values

void clicked()
{
element.saveControlValuesToProduct();
element.initDefaultControlValues();

if (element.validateWrite())
{
if (element.write())
{

closedOK = false;
super();

}

}
}

I think you are using a command button (OK). Try using a normal button.

Hi Kranthi

I changed the command of my button to normal button and now the form is saving the records and the form its not being closed which is perfect, but it is not clearing the field values after clicking the button.
What should I do!

BR

You may have to clear them explicitly in your code.

Kranthi,

How to clear them ?

BR

Example → identification_ProductNumber.text(’’); // take the control name and set the value.
If the product number is auto generated, you should also trigger the code to generate the product number and item id.

Hi,
when I click the button for the first time all fields are saved and cleared but when I try for the second time record is not be
ing save, I am geting an error (Cannot create a record in Product number (EcoResProductIdentifier). Product number: 150193.
The record already exists.)

Are you assigning the new product after clearing the values? Start looking at, \Forms\EcoResProductCreate\Methods\write

Kranthi,

I stuck in this case , could you be more specific on how to assign the new product after clearing the values.

Thanks,

Try by calling, initNumberSequences method after creating new record and clearing the values.
If you still see the issue have a look at, \Forms\EcoResProductCreate\Methods\setProductNumber
\Forms\EcoResProductCreate\Methods\setItemId