Thursday, January 5, 2012

Hide 'Submitted By' in InfoPath Browser Form

If you have had to deal with browser forms a lot, you may have run across the ability to send an email with the active view (aka page you are last looking at) as the body of an email to someone. The annoying thing is: it always adds 'Submitted by: BLAH' at the top of the email. I found a way to hide it IF you are sending the email to a recipient that processes <style> elements located in the <head> of the html in an email like Microsoft Exchange aka Outlook or Hotmail (GMail is one of the few that do not). DISCLAIMER: this just hides it and it only hides it ON THE FIRST EMAIL, it doesn't actually remove it from the email so someone *could* go find whoever submitted it if they wanted or see it if their computer is set to NOT process html emails. This also means that when they hit 'reply' or 'forward' it will appear (at least I haven't figured out a workaround for that yet). I have not tested it in a 2007 browser form or using InfoPath 2007 but the theory should work the same.

Steps for InfoPath 2010:
  1. Publish like normal and run your form to send you an email
  2. Open the email and view its source (in Outlook, you have to double-click and open the actual email and THEN you can right-click and then click 'View Source')
  3. Scroll to the bottom and you will see something like this:

    <div style="word-wrap:break-word;color:windowtext;background:window;font-size:10.0pt;font-family:Tahoma" class="GOBBLEDEEGOOK">[Submitted by USERNAME@DOMAIN.COM] <br><hr></div>

  4. Note the 'class=' there...grab your GOBBLEDEEGOOK and copy it (without the quotations)
  5. Go back to your infopath form and publish as source files into a folder on your desktop
  6. Close InfoPath
  7. Open up the folder on your desktop and right-click on the InfoPath view that you are emailing (it will be the name of your view.xsl) in notepad or, preferably, in notepad++
  8. Add the following directly before the "</head>":

    <style>.GOBBLEDEEGOOK{DISPLAY:none !important;VISIBILITY:hidden !important}</style>

    (Just be sure you replace GOBBLEDEEGOOK with whatever your GOBBLEDEEGOOK was). Mine looked like this:
    <style>.D38B7128-85A9-4481-A264-D05E46BC1B50{ DISPLAY:none !important; VISIBILITY:hidden !important;}</style>

  9. Close notepad/notepad++
  10. Go back into the folder on your desktop and right-click on manifest.xsf and click 'Design'
  11. Publish your form like normal
  12. Run a test to see if it hides that dumb 'submitted by' on that particular view/email.

12 comments:

  1. Great post. When the email is forwarded or replied, the 'submitted by anonymous user' message re-appears. Is there a way to control that as well?

    ReplyDelete
    Replies
    1. Apparently no; what this does is set it so that the CSS class for that little thing becomes hidden...which relies on your email manager (aka Outlook for many) to see that CSS and properly render it. When you reply or forward the message, it appears that much of that type of stuff gets either converted to text or re-rendered so that you can't get it to stick. I'll keep playing around with it and see if I can figure it out but I've moved to a position where InfoPath is rarely used so it's harder to test.

      Delete
  2. This has been bugging me for a long time. I think you are the first person to come up with a solution for this. THANK YOU!!

    ReplyDelete
  3. Thank you so much i have been lookin for this fix since a month now...
    But there is an issue still..now when i hit the submit button though the message does not contain a submitted by. the pop up you get when you recieve an email from someone (u know the small box on the right hand bottom corner of ur screen?) that shows the submitted by. but its not there in the message..how can i fix that?

    ReplyDelete
    Replies
    1. I don't think that little box respects CSS so it's just showing the first few lines of actual text in the email (which always happens to be the 'submitted by' piece). Similar to above, I don't think you can do anything with that but let me know if you stumble across something that removes the content entirely before sending the email (as that is the only fool-proof way to keep this stuff from happening).

      Delete
    2. Hey Brendan, is it possible to move the "Submitted by" down to the bottom of the page (even though we're hiding it), so that it doesn't show up in preview boxes?

      I noticed this happens on an iPad where you can choose to show the first few lines of text.

      Delete
    3. Matthew, since this is just CSS (changing the appearance of something), we can't really move the line (which would require scripting or code). :(

      Delete
  4. does this solution works for other users, or it works only to a specific users to where the settings and configuration was made?.

    ReplyDelete
  5. Excellent post. Many thanks. It works for me using InfoPath 2007 but like others who have posted, I can still see the 'Sunmitted By' text on the email notification pop up box. Ho Hum.

    ReplyDelete
  6. This has helped fix a huge issue here at work...thank you so much!

    ReplyDelete
  7. Hey Brendan,

    I'm still struggling with the problem above in SharePoint 2010 and Infopath. I need to really remove the "Submitted by" tag from the Infopath Email. Is there any way to do that? Doesn't care if it's unsupported. This Tag has to to be somewhere in SharePoint layouts or in the Content-DB

    Thank You

    Thomas

    ReplyDelete
    Replies
    1. Hey, it is probably in an asp page somewhere; however, I have never found it and it definitely went beyond the scope of my projects to truly eliminate it because that would've been squarely in the development realm. Wish I had a better response :(

      Delete