1

I have a database that (through an agent) creates 5 copies of a document and stores them with a new form name (So the original form name is "MasterProfile" and the agent makes 5 copies of the document and names them UserProfile - Using XXXX.Form = "UserProfile"). That works perfectly, when I look at the forms/documents within Ytria everything looks good there are 5 documents under the Form "UserProfile"

Now within the UserProfile documents there is a Hotspot that takes the document responses from the user and saves the form using

@If(@Command([FileSave]);@Command([FileCloseWindow]);"")

The problem I am having is that when that @Command[FileSave] runs it saves the document back to the original name "MasterProfile". I have tried setting the Form Field to the correct name

FIELD Form := "UserProfile";

but that doesn't do anything.

Does anyone have any clue what I could be missing? Why isn't the copied documents staying as UserProfile rather than converting back to MasterProfile?

Thank you for your help!

Louie
  • 25
  • 8

2 Answers2

4

Before jumping to the solution, I think it is important to address your question about what is causing the problem. There are several possible causes:

1) You do not have a form called "UserProfile" in the database design, and the "MasterProfile" form is the default form in the database. If that's the case, then every time you open the document in the Notes UI you are loading the MasterProfile form as the default. So when you save the document, the value in the Form field is going to change to the loaded form name, which is "MasterProfile".

2) You do have a "UserProfile" form in the database, but it has an alias that is set to "MasterProfile". When you save a document in the Notes UI, the Form item will actually be set from the alias name of the form, not the primary name, so this would cause the Form field to change to "MasterProfile".

3) You do have a "UserProfile" form in the database, but you have a computed field called "Form" on the form, and the formula for that field is actually "MasterProfile". When you save a document in the Notes UI, the computed value of the Form field will override the name and alias of the loaded form, so this would cause the Form field to change to "MasterProfile".

4) Your application is using a rarely-used feature of Notes called a "Form Formula". I.e., the design of the view that you are opening the documents from has a Form Formula whose value is "MasterProfile". A Form formula in a view causes the UI to use the formula result to override the Form field that is stored in the document. A nasty side-effect of using Form Formulas is that when you save the document, the value in the Form field is going to be canged to the overridden name, which is "MasterProfile".

There are actually several other possibilities, but I think they are less likely than any of the above.

The solution to #1 is to create a subform called "ProfileSubform" and copy the entire contents (fields and event scripts) of the "MasterProfile" for to it. Then wipe the MasterProfile form completely clean and insert the new subform into it. Then create a "UserProfile" form and insert the MasterProfile form into that, too. (Ken Pepisa's suggestions are also good, however the virtue of what I am suggesting is that you can do it without making any other changes to your application.)

The solution to #2 is to get rid of or correct the alias of the "UserProfile" form.

The solution to #3 is to get rid of or correct the Form field on the "UserProfile" form.

The solution to #4 is more problematic. If you can get rid of the Form formula in the view, then do it... but it might be there for a reason. You may have to make it smarter, and/or you may have to go with one of Ken's suggestions.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
1

You should set another field instead of using the form field. The form field will always be set by Notes when the document is saved in the UI.

For example, you could make a DocType field and set it to MainProfile or UserProfile. Then in any appropriate Notes views you could add that DocType column in place of the Form column you are displaying. I'm not sure how Ytria works but hopefully you can view by another field besides the form field.

If you absolutely need to use the Form field for this purpose, you could try updating the Form field via the PostSave event, but I'm not sure if that's possible.

Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
  • Thanks Ken, with the time frame that the customer gave me I found that the easiest thing to do was just use another field like you suggested. – Louie Jun 17 '12 at 04:42