So we have been looking through the help file and seem to have a custom WebAccess button in place. We would like this button to launch a web browser and go to a Form and pass a variable.
Here is the code in our file:
namespace WebAccessCustomActions
{
public class CustomActions
{
public static IDictionary<string, object> PerformAction(string actionID, IDictionary<string, object> args)
{
switch (actionID)
{
case "OpenForms":
return OpenForms(args);
default:
return SampleAction(args); // placeholder action
}
}
private static IDictionary<string, object> SampleAction(IDictionary<string, object> args)
{
WARepository repo = ConnectionManager.GetLoggedInRepositoryHelper(null);
string message = String.Format("You are currently logged into {0} as {1}.\nYou have provided the following arguments:\n",
repo.Name, repo.Session.UserName);
foreach (KeyValuePair<string, object> pair in args)
{
message += String.Format("\n{0}:{1}", pair.Key, pair.Value.ToString());
}
IDictionary<string, object> returnValue = new Dictionary<string, object>();
returnValue.Add("message", message);
return returnValue;
}
private static IDictionary<string, object> OpenForms(IDictionary<string, object> args)
{
WARepository repo = ConnectionManager.GetLoggedInRepositoryHelper(null);
int id = int.Parse(args["id"].ToString());
EntryInfo entryInfo = Entry.GetEntryInfo(id, repo.Session);
// retrieve the field values
FieldValueCollection currentFieldData = entryInfo.GetFieldValues();
string Fieldvalue = currentFieldData["Benefit Application Award ID"].ToString();
System.Diagnostics.Process.Start("http://mdvaecm/Forms/VATS-Invoice?invawardid=" + Fieldvalue);
return null;
}
}
}
This code seems to work but it does not launch our browser from the client machine. It seems to launch a browser on the server and run it as the service account.
Anyone know how we can get our button to launch a browser on the workstation the button was clicked from?
Thanks,
Chris