cancel
Showing results for 
Search instead for 
Did you mean: 

ItemPressed Event ActionSuccess is always false when in Add Mode

Former Member
0 Kudos

Hi experts,

i have a question regarding the ActionSuccess property in the ItemPressed Event.

When working with a UserForm and an Ok Button (ID = 1) then the ActionSuccess never gets true when pressing the Button when the UserForm is in Add-Mode.

Is this normal behaviour or a bug?

Thank you for your help

Matthias

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Matthias,

True and false.

The ActionSuccess property will be true if on the Item press of button 1 the form commit and action into the database and the data is committed successfully..

From the point of view :

1. If your user form is not based on UDO/System object, it will always return false.

2. If your user form is based on UDO/System Object, the return values will depend on whether the data is committed into table.

Regards
Edy

Former Member
0 Kudos

Hi Edy,

thank you for your answer!

Well, my user form is NOT based on UDO/System object.

So it will never return true on ActionSuccess?

How to handle the following problem then?

After the Button 1 was pressed and the addon has done its work i want to set the FormMode to "OK".

But when I do this, the form automatically gets closed.

Thanks again

Matthias

edy_simon
Active Contributor
0 Kudos

Hi Matthias,

After you have finished processing

Oform.mode = boformmode.ok

Regards

Edy

Former Member
0 Kudos

Hi Edy,

yes, i know this.

But when i do this, the Form gets automatically closed!

Cheers

Matthias

edy_simon
Active Contributor
0 Kudos

Hi Matthias,

was your form in add mode when you press the button?

after pressing in add mode does not automatically close the form. It would still open in add mode.

check if your code close the form.

or a work around would be process on before item press and set the bubble event =false to stop the event from continuing.

regards

edy

Former Member
0 Kudos

Hi Mathias,

What Edy is telling you, is that this is managed automaticall by Business One: you are not supposed to change it specifically.

Regards,

Eric

Former Member
0 Kudos

Hi Edy,

yes, the form was in add mode.

I'm in the ItemPressed Event, BeforeAction=true.

There the addon does it's work and after that I set the FormMode to OK.

This closes the form!

Why I'm in BeforeAction=true? Because i have to know if the form is in add mode or in update mode, because I do different things regarding to the form mode.

@Eric:

That's halfway true. B1 sets the FormMode to OK when the form was in update mode, but not, when the form was in the add mode.

Thank you

Matthias

Former Member
0 Kudos

Hi Matthias,

Sorry, but I'm not "halfway true". It means that something in your form definition or your code prevent B1 to correctly change the form's Mode

Saying this: may you check the AffectFormMode property of all items in the form and sets it to false (0 in the srf file) when it is not relevant (i.e; all buttons, all static text, the Matrix object, etc.)?

Regards,

Eric

pedro_magueija
Active Contributor
0 Kudos

Hi everyone,

Please excuse the intrusion, just wanted to suggest two things:

Have you disabled the form.AutoManaged? This will prevent B1 from managing the modes (note that you'll have to do it).

Can you change the id of the button (id 1 is a special Id telling B1 it's the "Add" button, same for Id 2 "Cancel")?

I'm only suggesting this because it seems you want to control the mode changing of the form yourself.

Hope it helps.

Good luck.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

edy_simon
Active Contributor
0 Kudos

Hi Matthias,


I'm in the ItemPressed Event, BeforeAction=true.

There the addon does it's work and after that I set the FormMode to OK.

This closes the form!

If you set the form mode to Ok in the before action = true, definitely it will close the form.

Set Bubbleevent = false

To stop the form from closing.

Or if you are using B1de, return false.

Regards

Edy

Answers (0)