Solved

Problem with @FileSave

Posted on 2013-05-22
6
325 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now