I am trying to attach a infopath xml file as an attachment in Send Notification Action.
Workflow got suspended and it ends with attachment URL is invalid/...
Any pointers on how to resolve this...
I think the error is related to the URL of the file..
as you can see in your example. you are calling the formserver.aspx page that renders the infopath path specified in the query string parameter, if you want to send the infopath file (the .xml) you have to specify an URL directly to that file (probably with a querystring parameter NoRedirect=True)
In that way, the recipient will receive the xml file and he has to open it with InfoPath client (to look at it, hoping that dataconnections doesn't broke because the form is outside of his original location), otherwise if you want that the recipient could look to SharePoint page who renders the form, couldn't you share with him just the link to the formserver.aspx page?
I found this post because I was looking for instructions on how to include (in the send notification) the attachments within the InfoPath form (not the InfoPath form itself). I had a difficult time finding anything helpful until I figured out a way to do it, so I will add those instructions here in case someone else has the same issue.
After looking at complex options using C# Event Receivers, Powershell and parsing the XML, I found an easier way.
I used the "Copy to SharePoint" action to save the InfoPath attachments to a new document library and stored the URL of the attachment for later use in the Send Notification step. Here are the details.
In the Copy to SharePoint step, specify your new document library as the Destination,
Specify to "Copy embedded attachments" using the XPath that matches your InfoPath fields,
Specify Overwrite options of "Remove existing item" (if you try "Update existing item" then it may skip the "Store result in" step that you need to provide the URL for later).
Specify "Store result in" a text workflow variable that you create.
Commit Pending Changes.
In the Send Notification action, select "Add attachment" and specify the workflow variable that contains the URL to the item in the new document library.
Maybe some of you have already done this but I had trouble with it so maybe this will be useful to someone. I kept hearing of ways to attach the whole InfoPath form, not the file attachments within the form.