When a new customer fills out the fields on a new document and clicks on the “save and send” request button…the document is saved in the database and a memo is sent to a developer user with a link to the database.
As soon as the user hits the “save and send” button, I would like a status to change on the form to “Form submitted”.
When the developer user clicks on the link, another form is displayed where he/she is required to fill out additional information on the request made from the customer. Once the developer has finished filling out that form and accepts the request, I would like to update the status again to “Request Approved” and so on and so forth…
On each of these forms, i have inserted a field to display the current status…
The only thing is, I am new to this so I dont really know how I would go about creating something that will update a status each time a user completes a form and clicks on a specific action button on that form.
Ive tried looking on the internet…but not really seen any examples that i think would be useful to me…
If anyone can show me some tutorials, or offer any help I would grately appreciate it.
You could use computed sub-forms and them them displayed when Status = “Form Submitted”. The Developer can then fill out their information and when they save it will update the Status to “Request Approved” so the Customer can see the status.
This can also be done in a Controlled Access sections. This way the Customer can/can not see or edit that area depending on what you decide.
The approach I typically use is having a computed field (usually named ‘Status’) on the form. Since it is a computed field you will have to give it a formula.
@If(@IsNewDoc=1; “Composing”; Status)
After that - on the action events (button clicks) include the appropriate @SetField commands prior to any Save commands.
I have created a field for the status and so far have got it to say “Composing”. When I insert the @SetField(“Status”; “Form Submitted”) bit to my save commands I keep getting a message saying do i want to save it? If i click no the mail still gets sent to me but when I click on the link the status still says “Composing”…
Below is the following code for how I save my form…
@MailSend(“user/department/company”; “user/department/company”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a request from the following person: " + @UserName;”";[IncludeDoclink]);
@Command([FileSave]);
@Command([FileCloseWindow])
I have tried inserting the @setfield command after the fileSave bit but it doesnt appear to work…can you tell me where Im going wrong please?
@MailSend"user/department/company"; “user/department/company”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a request from the following person: " + @UserName;”";[IncludeDoclink]);
@Command([FileCloseWindow])
You can also create a field on your form (make it hidden) callled SaveOptions
Make this a computed field and default the value to 0 (that is a zero).
This will turn of the option to prompt the user if they want to save everytime they close the form after updates.
You must make sure that any actions / button clicks include a save wherever you really want to save. This is a nice feature that puts the save in the program and not at the mercy of hte user. A smart user can always defeat it with a CTRL - S though.
It sounds as though the SaveOption field is working for you just fine. That is good.
Curious - Are you positive that you have a
@Command([FileSave]) in your button code? Remember - it must occur AFTER any field changes -
@SetField(“Status”; “Form Submitted”);
@Command([FileSave]);
@MailSend"user/department/company"; “user/department/company”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a request from the following person: " + @UserName;”";[IncludeDoclink]);
@Command([FileCloseWindow])
Try this again and let me know if it doesn’t work. You may also want to do a CTRL-S before clicking your button and see if it works differently. The only I can think of right now besdies the @Command([FileSave]) missing is something in the ACL.
HTH
Good luck
Kevin
The behavior you are describing leads me to think that you may have inadvertantly left it out.
Before I made this post, the code i had for my button was…
@MailSend(“name/dept/comp”; “name/dept/comp”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a new project request from the following person: " + @UserName;”";[IncludeDoclink]);
@Command([FileSave]);
@Command([FileCloseWindow])
The i tried your way…
@SetField(“Status”; “Form Submitted”); @Command([FileSave]); @MailSend"user/department/company"; “user/department/company”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a request from the following person: " + @UserName;”";[IncludeDoclink]); @Command([FileCloseWindow])
OK - lets try this. I was assuming your doc was already in edit mode and it may not be. Use this formula:
@Command([EditDocument]; “1”);
@SetField(“Status”; “Form Submitted”);
@Command([FileSave]); @MailSend"user/department/company"; “user/department/company”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a request from the following person: " + @UserName;”";[IncludeDoclink]);
@Command([FileCloseWindow])
What exactly is the error that you are receiving?
Can you give me some of the workflow.
I think you are really close - I am just missing something really simple.
Ive tried that new formula and I am still recieving that same error…
“The linked document cannot be found in the view”…i only get this message when i try clicking on the link in the email…
However, i have noticed that when i take away the value of “0” from the save options field…the link icon works and the information is stored in the database. The only thing is…the status field does not changed from “Composing” to “Form Submitted”…
Any reason as to why?
Thank you for you spending time helping me - i really appreciate it
Sorry for the delay and hope you had a good weekend as well.
If the name of your field is Status, then the code you posted earlier SHOULD be working just fine.
@SetField(“Status”; “Form Submitted”);
@Command([FileSave]);
@MailSend"user/department/company"; “user/department/company”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a request from the following person: " + @UserName;”";[IncludeDoclink]);
@Command([FileCloseWindow])
I am at a loss as to why it would not work.
You can TRY to put ANOTHER @Command([FileSave]) in prior to closing the window.
Also - you don’t have any events in the QueryModeSave that would prohibit saving do you?
If you change the field value AFTER you save the document, the document will have to be saved again for the value to stick.
A better approach to that particular button would be to take advantage of the fact that @Commands return @True when they are successful. You can make sure the document saves before sending the mail, and can reset the Status field if it does not:
oldStatus := Status;
@SetField(“Status”; “Form Submitted”);
@If(@Command([FileSave]);
@Do( @MailSend(“user/department/company”; “user/department/company”; “”; “Request Form”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “Attached is a link with a copy of a request from the following person: " + @UserName;”";[IncludeDoclink]); @Command([FileCloseWindow]));
@SetField(“Status”; oldStatus))
As you be a new bee, I’ll walk you through it. First, the formula throws the existing value of the Status field into a variable for possible later use, then it changes the status. Next, it tries to save the document. If all goes well (all of the data validation checks pass), the code will then send a mail message and close the window. If the save fails, the Status field is reset to its old value.
Thank you for explaining what the fomula does. It has helped me understand what is happening.
I have implemented the formula in my action button. However, when I click on the button, I still get a dialogue box appearing asking if i want to save the changes made. If i click yes or no I still recieve an email. When i click on the link to open the email up, the status is still “Composing”…
Surely this box should not be appearing if the save command is there and the status should change accordingly to “form submitted”…?