If you search the Microsoft web looking for "Groove 2007 Tool Template", you will find six or seven Forms Tool templates to download. Each of these templates includes a library of JavaScript functions called common.js. If you've not downloaded them, it is worth downloading all of them. I'm going to cusomise the Proposal Tracker, so get that one at least.
Amongst the functions in common.js are a function called IsManager,which returns true if the current user is a manager of the space, and a pair of functions, EnableField and DisableField. We can use these functions inside the Groove Forms tool to implment role-based security.
Groove Forms offers a series of events where you can hook in code to customise the form to fit your business needs. Every Form within a Forms Tool has a script file named "System callouts scripts for
In this example I'm going to cusomise the Proposal Tracking tool to allow only Managers to assign a monetary value to the Opportunity.
- Add the Proposal Tracking tool to a space, and choose to modify the Opportunity form.
- Click the Form Scripts tab. If you don't see it, click the "Show Advanced Design Features" button.
- Identify the systems callouts script file and open it. You'll see a drop down to pick whereabouts you want to hook into the Forms tool. Select OnAfterInitialize.
- The code in the OnAfterInitialize function (a call to function BidManagerForm_OnAfterInitialize ) will be shown. This code runs once a forms tool has
- Close the system callouts window, select the Opportunity.js script file and choose Modify.
- Press Ctrl-F to launch the Find dialog and type OnAfterInitialize(). Press Find Next and you'll be taken to the code that runs after the form has been initialized.
- Inside the try { block, add the following:
if (IsManager()) {
EnableField(cOpportunityValueNumber_Field );
}
else {
DisableField(cOpportunityValueNumber_Field );
}
This block of code checks to see if the current user is a manager. If they are, it enables the Opportunity Value number field. Else it disables it. We get the name of the field from the top of the opportunuty.js file where all the field names are defined.
Close the forms tool and try to edit the monetary value field. If you are a manager you can.