Forms Script: Send Instant Message
Sorry about the hiatus here. It's been a while.
Here's a little piece of script code for Groove Forms, which might be useful to a few people. It's also small enough to be a nice illustration of some of how script and forms work together.
The application itself is small enough to be nearly trivial: make a form with a button on it which sends an instant message to someone. So, let's start with a new forms tool; create a contact field called "Contact", and a multi-line text field called "Message", and a script button called "Send". In the designer, it looks like this:

In the fields list, double-click the "Send" button-field to modify its properties; under "OnClick", enter a line of script code which calls a function we'll write in a second:
And save. Then, "Create new script", and paste in this script code.
function SendIM()
{
// Find the contact
var pContact = GetContactFieldValue("Contact");
if(!pContact)
{
GetApp().DisplayError("Please specify a contact.");
return;
}
if(!pContact.IsGroovey)
{
GetApp().DisplayError("Please specify a Groove contact.");
return;
}
var enumContacts = CreateBSTREnumFromArray([pContact.ContactURL]);
// Get the message text
var sMessage = GetHTMLFieldValue("Message");
// Send message
GetApp().SendInstantMessage(enumContacts,sMessage);
}
Save. Create a view. Publish sandbox. New -> Form, and test it out. Everything should work: you can pick a contact in the contact field, write a message, and send the message to that contact.
Now let's look at how this all fits together.