Metastorm open form at stage without menu bar on IE from an email that does not allow JavaScript
Ok, so this is follow up to a previous post on opening a Metastorm 9.x form from a link in an email. The issue is that when you open the form with a direct link the IE tool bar shows up and the form tends to be pushed to the side and overall does not look good. I have found about ten ways not to do this but this is one that seemed to work. The issue is that most exchange servers will not let live JavaScript come through because it is a pretty big security risk (you could easily right emails that download viruses if they did.)
The basic strategy is to point the email link to a simple web app that you create and bounce/redirect that to the Metastorm form. In the custom web app you can pull the required information about the form and as long as the web app is in the companies trusted zone JavaScript is usually enabled. This is a very simple example that will work as long as you are opening the form at a folder, not an action, however, the app could be extended to enable this functionality.
In the email you send the following non-JS link:
http://<yourcustomapp>/default.aspx?&FolderID=0900000000000000000000000000697
Now in your custom app, pull the folder ID off the query string and run the JavaScirpt that you couldn’t in the email.
Default.aspx Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MetastormRedirect._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function happycode() {
window.open('<% Response.Write(GetURL()); %>','_blank','height=700,width=900,status=yes,toolbar=no,menubar=no,location=no')
}
</script>
</head>
<body>
<div>
<script>
//call after page loaded
window.onload = happycode;
</script>
</div>
</form>
</body>
</html>
Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
namespace MetastormRedirect
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string GetURL()
{
string script = string.Empty;
string FormURL = string.Empty;
string BaseURL = ConfigurationManager.AppSettings["BaseURL"].ToString();
if (BaseURL.Length == 0) BaseURL = "://<MetaServer>/Metastorm/eFolder.aspx?";
if (this.Page.Request.QueryString["FolderID"] != null)
{
FormURL = BaseURL + "&FolderID=" + this.Page.Request.QueryString["FolderID"].ToString();
}
FormURL += "&Service=Metastorm BPM Server&Client=External";
return "http" + FormURL;
}
}
}
This a little bit of a hack because it leaves the blank page open in the background, however, depending on your group policies you could close it after the redirect takes place.
Comments
Post a Comment