Skip to content

Instantly share code, notes, and snippets.

View gsherman's full-sized avatar

Gary Sherman gsherman

View GitHub Profile
. .\CreateClarifyApplicationAndLogin.ps1
$rmaNumber = "000045-1";
$path = "C:\temp\$rmaNumber.doc"
If (Test-Path $path){ remove-item $path -Force; }
$smtpServer="emailServer"
$To="someone@company.com"
$From="someone_else@company.com"
$Subject="Details for RMA $rmaNumber"
var employee_objid = 268435457;
var boReportsEmp = FCSession.CreateGeneric('employee');
var boReportsUser = FCSession.CreateGeneric('user');
boReportsEmp.AppendFilter("emp_supvr2employee", "=", employee_objid);
boReportsUser.TraverseFromParent(boReportsEmp, "employee2user");
boReportsUser.AppendFilter("status","=",1); // This appears to be ignored.
boReportsEmp.Query();
WScript.Echo('Total count of users:' + boReportsUser.TotalCount());
Dim listEmployees As List
Sub Form_Load()
Dim br As New Bulkretrieve
Dim employeeList As List
Dim nameList As New List
Dim i As Integer
Dim recEmplUser As Record
Declare Function GetStartingDateOfLastMonth() as Date
Declare Function GetStartingDateOfThisMonth() as Date
Declare Sub FindCasesCreatedLastMonth()
Sub main()
Call FindCasesCreatedLastMonth
End Sub
Sub FindCasesCreatedLastMonth()
@gsherman
gsherman / Get HGBST list
Created October 27, 2010 17:20
Get an HGBST List (in this case, the CR_DESC list)
SELECT l1.title,
s1.title,e1.title,e1.rank,
s2.title,e2.title,e2.rank,
s3.title,e3.title,e3.rank
FROM
table_hgbst_lst l1,
table_hgbst_show s1,
table_hgbst_show s2,
table_hgbst_show s3,
table_hgbst_elm e1,
@gsherman
gsherman / send_email_about_obj.dat
Created November 17, 2010 22:45
a customized log email template and rule properties that includes dynamic case data by using rule properties. (in this case, the case title)
OBJECT TYPE="com_tmplte", NAME="com_tmplte_268435465"
UNIQUE_FIELDS = "title"
FIELDS
title = "send_email_about_obj";
flags = 144;
action = "
TO: <FOCUS.recipient>, <FOCUS.cc_list>
FR: <FOCUS.sender>
RE: About Case <ADDITIONAL_INFO> : [Case Title] [Subcase Title]
@gsherman
gsherman / CheckExpiringLicenseKeys.js
Created December 6, 2010 18:21
Check for any license keys that are about to expire
/////////////////////////////////////////////////////////////////////////////////////////////
// Check for any license keys that are about to expire
// If found, send an email
// once a reminder is sent - update the license key table so its not sent again in the future
/////////////////////////////////////////////////////////////////////////////////////////////
function rw(foo){WScript.Echo(foo);}
//How far in the future to look for expiring Keys
var numDays = 30;
@gsherman
gsherman / PrevalidationSanitizer.cs
Created January 24, 2011 18:57
an example of an HttpModule that html encodes form data
using System;
using System.Collections.Specialized;
using System.Reflection;
using System.Web;
public class PrevalidationSanitizer : System.Web.IHttpModule
{
private HttpApplication httpApp;
public void Init(HttpApplication httpApp)
@gsherman
gsherman / btn_myopencases_click
Created April 18, 2011 16:46
getting json data from a web service and binding it to a clarify grid using clearbasic
'Make a web service call, and the result will be in JSON format
json = GetMyOpenCases()
'Turn that from a string into an object
Set resultObject = scriptControl.Eval("(" + json + ")")
'Type of records we want to get the results into
recordType = "qry_case_view"
'List of fields in the record - we'll fill *into* these fields, so they must be valid fields for the record type
@gsherman
gsherman / TransposeJavaScriptObjectIntoListOfRecords
Created April 18, 2011 16:49
ClearBasic function to Transpose a JavaScript Object Into a List Of Records
Function TransposeJavaScriptObjectIntoListOfRecords( jsObject As Variant, recordType As String, recordFields As List, jsObjectFields As List) As List
Dim listOfResults As New List
listOfResults.ItemType= "record"
Dim oneResultRecord As Record
Dim index As Integer
Dim numberOfResults As Integer
Dim listIndex As Integer
Dim oneResult As Object
numberOfResults = scriptControl.Run("getNumberOfResults", jsObject)