Tips and Tricks – III

May 7, 2010

Yet more Tips and Tricks….

  • To display the Owner lookup dialog, with a default item selected, use:
strSecCodeID = Application.BasicFunctions._
    LookupOwner(strDefaultSecCodeID)
  • To display the Select User dialog, use:
objUser = Application.BasicFunctions.LookupUser
strUserID = objUser.ID
strDisplayName = objUser.DisplayName

To have a default User selected in the lookup, use LookupUserEx instead

  • To have the user select an application to open an attachment with, use OpenAttachmentWith
  • SLX has a number of registry-related functions: RegSetValue, RegGetValue, RegDeleteValue all relate to HKEY_CURRENT_USER\Software\SalesLogix\UserValues and, unlike the WScript.Shell class, can only read/write String data types
  • To edit Activities, use Application.BasicFunctions.ShowActivity or ShowActivityNotePad[Ex]; use ShowHistory to edit History records. Also Application.Activities.GetActivityList and GetActivityByID
  • Processes: Use StartContactProcess to start a Contact Process against the specified ContactID, OpportunityID, or GroupID
  • To open a URL in the default browser, use WebOpen
  • You can store any data type in a SalesLogix global variable … include objects like recordsets
  • To access picklists and their items without using SQL, use (via Stephen Redmond’s DevLogix):
Set pl = Application.PickLists(strMyPickListName)
For i = 0 to pl.Count - 1
    strText(i) = pl.Item(i).Text
Next
    Also note the ItemByText and ItemByShortText methods.

  • Main Views have GroupsPane collections:
For i = 0 To MyMainView.GroupsPane.Selection.Count - 1
    strGroupID(i) = MyMainView.GroupsPane.Selection.item(i)
Next
    They also have similar Tabs collections, and a PopupMenu property which returns a PopupMenuX class object:
mv.PopupMenu.Items(0).Click
  • To set the current group: Application.BasicFunctions.SetCurrentClientGroup strGroupName
  • Application.Translator.StrToInt converts strings to integers, even if the strings are using comma characters as the decimal-separator rather than the thousands-separator (the function always uses the thousands separator specified in the Regional settings for the current Windows user.)
  • Form.Script.C_CheckDates would execute subroutine ‘C_CheckDates’ defined under the form Script tab
  • Microsoft Script Debugger is here
  • You can use the fx_rowaccess() “stored procedure” in a normal SQL statement:
SELECT account, type, division, employees, credithold,
creditamount, fx_rowaccess() from ACCOUNT