SDU
Personal tools

How to Script Buttons

From SDU

Jump to: navigation, search
To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

Service Desk buttons are created using a ImgBtnCreate function.

ImgBtnCreate(btnID, btnCaption, func, btnEnabled, btnWidth, help, tabIndex)


Attribute Description Examples
btnID Used for referencing the button. This is typically a label used for easy identification of the button in scripts.
ImgBtnCreate("btn001", ...
ImgBtnCreate("btnchg", ...
ImgBtnCreate("mybtn", ...
btnCaption The text to be displayed on the button. Either identify the string such as "My Button" or reference a msgtext() value. The msgtext() value is obtained from the msg_cat.js file.
ImgBtnCreate(..., "I am a button"...
ImgBtnCreate(..., msgtext(514), ...
func The script to be initiated when the button is selection
ImgBtnCreate(..., ..., "detailSave('NEW_CHANGE')", ...
ImgBtnCreate(..., ..., "myscript()", ...
btnEnabled If true then the button is Active. If false then it is not.
ImgBtnCreate(..., ..., ..., true, ...
ImgBtnCreate(..., ..., ..., false, ...
btnWidth Button width in pixels. 0 defaults to the size of the text.
ImgBtnCreate(..., ..., ..., ..., 0, ...
ImgBtnCreate(..., ..., ..., ..., 220, ...
help Displays information in status bar of the browser window. This is typically the bottom left-hand corner of your.
ImgBtnCreate(..., ..., ..., ..., ..., "Click here to open a ticket", ...
tabIndex

More Examples

Open a Service Desk htmpl file in a new window

ImgBtnCreate("btn001", "Custom Form", "popup_window('','ztest.htmpl'))", true, 0, "Select this button to view a Service Desk htmpl in a new window");

Open a Service Desk htmpl file in an existing window

ImgBtnCreate("btn001", "Existing Window", "upd_frame('ztest.htmpl')", true, 0, "Select this button to use the existing window");

Open a new window referencing an external URL

ImgBtnCreate("btn001", "SDU", "popupWithURL('http://www.servicedeskusers.com', 1, 1, '')", true, 0, "User Community for CA/Unicenter Service Desk");

Open a new email message referencing the ticket

ImgBtnCreate("btn001", "Send eMail", "window.open('mailto:?subject=Regarding $args.type.sym $args.ref_num&body=Click on the following URL to view $args.type.sym $args.ref_num: $args.web_url')", true, 0);

Launch an application

function ExecuteMyApp() {
var myshell = new ActiveXObject( "WScript.shell" );
myshell.run( 'enter application command line here', 1, true );
}
ImgBtnCreate("btn001", "My Application", "ExecuteMyApp()", true, 0, "Click this button to launch My Application");
This page was last modified 05:25, 30 November 2010.  This page has been accessed 3,659 times.  Content is available under Attribution-Noncommercial-Share Alike 3.0 UnportedDisclaimers