function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
orzikorzik 

SForce Connector

Does anyone know how to use custom functions in SForce Connector? BTW the tool is great!
The manual mentions sflookup and sfemail, but there should be more. Where I can find full list?

Thanks,

greg

ScotScot

You can find these fairly easily by browsing the functions within the sforce_connector.

Excel>> Tools / Macros / Visual Basic Editor (or Alt-F11)
MS VB, Project Explorer >> sforce_connector / Modules / s_force

Many of the functions in this module are meant to be used inernally, but most of those that are reasonably used in Excel expressions have comments at the front explaining their usage. Note that Ron may not intend to support all of these for external usage ...

A quick browse gives the following functions. Note that whenever "ID" appears, it refers to one of the salesforce 18 (or 15) character internal ids.

sfUserName(user id): given an sf user ID , returns the user's first name + last name.  
  Very useful for owner, last modified by, etc.

sfUserId(fullname): given a (first name + last name), returns the User ID

FixID(id):  given either a 15 or 18 character ID, returns an 18 character one

QuarterNum(date-value): returns the number of the quarter (e.g. 4 for Nov 15th)

NextQuarter(date-value): returns the first day of the next quarter (e.g. 1/1/2005 for Nov 15th 04)

fixidcol(): if assigned to a macro, will fix all the ids (see FixID, above) for an entire column

soql_table(tablename, querystring): Tricky: returns an ID if the query returns one hit.
The querystring must be in the sytax of the SOQL Where clause.
Example: soql_table("Contact","FirstName = 'Scot' and LastName = 'Stoney' ")

sflookup(tablename, name): returns the ID for the table based on a search value; it matches most fields

sfemail(email, Optional findfirst): returns the Contact ID based on a search for the email address.
   If a second argument is specified, it will return the first match even if more than 1 are found

sfcontact(firstname, Optional lastname): a short-cut to sflookup. It is the equivalent of:
      sflookup("Contact", firstname + " " + lastname) with some argument checking

sfaccount(accountname): a short-cut to sflookup. It is the equivalent of:
      sflookup("Account", accountname) with the removal of some common suffixes such as "Corp".

and, if you want to build more of these yourself, you'll probably want to look at how each of these calls sflookup_w and the values which you can pass to the salesforce.search function.

(Fixed a missing quote in the soql_table example)

Message Edited by Scot on 12-06-2004 11:43 AM

orzikorzik
Thanks,