Set a Field correctly after Submitting - InfoPath Dev
in

InfoPath Dev

Set a Field correctly after Submitting

Last post 10-04-2007 05:17 AM by adamrharding. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-10-2007 06:20 AM

    • Navid
    • Top 200 Contributor
    • Joined on 12-23-2006
    • Posts 54

    Set a Field correctly after Submitting

    Hi .
    I want to Set a field (a flag) correctly after submitting successfully a form as email !
    but the flag remain unchanged when I put the set flag action after submitting action .
    if i put the set flag action before submitting, it has a bug :
    The operator may want to click "Cancel" in mail dialog box. So the form hasn't been submitted and the flag should remain unchanged, but unfortunetlly it has changed !!
    S.N.R
  • 02-10-2007 01:49 PM In reply to

    Re: Set a Field correctly after Submitting

    Hi Navid,
    I'm sorry, but I don't understand what you are trying to do. What does the flag control? Is the flag in the main data source? Does the form have code behind it? ?How are you doing the submit? Is this from the main submit data connection or are you using custom rules? Please explain. Thanks!
    Patrick Halstead
    Project Manager at Qdabra
  • 02-12-2007 12:10 AM In reply to

    • Navid
    • Top 200 Contributor
    • Joined on 12-23-2006
    • Posts 54

    Re: Set a Field correctly after Submitting

    Look Patrick :
    The flag is a simple boolean field and it's in the main data source. The form is simple and doesn't have any code behind. The form has a button that Submits as an email message using Rules and sets the flag ...
    You Know that when the user click on the submit button (Email) there's a dialog box that show the reciever name and attachment and etc .
    I Want if the user click OK , so the flag changes to TRUE. ( it shows that the form has been mailed and other advantages ... )
    but if the user click Cancel, ( for example it mean he want to modify the form more ! )
    the flag shouldn't change.
    -------------------------------
    Now in the Rules , if I put the submit action before set field action , that field (flag) never changes !! because always form has been mailed sooner !
    but if I put the submit action after set field action , it has a little bug. It is that if user click the button, now the flag has been changed to TRUE, but if the user in the mail dialog,click cancel , the form hasn't been changed but the flag has changed to True !!!!
    S.N.R
  • 02-12-2007 12:15 AM In reply to

    Re: Set a Field correctly after Submitting

    Hey Navid,

    What's with the "Look Patrick" stuff? Your first post was ambiguous and you should just give me a break. I'm doing this for free you know ... :(

    Due to security requirements, InfoPath doesn't allow you to change field values during the e-mail submit between the dialog that InfoPath pops up and the actual submit. If you write code, I think you might be able to get the return value from an e-mail adapter to see if the e-mail was indeed sent, and then you could set your flag field before submitting to another data source.

    Later!
    Patrick Halstead
    Project Manager at Qdabra
  • 02-12-2007 03:48 AM In reply to

    • Navid
    • Top 200 Contributor
    • Joined on 12-23-2006
    • Posts 54

    Re: Set a Field correctly after Submitting

    Thanks a lot !
    I'm Sorry Patrick !! I didn't mean anything with that sentence. My English isn't good and I apologize & I'm sorry again ... :(:(

    u mean that with coding I can recognize If the mail has been sent or not and I can set fields after that ???
    Would u do me a faver & say what is that code look like?
    IS there any refrence that learn me coding ?
    S.N.R
  • 10-04-2007 05:17 AM In reply to

    Re: Set a Field correctly after Submitting

    Hi again

    so the steps you want to take are

    1) User presses submit button

    2) Some rules run to email form, then...

    3) Set flag

    One note of caution, if you are sending the form on then setting the flag then you will not be able to submit the form as the "row cannot be located for updating" (for more info search for my post in the database integration forum).  You state in your first post that if you put the set flag after the form has been sent it does not appear in the sent form.  This is becuase at the time of sending, the form exists in two places, the form you have open with the flag set, and the sent form without the flag set.  It will obviously fail if put before the submit as they can cancel.  Without writing some heavy-duty code you can use a workaround I have utilised below.

    For example, using an AD Web Service that lets the form know who you are (Or if you are using Infopath 2007).  Have your workflow field go from NULL to 'a' for with authoriser to 'A' openend by authoriser and so on.  So the flag is set to 'a' before the email is sent.  If they click cancel all they are left with is a form they cannot submit any further and it ends there.  If they click send the form goes via email to the authoriser and the local form closes.  Now set a rule on the form such that is your flag is equal to 'a' and the authoriser is equal to the authoriser specified on the form then open the authorisers view, otherwise open a FAILURE view.  This would solve your problem without code.

    Any further questions feel free to ask, otherwise I hope this helps.

    Adam

    Adam Harding
    Wales
    UK
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.