Monday, September 21, 2009

Prompting for a Confirmation Yes No Message box when completing an assignment

The combination of script expression and button guard allows you to pop a yes/no box to confirm that an assignment is to be completed

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)

Wednesday, September 09, 2009

A helpful tip for troubleshooting IIS

The extended logs for IIS (stored in ..\Windows\System32\Logfiles\W3SVC1\) are stored in GMT time by default which can make finding your issue a little bit harder. Here's a simple way to change it to your local time.

The W3C Extended Logging format spec requires logging in GMT time. You can set the log roll-over to occur at midnight local time if you want. This avoids problems with situations like Daylight Savings, where you log goes "backwards in time" by an hour.

To enable logfile rollover based on local time, not GMT, open the IIS Manager, locate your website, rightclick and choose "Properties". On the "Web Site" tab, click "Properties" next to logging. Then check "Use local time for filename and rollover"

Saturday, September 05, 2009

Updating fields with a Script Expressions

I've found this line of code invaluable when Quick Actions and Business Rules just won't work for you
currentBusinessObject.GetField("FieldName").SetValue(new Fusion.FusionValue(VariableName));
It writes the variable VariableName to the field FieldName in the current business object. You can also replace VariableName variable with a value of any type (obviously in the format "String")

Thursday, September 03, 2009

ITSM: Quick Action Security in Web

In the 6.x systems you now have the ability to secure quick actions (by security group) this means that you can create a quick action that only some users can A. Run B. Edit C. Delete rather than specifying this for All quick actions.

The issues here is that in 6.2 and 6.1.4 and below the security does not work in the web client.
However, restricting Quick Actions does work in ITSM 6.1.5 since ITSM 6.2 is in older code build than ITSM 6.1.5. ITSM 6.2 and ITSM 6.1.5 codes builds will be merged in ITSM 6.3.

ITSM: The Perils of Hiding Tabs

I discovered this in the web 6.2 today and it reminded me of an issue with tabs in the full client.

In some versions of 5.x there was an issue that disabled all of the tabs from working. The issue comes from making the FIRST tab in the layout of an object hidden or conditionally hidden. This issue is fixed in 6.2 (or 6.1.2 or later) in the Full Client but the issue still exists in the web client.

The error is not too easy to spot in the web client, the first indication is that you can't navigate to any tab other than the first displayed tab. Secondly there is an yellow error next to "Done" in the web browser. The error details are "Unterminated String Constant".

The simple (and only fix) is to make the initial tab in the layout always visible. Either swap it with another Tab or change the Visibility rule.