By Ger Cannoll - 1/1/2011
I have a SF maintenance form , and on it, I have a CHildFormDialog called. If I amend the ChildForm twice (i.e. i dont Permanently Save it the first time, nothing is saved the second time either. I was able to replicate something similar on the ChildDialogueFormSample that comes standard with SF. Following sequence replicates whats happening. (using the ChildDialogueFormSample)
1. Run up the App and Highlight Akers , Kim (About half way down the List) and click View CustomerNotes
2. Highlight the second line (Order # 18 Shipped) and click Edit
3. Add 'AAA' after the word Shipped in the Subject Field, and Click Save. It will return to the Parent screen and shows: Order #18 Shipped AAA
4. Hightlight the secondline again (Order # 18 Shipped AAA) , click Edit and add 'BBB' to the end
5. This time..... Hit the Cancel button. It returns to the Parent Screen and the second line says: Order # 18 Shipped AAA
6. Now Click the Save button on the Parent screen to 'Save' the data to the database
If you now bring back the details, Order # 18 Shipped has not been amended with the AAA
Having looked at the Code, there is a CustomerNotes.Undo as part of the Cancel button, whcih I assume Undos the full Editing and reverts back to before 'ANY' editing AT all has been done . (The List does not seem to be refreshed ,whereas in my live example it is, as I am using a grid)
I find this a bit confusing and misleading and also you might not want to revert back to the Database status, if you have done a few edits.
Is my interpreation above correct as to whats happening, and is there a way to Undo just the most recent changes ??
i.e. Ideally , if in the ChildForm and I have saved, but not saved back to the database (from the Parent Form). If I have another go , using the childform and hit cancel, I would like to revert back to the most recent save on the ChildForm
|
By Ger Cannoll - 1/6/2011
Anybody any ideas on this ?
|
By Ivan George Borges - 1/7/2011
Hi Gerard.
I think you are in total control of how you wish this would behave. I agree the Save button on the Customer Note Editor might not be the best text option, maybe a "Back" or "OK" would make more sense. If you have a look at the source code for this button, you will find an explanation about the actions it takes, which states "We are not going to save until we get all the way back to the parent form".
|
By Ger Cannoll - 1/7/2011
Hi Ivan. Thanks for replying
Yes, I realise that the save is actually done from the Parent Form, but if you are looking on the parent form at the data just before it is saved, when it does actually save, what is saved is NOT whats on the parent form (If you follow my sequence exactly)
|
By Ivan George Borges - 1/7/2011
Yeah, that is right. But this is apparently just a design mistake, since this is a sample trying to demonstrate basic functions for a Parent / Child situation. When you hit Cancel on the CustomerNoteEditor, you should probably make sure to requery the listview on the CustomerNotesItems and so on. This way the user would see the original contents from the BO since the last save, which is what you get when you issue an Undo on the BO.
|
By Ger Cannoll - 1/7/2011
Ok Ivan, I thought it might be something like that.
Jut to get back to the original query:
Say I amend a BO, fine thats reflected on the form, Say CHANGE A FIELD From A to B (Have not saved back to the database yet))
I then have a second bite at it, and I change from B to C, so my BO now has C, but I want to UNDO just the C bit, so that it reverts back to B.
Is there a way to accomplish this (Maybe by saving BO state...I seem to remember there was a way to do this but not sure if this is right way or not)
|
By Edhy Rijo - 1/7/2011
Gerard O Carroll (1/7/2011) ...Say I amend a BO, fine thats reflected on the form, Say CHANGE A FIELD From A to B (Have not saved back to the database yet)) I then have a second bite at it, and I change from B to C, so my BO now has C, but I want to UNDO just the C bit, so that it reverts back to B. Is there a way to accomplish this (Maybe by saving BO state...I seem to remember there was a way to do this but not sure if this is right way or not)
Hi Gerard,
Yes you can accomplish that using the BO.SaveCurrentDataTableToSnapshot(MyKeyValue) and BO.RestoreCurrentDataTableSnapshotMethods(MyKeyValue). Take a look at the SF help file topic "Saving Snapshots of a Business Object's State" where it will give you an example on how to do what you want in this case.
|
By Ger Cannoll - 1/8/2011
Hi Edhy, Thanks for replying.
I knew there was something there but could not just remember how to do it.
|
|