Solved

Problem with @FileSave

Posted on 2013-05-22
6
331 Views
Last Modified: 2013-12-18
Hi,

I'm trying to write a shared action in a Lotus Notes database. We will use this database for processing of expenses claims. In this case the action submits the expenses claim after first running through some validation checks on  certain fields.
What I want to do is save the document (so that my @Abstract gets calculated and I can count the amount of text in the justification field), apply the validation checks giving the option to Cancel and correct or Continue and then finally (assuming they choose "Continue") I update the status to Submitted and assign a reference number then save again.

Problem is that while the first save works the second one doesn't. If I take the first save out then the second one works fine. I have a vague memory that this is some sort of restriction but I can't remember the details.

Can anyone advise how to get round this or maybe a better way to do what I am trying.

I guess I could make my ' Notes' RTF a plain text field instead but that would mean I couldn't attach any receipts etc.

Thanks Andy

Current code is :

FIELD FullName := "";
FIELD CurrentNum := 0;
FIELD Prefix := "";

@Command([FileSave]);
FIELD saveoptions:="0";

@If(EFL_AmountPP > EFL_MaximumAmount; answer:=@Prompt([YesNo];"Outside Expense policy limits";"The meal cost per person is higher than allowed for in the expenses policy. You can either continue anyway or cancel and review the claim. Continue ??");"");
@If(answer=0; @Return(0); "");

@If(EFL_AdditionalNotesRequired = "Yes" & @Length(EFL_AdditionalNotesAsText) = 0; answer:=@Prompt([YesNo];"Justification Required";"This type of expense claim requires a justification to allow approval. The 'Notes' field appears to be empty. You can either continue anyway or cancel and review the claim. Continue ??");"");
@If(answer=0; @Return(0); "");

@If(@Adjust(EFL_Date;0;3;0;0;0;0) < @Now;  answer:=@Prompt([YesNo];"Historic Expenses Claim !";"The Expenses policy states that claims should be submitted within 3 months of being incurred. You can either continue anyway or cancel and review the claim. Continue ??");"");
@If(answer=0; @Return(0); "");


FIELD FullName := @Name([Canonicalize];@UserName);
FIELD ShortName := @Name([CN];@UserName);

FIELD seq_UNID := @DbLookup("":"NoCache";"":""; "Person_Lookup";FullName;3) ;
@If(
      @Length(seq_UNID)!=32;
      @Prompt([Ok];"Error";"Can't find an entry for you in the Employees view - please notify IT.");
      @Do(
                  @SetField("EFL_Status";"Submitted");
                  FIELD CurrentNum:= @GetDocField(seq_UNID;"ExpenseRef");
                  FIELD Prefix := @GetDocField(seq_UNID;"ExpensePrefix");
                  @SetField("EFL_Reference";Prefix+"-"+@Text(CurrentNum)) ;
                  @SetField("EFL_ExpenseManager"; @GetDocField(seq_UNID;"ExpenseManager"));
                  @SetDocField(seq_UNID; "ExpenseRef";CurrentNum+1)
                  )
      );
@Command([FileSave]);
FIELD saveoptions:="0";
@Command([FileCloseWindow])
0
Comment
Question by:andyhines
  • 3
  • 2
6 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39189525
Is any of the fields an Authors field? If the current author of the document is not in that field the first time the document is saved, he cannot save the document again, not being one of the authors. So the first time he has to be present, the full canonical name, and if you want to prevent updates once saved again, you have to remove the name before the second save. It might be easier just to add another Authors field that you remove right before the 2nd save.
0
 

Author Comment

by:andyhines
ID: 39190314
Hi. I do have an Authors field on the document but the code above doesn't touch it (yet)
It is populated with my full canonical name and the name of an Admin group.

I don't believe this is the fault because if I create a doc, enter a description, save it manually, update the description, save it again and then close it I do see the updated description.

Thanks - Andy
0
 
LVL 4

Accepted Solution

by:
QuinF earned 500 total points
ID: 39190655
Andy,
You perform a File Save, then you set Saveoptions = "0", then you try to save the document again.  It can't perform that save.  You need to set the saveoptions = "1" before your second save.
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:andyhines
ID: 39191750
Ahhhh ... I thought SaveOptions = 0 meant 'Save without prompting'. Guess I'd better read the documentation again. I'll try this in the morning. Thanks - Andy
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39193514
Well spotted!
0
 

Author Closing Comment

by:andyhines
ID: 39193772
Many thanks.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question