Adding SharePoint ID into subject line of Email sent my Infopath Form - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Adding SharePoint ID into subject line of Email sent my Infopath Form

Last post 01-20-2022 11:02 AM by Hilary Stoupa. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 01-19-2022 11:59 AM

    Adding SharePoint ID into subject line of Email sent my Infopath Form

    Sorry this might be a little confusing. Basically I have an infopath form that sends an email when the submit button is pressed. I would like to know if it is possible to somehow pull the ID field from the SharePoint library that holds the submitted forms and add it to the email subject. The closest i have been able to get is pulling just the first available ID, but i need it to be the one that corresponds to the form that was submitted. Below is what i used to get the training ID pulled in, but not the right one. concat("Training Request ID ", ID, " has been submitted: ", Course_Name)
  • 01-19-2022 04:00 PM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    So - you would need to first submit the form, then query for the data for this form, then you would have the ID. When you set up a library data connection to query data in a form, you have the option to query for data "for this form only" but I suspect that only works when the form is being opened from the library. Might be worth experimenting with. Otherwise, you could add some unique value to the form (userName function + now function should do the trick) and promote that column to the library. Then, after you submit the form, set the query field in a data connection to the library to that unique ID and query the library - you should get back just the form you've now submitted - and can then use the ID in the email. Hopefully that makes sense?
    Hilary Stoupa

  • 01-20-2022 06:17 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    Yeah it is interesting. I tried two things after the form submits 1. First submit to SP, then send email pulling the "ID" field from the SP into the email subject but its either blank or only pulls in the first ID number listed (not tied to the specific form) 2. set a rule to run after form is submitted to fill in a field on the form with the "ID" based off the SP library. Then send the email and reference that new field in the email subject. but this is always coming up blank. I also tried the 2 scenerios above with a filter to only show if the name on the form and SP matched but that always came back blank I will tinker with it some more today because i feel like it shouldnt be this difficult.
  • 01-20-2022 07:43 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    Feel free to attach a copy of your form under the options tab in a reply if you'd like me to take a look. :)
    Hilary Stoupa

  • 01-20-2022 07:53 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    unfortunately i got a slap on the wrist when i did that last time. Wish i could.
  • 01-20-2022 08:32 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    not sure how helpful this is, but i took some screenshots of the rules im using. When i run the attached rule its blank. If i take off the filter i just get the first ID number in the list.
  • 01-20-2022 08:51 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    When do you query for the data?
    Hilary Stoupa

  • 01-20-2022 08:57 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    its part of the rules when the submit button is clicked.
  • 01-20-2022 09:33 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    You need to requery the data connection. If your data connection to get the library items runs on load, the data you just submitted won't be in it - you need to query the library again after submitting to get back the just-submitted item.
    Hilary Stoupa

  • 01-20-2022 10:25 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    Would i do that by added another rule? I added two to refresh different connections and it seems i am getting the same results. Had a thought, would it be easier to create a unique identifier another way, store that in the form and use that as the ID in my email?
  • 01-20-2022 10:28 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    You need to just requery the data connection where you are getting the new ID from. So - I am not sure which data connections you are requerying, but it needs to be the one to the library you just submitted to. Drag the data fields onto your form so you can see if the new item that you just submitted is there.
    Hilary Stoupa

  • 01-20-2022 10:42 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    ok i just pulled the data connection into the form and i do see all of the ID populate and when i submit the form the new one shows. But it still is only pulling the first one or a blank when is the filter with course name. I switched the data connection to "include data for the active form only" and that stayed blank no matter what. also thank you so much you have been so incredibly helpful
  • 01-20-2022 10:49 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    So - if the data row is showing, that means the issue is with the rule with the filter. You might try setting that data connection to sort by ID descending (you can do this when you walk through the data connection wizard) and then unless this is a super high-traffic form, the first item returned would always be the most recent form ID - then you wouldn't need a filter. In your earlier screenshot, I'm a little confused by your filter - you want to get the ID in your secondary data connection where the course name in that secondary data connection is equal to the course name in your form's main data source. Hopefully Course Name is unique?
    Hilary Stoupa

  • 01-20-2022 10:51 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    scratch that it work! you are absolutely amazing. I cant thank you enough.
  • 01-20-2022 11:02 AM In reply to

    Re: Adding SharePoint ID into subject line of Email sent my Infopath Form

    Wonderful - glad you got it working!
    Hilary Stoupa

Page 1 of 1 (15 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.