First Create a script expression with the code below *obviously you can edit the text of the message box you want to appear.
import System
import Fusion
import Fusion.Api
import System.Reflection
class FusionScriptWrapper implements IScriptWrapper
{
function FusionScriptWrapper()
{
// place constructor logic here
}
function MessageBox(text:System.String, caption:System.String, MessageBoxButtons:System.String, MessageBoxIcon:System.String)
{
try
{
var assembly : System.Reflection.Assembly;
var MessageBox : System.Type;
var Buttons, Icon, result : System.Object
assembly = Assembly.LoadWithPartialName("System.Windows.Forms");
MessageBox = assembly.GetType("System.Windows.Forms.MessageBox");
Buttons = System.Enum.Parse(assembly.GetType("System.Windows.Forms.MessageBoxButtons"), MessageBoxButtons);
Icon = System.Enum.Parse(assembly.GetType("System.Windows.Forms.MessageBoxIcon"), MessageBoxIcon);
var argMSG : System.Object[] = [text,caption,Buttons,Icon];
result = MessageBox.InvokeMember("Show",System.Reflection.BindingFlags.InvokeMethod,null,null,argMSG);
return result.ToString();
}
catch(exc : System.Exception)
{
return null;
}
}
function Process(currentBusinessObject : Fusion.Api.BusinessObject, currentField : Fusion.Api.Field) : Object
{
var objReturn : Object
var userResponse : System.String;
userResponse = MessageBox("Are you sure you want to complete this assignment?","Assignment Completion","YesNo","Question")
if (userResponse=="Yes")
{
objReturn = true
}
else
{
objReturn = false
}
return objReturn
}
}
Then select the properties of the complete button. Select the "Action" tab and select the Guard Tab with in it (shown below)
Add the new expression ( which I called MsgBoxTestPrompt) as the condition. Select the Nothing option in the behaviour drop down.
Now when the user selects the complete button they are prompted if they are sure the want to complete. If they select Yes then the action will fire. If the select No nothing will happen.
The only thing to be careful of is that guards don't prompt in the web (or any prompt for that matter)