Dear colleagues,
I'm currently facing an issue with a BO extension for a customer and would be glad if someone could help:
- We set two standard fields to mandatory (ui designer property via extensibility explorer)
- Unfortunately this doesn't prevent the user from saving the business document (it just adds a star* to the field description)
So I did the following:
-- added a BO-Extension for the respective Business Object ServiceOrder (xbo-File)
-- added boolean element "MyMandatoryFieldsAreFilled" to xbo-File
-- added "BeforeSave"-event to check if fields are filled and set the value of "MyMandatoryFieldsAreFilled" there
-- added "ValidationOnSave"-event in which I return "MyMandatoryFieldsAreFilled"
Now here comes the problem:
- If the user doesn't fill both fields the save process is interrupted from my "ValidationOnSave"-statement (OK)
- But, when he/she then enters values into these fields and tries to save again, "Instance with the same key already exists" error message pops up
I suppose this is because the standard procedure has already given an ID to the new BO though this should not have happened until my "ValidationOnSave" event has been evaluated. On the other hand, it seems that the standard check for duplicate IDs does not recognize that ServiceOrder.Retrieve(this.ID).UUID and this.UUID are the same, I mean that it is not a duplicate but the exact same instance.
Can anyone suggest how to interrupt the save-process without running into this "Instance with the same key already exists" error?
Kind Regards
Pablo