• ClintHegney
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 29
    Replies
How do I include a javascript file or put inline script in the page and how do I use that javascript as actions with in a commandButton or commandLink component?
Anyone experiencing issues when putting a commandButton inside of some HTML inside of a facet?
I have the following code files; one version in VBScript and the other in JScript.
 
Code:
'*
'*
'* Script Name: test.vbs
'* Description: Sample Salesforce Script using VBScript technology
'* Created On : Thursday, August 2nd, 2007
'* Created By : Clinton Hegney <c_hegney@gelco.com>
'*
'*


'---------------------------< VARABLE DECLARATION >----------------------------

dim SforceSession, loginResult, userName, password



'---------------------------< CONSTANT DECLARATION >---------------------------





'-------------------------------< MAIN PROGRAM >-------------------------------

If Not WScript.Arguments.Named.Exists("usr") Or Len(WScript.Arguments.Named("usr")) = 0 Then
    WScript.StdOut.Write vbCrLf & vbCrLf & "A username was not given." & vbCrLf & vbCrLf
    WScript.Quit
Else
    userName = WScript.Arguments.Named("usr")
End If

If Not WScript.Arguments.Named.Exists("usr") Or Len(WScript.Arguments.Named("usr")) = 0 Then
    WScript.StdOut.Write vbCrLf & vbCrLf & "A password was not given." & vbCrLf & vbCrLf
    WScript.Quit
Else
    password = WScript.Arguments.Named("pwd")
End If

WScript.StdOut.Write vbCrLf & vbCrLf & "Username:" & + userName
WScript.StdOut.Write vbCrLf & "Password: " & password

' Create the Sforce session object.
Set SforceSession = WScript.CreateObject( "SForceOfficeToolkit3.SForceSession3.1" )

' Login to Salesforce storing the result and print the result to the screen.
loginResult = SforceSession.login( userName, password )
WScript.StdOut.Write vbCrLf & vbCrLf & "Successful login— " & loginResult & vbCrLf & vbCrLf

dim qr, ids(1)

ids(0) = "0033000000B5tEq"
Set qr = SforceSession.Retrieve("*", "contact", ids, False)

WScript.StdOut.Write qr.EntityType & vbCrLf
WScript.StdOut.Write qr.Size & vbCrLf & vbCrLf

For Each so In qr

    WScript.StdOut.Write so.ObjectType & vbCrLf & vbCrLf

Next

 
Code:
/*
 *
 * Script Name: test.js
 * Description: Sample Salesforce Script using JScript technology
 * Created On : Friday, June 13th, 2007
 * Created By : Clinton Hegney <c_hegney@gelco.com>
 *
 */


//--------------------------< VARABLE DECLARATION >----------------------------

var SforceSession, loginResult

var userName = WScript.Arguments.Named("usr");
var password = WScript.Arguments.Named("pwd");


//--------------------------< CONSTANT DECLARATION >---------------------------





//------------------------------< MAIN PROGRAM >-------------------------------

WScript.StdOut.Write("\n\nUsername: " + userName);
WScript.StdOut.Write("\nPassword: " + password);

if ( userName == undefined || userName.length == 0 ) {
    WScript.StdOut.Write("\n\nA username was not given.\n\n");
    WScript.Quit();
}
if ( password == undefined || password.length == 0 ) {
    WScript.StdOut.Write("\n\nA password was not given.\n\n");
    WScript.Quit();
}

// Create the Sforce session object.
SforceSession = WScript.CreateObject( "SForceOfficeToolkit3.SForceSession3.1" );

// Login to Salesforce storing the result and print the result to the screen.
loginResult = SforceSession.login( userName, password );
WScript.StdOut.Write( "\n\nSuccessful login— " + loginResult + "\n\n" );

var qr = SforceSession.Retrieve("*", "contact", ("0033000000B5tEq"), false);
WScript.StdOut.Write(qr.EntityType + "\n");
WScript.StdOut.Write(qr.Size + "\n\n");
for (i = 1; i <= qr.Size; i++) {
    WScript.StdOut.Write(qr[i].ObjectType + "\n\n");
}

 
The VBScript version runs fine, but the JScript version errors out with the following error.
 
test.js(50, 5) Microsoft JScript runtime error: 'qr[...].ObjectType' is null or not an object
 
What am I missing here?
I am getting the following error when trying to install the Apex Toolkit for Eclipse.
 
Code:
Network connection problems encountered during search.
  Unable to access "http://adnsandbox.com/appexchange/e3.2s".
    Error parsing site stream. [Premature end of file.]
    Premature end of file.
    Error parsing site stream. [Premature end of file.]
    Premature end of file.
  Unable to access "http://download.eclipse.org/releases/europa".
    Error parsing site stream. [Premature end of file.]
    Premature end of file.
    Error parsing site stream. [Premature end of file.]
    Premature end of file.

 
I have a fresh install of Eclipse 3.3.0
Windows XP Professional SP2
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)

I am having an issue when running a query of contacts for an account. When printing the results in my script, it bombs out on one of the contacts. Now this account is in Canada and the contact that it bombs out on looks like it has some non-english characters in the first name field. I was wondering if anyone has any ideas on how I would fix this? I am using the office toolkit in a Windows Script along with a helper Windows Script Component that I wrote.

Here is my code:

Code:
Dim sForce, sessionId, uid, pwd, objFSO, inFile, outFile, arLine, objConn, objRecSet, objContacts, objAccounts, sfHelper, objOwners
Dim idList(1)

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001

Set objConn = CreateObject("ADODB.Connection")
Set objRecSet = CreateObject("ADODB.Recordset")

pathTextFileDb = "C:\usr\winscript\TextDb\"

uid = WScript.Arguments.Item(0)
pwd = WScript.Arguments.Item(1)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set outFile = objFSO.OpenTextFile(WScript.Arguments.Item(3), ForWriting, True)
outFile.WriteLine """sfAccountId""," & _
 """sfAccountName""," & _
 """AccountOwnerId""," & _
 """AccountOwnerName""," & _
 """Contact_ID""," & _
 """FirstName""," & _
 """LastName""," & _
 """Email""," & _
 """MailingStreet""," & _
 """MailingCity""," & _
 """MailingState""," & _
 """MailingPostalCode""," & _
 """MailingCountry""," & _
 """Role__c""," & _
 """Contact_Status""," & _
 """Email_Opt_Out"""

Set sForce = CreateObject("SForceOfficeToolkit.SForceSession.1")
Set sfHelper = CreateObject("SfdcHelper.WSC")

sForce.Login uid,pwd,False
sessionId = sForce.SessionId

WScript.Echo sessionId & vbCrLf

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathTextFileDb & ";" & _
 "Extended Properties=""text;HDR=YES;FMT=Delimited"""
 
objRecset.Open "SELECT * FROM " & WScript.Arguments.Item(2), objConn, adOpenStatic, adLockOptimistic, adCmdText

While Not objRecSet.EOF

 If objRecSet.Fields.Item("IsRmCust") <> "FALSE" Then
 
  'idList(0) = objRecSet.Fields.Item("Account_ID")
  'Set objAccounts = sForce.Retrieve("*", "Account", idList, False)
  Set oAcct = sfHelper.GetAccountById(sForce, objRecSet.Fields.Item("Account_ID").Value)
  
  'If objAccounts.Size = 1 Then
  'If oAcct Then
   
   'For Each oAcct In objAccounts
   
    WScript.StdOut.Write oAcct.Item("Name").Name & ": " & oAcct.Item("Name")
    
    Set oOwner = sfHelper.GetUserById(sForce, oAcct.Item("OwnerId").Value)
    'idList(0) = oAcct.Item("OwnerId").Value
    'Set objOwners = sForce.Retrieve("*", "User", idList, False)
    'For Each o In objOwners
    ' Set oOwner = o
    'Next
    
    qryText = "select Id, FirstName, LastName, Email, Role__c, Contact_Status__c, Email_Opt_Out__c " & _
     " from Contact where AccountId = '" & objRecSet.Fields.Item("Account_ID") & "' "
    Set objContacts = sForce.Query(qryText, False)
    
    WScript.StdOut.Write "    Found " & objContacts.Size & " matching contacts." & vbCrLf
    
    If objContacts.Size > 0 Then
    
     For Each oCntct in objContacts
     
      outFile.WriteLine """" & objRecSet.Fields.Item("Account_ID") & """," & _
       """" & oAcct.Item("Name").Value & """," & _
       """" & oAcct.Item("OwnerId").Value & """," & _
       """" & oOwner.Item("FirstName").Value & " " & oOwner.Item("LastName").Value & """," & _
       """" & oCntct.Item("Id").Value & """," & _
       """" & oCntct.Item("FirstName").Value & """," & _
       """" & oCntct.Item("LastName").Value & """," & _
       """" & oCntct.Item("Email").Value & """," & _
       """" & oAcct.Item("ShippingStreet").Value & """," & _
       """" & oAcct.Item("ShippingCity").Value & """," & _
       """" & oAcct.Item("ShippingState").Value & """," & _
       """" & oAcct.Item("ShippingPostalCode").Value & """," & _
       """" & oAcct.Item("ShippingCountry").Value & """," & _
       """" & oCntct.Item("Role__c").Value & """," & _
       """" & oCntct.Item("Contact_Status__c").Value & """," & _
       """" & oCntct.Item("Email_Opt_Out__c").Value & """"
     
     Next
    
    End If    
   
   'Next
   
  'End If
  
 End If
 
 objRecSet.MoveNext

Wend

WScript.StdOut.Write vbCrLf & vbCrLf & "Press [Enter] to continue..."
Wscript.StdIn.ReadLine

'"""Acct_No""," & _
'"""ELAcctName""," & _
'"""" & objRecSet.Fields.Item("Account_Number") & """," & _
'"""" & objRecSet.Fields.Item("Account_Name") & """," & _
 
Here is the error I am getting:
 
Code:
Name: [account name]    Found 8 matching contacts.
C:\usr\winscript\Salesforce.vbs(83, 7) Microsoft VBScript runtime error: Invalid procedure call or argument
 
Is there one available? If so, where can I find it along with documentation on how to use?
        C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/01-login..............Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
t/01-login..............ok 1/4500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/01-login..............dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED test 4
        Failed 1/4 tests, 75.00% okay
t/02-query..............Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/02-query..............dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-2
        Failed 2/2 tests, 0.00% okay
t/03-servertimestamp....Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/03-servertimestamp....dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-2
        Failed 2/2 tests, 0.00% okay
t/04-crud...............Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/04-crud...............dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-9
        Failed 9/9 tests, 0.00% okay
t/05-getupdated.........Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/05-getupdated.........dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-7
        Failed 7/7 tests, 0.00% okay
t/06-describe...........Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/06-describe...........dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-4
        Failed 4/4 tests, 0.00% okay
t/07-search.............Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/07-search.............dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-3
        Failed 3/3 tests, 0.00% okay
t/08-retrieve...........Using a hash as a reference is deprecated at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 431.
500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at C:\usr\SfdcDev\Salesforce-0.54\blib\lib/Salesforce.pm line 52
t/08-retrieve...........dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-2
        Failed 2/2 tests, 0.00% okay
Failed Test            Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/01-login.t              9  2304     4    2  50.00%  4
t/02-query.t              9  2304     2    4 200.00%  1-2
t/03-servertimestamp.t    9  2304     2    4 200.00%  1-2
t/04-crud.t               9  2304     9   18 200.00%  1-9
t/05-getupdated.t         9  2304     7   14 200.00%  1-7
t/06-describe.t           9  2304     4    8 200.00%  1-4
t/07-search.t             9  2304     3    6 200.00%  1-3
t/08-retrieve.t           9  2304     2    4 200.00%  1-2
Failed 8/8 test scripts, 0.00% okay. 30/33 subtests failed, 9.09% okay.
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x9'
Stop.
Code:
Has anyone noticed that the default DOCTYPE inserted when 
creating a new SControl in Eclipse causes issues with 
Salesforce CSS, particularly with the detail tables— Here 
is the default DOCTYPE.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Now I was able to make some changes to the DOCTYPE that 
fixed the issues. Here is the fixed DOCTYPE.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Does anyone know why this is happening or how I can 
change the template so that the fix DOCTYPE is 
automatically inserted–


 
Is there something similar to the "retrieve" call in the AJAX tool kit? I am working on a project that will get all the products tied to an opportunity and then take he product ID from the query return and get the product code for each product and build a string that will be added to the end of the opportunity name. I know that I am going to have to iterate through the result from the query and for each product ID get the details of that product so I can grab the product code. Will I need to perform another query for each product ID so I can get the product's details or is there a method in the toolkit similar to the retrieve API call. In looking at the documentation in Eclipse I wasn't able to find a method that would do this.
Eclipse end point url? I know how to programmatically get this url in code, but when starting a project in eclipse it is asking for the url, I don't know what it is.
Looking at the code for pages in Salesforce, a lot of the images have the src attribute set to /s.gif. What are they doing here? They are doing this with the icons and it is not allowing me to get the path to the image. I am wanting to create the same look and feel on my custom s-controls, but I can't get the path to the icon images because they are doing something odd in the standard pages.
Tried using the following line in a btnLogin_Click() function call and received an the error below.

var loginResult = sforceClient.Login(document.getElementById("txtUserName"), document.getElementById("txtPassword") );



Line: 721
Char: 3
Error: 'Sforce.Util.time_object' is null or not an object
Code: 0
URL: <url>


Was I supposed to set this object some where before calling the Login function
When will the AJAX toolkit move out of beta status. What is keeping it in a beta status?
I can't seem to find any documentation for the AJAX Toolkit. The documentation for .NET and Java is very good. Is there similar documentation for the AJAX Toolkit?
It looks like custom s-controls only let you upload one dll. How do I use a proxy dll created from the wsdl with an s-control? Does the proxy dll need to reside on the user's workstation? If so where should I put it, \Windows\System32 directory?
How can I use an active session from loging directly into Salesforce.com during integration? I have tried creating custom links that pass the API_Session_ID parameter as a query string variable, but I am not able to create successfully and use that when setting up an SforceService object using C#. Is this possible, or do I have to provide the user with a second login for any integrated pages that I create?
How do I include a javascript file or put inline script in the page and how do I use that javascript as actions with in a commandButton or commandLink component?
Anyone experiencing issues when putting a commandButton inside of some HTML inside of a facet?
I'm trying to get Visualforce enabled in my develop edition account.  I'm not clear on who to contact to request this, so I'm posting it here.  Sorry if this should be a direct-to-salesforce-email, but I imagine others are wondering the same thing.

The Force cookbook states:

Note:  As of September 2007, Visualforce is available as a Developer Preview only.

The product/functionality matrix on p.30 of the cookbook shows the "Visualforce Developer Preview" as being available to Developer Edition accounts.

I'm writing this post because it's not available in my dev. edition account, and I'm unsure how to get it enabled.   Neither the Setup > Build > Pages nor Setup > My Personal Information > Personal Information > Developer Mode options are available to me, so I assume it's the org itself that needs enabling.

Do I have to sign up for a new developer edition account?  That would be somewhat painful, as I have a fair amount of custom objects & Apex Code in my current dev. edition account that I want to use with Visualforce.
  • September 18, 2007
  • Like
  • 0
I have the following code files; one version in VBScript and the other in JScript.
 
Code:
'*
'*
'* Script Name: test.vbs
'* Description: Sample Salesforce Script using VBScript technology
'* Created On : Thursday, August 2nd, 2007
'* Created By : Clinton Hegney <c_hegney@gelco.com>
'*
'*


'---------------------------< VARABLE DECLARATION >----------------------------

dim SforceSession, loginResult, userName, password



'---------------------------< CONSTANT DECLARATION >---------------------------





'-------------------------------< MAIN PROGRAM >-------------------------------

If Not WScript.Arguments.Named.Exists("usr") Or Len(WScript.Arguments.Named("usr")) = 0 Then
    WScript.StdOut.Write vbCrLf & vbCrLf & "A username was not given." & vbCrLf & vbCrLf
    WScript.Quit
Else
    userName = WScript.Arguments.Named("usr")
End If

If Not WScript.Arguments.Named.Exists("usr") Or Len(WScript.Arguments.Named("usr")) = 0 Then
    WScript.StdOut.Write vbCrLf & vbCrLf & "A password was not given." & vbCrLf & vbCrLf
    WScript.Quit
Else
    password = WScript.Arguments.Named("pwd")
End If

WScript.StdOut.Write vbCrLf & vbCrLf & "Username:" & + userName
WScript.StdOut.Write vbCrLf & "Password: " & password

' Create the Sforce session object.
Set SforceSession = WScript.CreateObject( "SForceOfficeToolkit3.SForceSession3.1" )

' Login to Salesforce storing the result and print the result to the screen.
loginResult = SforceSession.login( userName, password )
WScript.StdOut.Write vbCrLf & vbCrLf & "Successful login— " & loginResult & vbCrLf & vbCrLf

dim qr, ids(1)

ids(0) = "0033000000B5tEq"
Set qr = SforceSession.Retrieve("*", "contact", ids, False)

WScript.StdOut.Write qr.EntityType & vbCrLf
WScript.StdOut.Write qr.Size & vbCrLf & vbCrLf

For Each so In qr

    WScript.StdOut.Write so.ObjectType & vbCrLf & vbCrLf

Next

 
Code:
/*
 *
 * Script Name: test.js
 * Description: Sample Salesforce Script using JScript technology
 * Created On : Friday, June 13th, 2007
 * Created By : Clinton Hegney <c_hegney@gelco.com>
 *
 */


//--------------------------< VARABLE DECLARATION >----------------------------

var SforceSession, loginResult

var userName = WScript.Arguments.Named("usr");
var password = WScript.Arguments.Named("pwd");


//--------------------------< CONSTANT DECLARATION >---------------------------





//------------------------------< MAIN PROGRAM >-------------------------------

WScript.StdOut.Write("\n\nUsername: " + userName);
WScript.StdOut.Write("\nPassword: " + password);

if ( userName == undefined || userName.length == 0 ) {
    WScript.StdOut.Write("\n\nA username was not given.\n\n");
    WScript.Quit();
}
if ( password == undefined || password.length == 0 ) {
    WScript.StdOut.Write("\n\nA password was not given.\n\n");
    WScript.Quit();
}

// Create the Sforce session object.
SforceSession = WScript.CreateObject( "SForceOfficeToolkit3.SForceSession3.1" );

// Login to Salesforce storing the result and print the result to the screen.
loginResult = SforceSession.login( userName, password );
WScript.StdOut.Write( "\n\nSuccessful login— " + loginResult + "\n\n" );

var qr = SforceSession.Retrieve("*", "contact", ("0033000000B5tEq"), false);
WScript.StdOut.Write(qr.EntityType + "\n");
WScript.StdOut.Write(qr.Size + "\n\n");
for (i = 1; i <= qr.Size; i++) {
    WScript.StdOut.Write(qr[i].ObjectType + "\n\n");
}

 
The VBScript version runs fine, but the JScript version errors out with the following error.
 
test.js(50, 5) Microsoft JScript runtime error: 'qr[...].ObjectType' is null or not an object
 
What am I missing here?
I am getting the following error when trying to install the Apex Toolkit for Eclipse.
 
Code:
Network connection problems encountered during search.
  Unable to access "http://adnsandbox.com/appexchange/e3.2s".
    Error parsing site stream. [Premature end of file.]
    Premature end of file.
    Error parsing site stream. [Premature end of file.]
    Premature end of file.
  Unable to access "http://download.eclipse.org/releases/europa".
    Error parsing site stream. [Premature end of file.]
    Premature end of file.
    Error parsing site stream. [Premature end of file.]
    Premature end of file.

 
I have a fresh install of Eclipse 3.3.0
Windows XP Professional SP2
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
The sample app salesforce.mxml compiled fine the last time I tried it (in Beta 2), but in R3.2 there is now functionality in it that won't compile for me:
 
     [java] C:\Java\Flex\SalesforceFlexToolkit_R3.2\salesforce.mxml(453):  Error
: Type was not found or was not a compile-time constant: LeadLookup.
     [java]             var ll:LeadLookup = PopUpManager.createPopUp(this, LeadLookup, true) as LeadLookup;

I am having an issue when running a query of contacts for an account. When printing the results in my script, it bombs out on one of the contacts. Now this account is in Canada and the contact that it bombs out on looks like it has some non-english characters in the first name field. I was wondering if anyone has any ideas on how I would fix this? I am using the office toolkit in a Windows Script along with a helper Windows Script Component that I wrote.

Here is my code:

Code:
Dim sForce, sessionId, uid, pwd, objFSO, inFile, outFile, arLine, objConn, objRecSet, objContacts, objAccounts, sfHelper, objOwners
Dim idList(1)

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001

Set objConn = CreateObject("ADODB.Connection")
Set objRecSet = CreateObject("ADODB.Recordset")

pathTextFileDb = "C:\usr\winscript\TextDb\"

uid = WScript.Arguments.Item(0)
pwd = WScript.Arguments.Item(1)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set outFile = objFSO.OpenTextFile(WScript.Arguments.Item(3), ForWriting, True)
outFile.WriteLine """sfAccountId""," & _
 """sfAccountName""," & _
 """AccountOwnerId""," & _
 """AccountOwnerName""," & _
 """Contact_ID""," & _
 """FirstName""," & _
 """LastName""," & _
 """Email""," & _
 """MailingStreet""," & _
 """MailingCity""," & _
 """MailingState""," & _
 """MailingPostalCode""," & _
 """MailingCountry""," & _
 """Role__c""," & _
 """Contact_Status""," & _
 """Email_Opt_Out"""

Set sForce = CreateObject("SForceOfficeToolkit.SForceSession.1")
Set sfHelper = CreateObject("SfdcHelper.WSC")

sForce.Login uid,pwd,False
sessionId = sForce.SessionId

WScript.Echo sessionId & vbCrLf

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathTextFileDb & ";" & _
 "Extended Properties=""text;HDR=YES;FMT=Delimited"""
 
objRecset.Open "SELECT * FROM " & WScript.Arguments.Item(2), objConn, adOpenStatic, adLockOptimistic, adCmdText

While Not objRecSet.EOF

 If objRecSet.Fields.Item("IsRmCust") <> "FALSE" Then
 
  'idList(0) = objRecSet.Fields.Item("Account_ID")
  'Set objAccounts = sForce.Retrieve("*", "Account", idList, False)
  Set oAcct = sfHelper.GetAccountById(sForce, objRecSet.Fields.Item("Account_ID").Value)
  
  'If objAccounts.Size = 1 Then
  'If oAcct Then
   
   'For Each oAcct In objAccounts
   
    WScript.StdOut.Write oAcct.Item("Name").Name & ": " & oAcct.Item("Name")
    
    Set oOwner = sfHelper.GetUserById(sForce, oAcct.Item("OwnerId").Value)
    'idList(0) = oAcct.Item("OwnerId").Value
    'Set objOwners = sForce.Retrieve("*", "User", idList, False)
    'For Each o In objOwners
    ' Set oOwner = o
    'Next
    
    qryText = "select Id, FirstName, LastName, Email, Role__c, Contact_Status__c, Email_Opt_Out__c " & _
     " from Contact where AccountId = '" & objRecSet.Fields.Item("Account_ID") & "' "
    Set objContacts = sForce.Query(qryText, False)
    
    WScript.StdOut.Write "    Found " & objContacts.Size & " matching contacts." & vbCrLf
    
    If objContacts.Size > 0 Then
    
     For Each oCntct in objContacts
     
      outFile.WriteLine """" & objRecSet.Fields.Item("Account_ID") & """," & _
       """" & oAcct.Item("Name").Value & """," & _
       """" & oAcct.Item("OwnerId").Value & """," & _
       """" & oOwner.Item("FirstName").Value & " " & oOwner.Item("LastName").Value & """," & _
       """" & oCntct.Item("Id").Value & """," & _
       """" & oCntct.Item("FirstName").Value & """," & _
       """" & oCntct.Item("LastName").Value & """," & _
       """" & oCntct.Item("Email").Value & """," & _
       """" & oAcct.Item("ShippingStreet").Value & """," & _
       """" & oAcct.Item("ShippingCity").Value & """," & _
       """" & oAcct.Item("ShippingState").Value & """," & _
       """" & oAcct.Item("ShippingPostalCode").Value & """," & _
       """" & oAcct.Item("ShippingCountry").Value & """," & _
       """" & oCntct.Item("Role__c").Value & """," & _
       """" & oCntct.Item("Contact_Status__c").Value & """," & _
       """" & oCntct.Item("Email_Opt_Out__c").Value & """"
     
     Next
    
    End If    
   
   'Next
   
  'End If
  
 End If
 
 objRecSet.MoveNext

Wend

WScript.StdOut.Write vbCrLf & vbCrLf & "Press [Enter] to continue..."
Wscript.StdIn.ReadLine

'"""Acct_No""," & _
'"""ELAcctName""," & _
'"""" & objRecSet.Fields.Item("Account_Number") & """," & _
'"""" & objRecSet.Fields.Item("Account_Name") & """," & _
 
Here is the error I am getting:
 
Code:
Name: [account name]    Found 8 matching contacts.
C:\usr\winscript\Salesforce.vbs(83, 7) Microsoft VBScript runtime error: Invalid procedure call or argument
 
Hi All,
 
I downloaded the sample code for C#.Net applications. I had downloaded the wsdl file and added it as reference to my C# solution.
 
When I try to run the quickstart solution, I get the following error
 
The underlying connection was closed: Unable to connect to the remote server.
   at System.Net.HttpWebRequest.CheckFinalStatus()
   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult)
   at System.Net.HttpWebRequest.GetRequestStream()
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodN
ame, Object[] parameters)
   at quickstart_cs.sforce.SforceService.login(String username, String password)
 in c:\program files\salesforce.com\appexchange developer network\quickstart\app
exchange developer network\csharp .net\quickstart_cs\web references\sforce\refer
ence.cs:line 47
   at quickstart_cs.Class1.doLogin() in c:\program files\salesforce.com\appexcha
nge developer network\quickstart\appexchange developer network\csharp .net\quick
start_cs\quickstart.cs:line 210
 
Internet Access is through a firewall and when I try to access the webservices url

https://www.salesforce.com/services/Soap/c/7.0. I get the following error message.

400 GET not supported


Resin-3.0.12 (built Wed, 23 Feb 2005 10:29:38 PST)

Does anybody know what could be the reason for this

Regards

PSTech

Code:
Has anyone noticed that the default DOCTYPE inserted when 
creating a new SControl in Eclipse causes issues with 
Salesforce CSS, particularly with the detail tables— Here 
is the default DOCTYPE.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Now I was able to make some changes to the DOCTYPE that 
fixed the issues. Here is the fixed DOCTYPE.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Does anyone know why this is happening or how I can 
change the template so that the fix DOCTYPE is 
automatically inserted–


 



Message Edited by bikla78 on 04-22-2008 01:47 PM
Hi
 
I just install the AppExchange plug-ins, but when I click on the Scontrol, it cannot open the Scontrol editor, I have the following message
"Unable to create editor ID com.appexchange.plugin.editors.SControlEditor: Index out of bounds"
 
I could access to the AppExchangeSchema.....
Anyone could help me ?
 
I have eclipse 3.1.2 and appExchange 1.0.2206
 
Thanks
I just wanted to provide some feedback on my experiences with getting up-to-speed with the AJAX toolkit.  A couple of my criticisms stem from the fact that some of the code from blog entry "http://blog.sforce.com/sforce/2006/04/ajax_toolkit_be.html" does not seem to work.
 
I could not get the browsersupport javascript to 'auto-append' when following the instuctions from the referenced blog.  It said I could add a query string variable to the script URL, but I couldn't get that to work.  I had to add a second include statement.  Not a big inconvenience to do this, but it did cost me ~15-20 minutes of time to figure out.
 
 
The Property.bind() calls referenced don't work.  Or, if they do work, they are not straightforward to use.  In the blog, Dave uses:
 
dynaBean.getItem("Name").bind("nameField");
 
This will not work.  Looking at the code, it appears to expect a handle to the actual element as a parameter, ie:
 
dynaBean.getItem("Name").bind(document.getElementById("nameField") );
 
However, that call didn't work either.  I didn't dig any further.
 
Once I figured out how autobinding works, single binds didn't even matter for the task at hand. However, a powerful point on autobinding that I had to 'figure out for myself' was that the fields being bound will use 'introspection' on their target form elements to render themselves. Thus, if I bind a picklist to a text field, it is just a flat field with the current value populated.  But, if I bind a picklist to a select field, it is rendered as a full select list with all picklist options.  I like this!

That's it for now.  I'll provide more feedback in the future as I begin to tackle more complex tasks than simple CRUD operations.
 
Thanks!
Has anyone got this to work? I finally got it installed, but all it does is throw errors.

If I try to create a new AppExchange project, after I enter my project name and login info, I get a dialog that says "Invalid Thread Access" and I can't go any farther.

If I try to open the Schema Browser view, I get an error that says:

Unable to create view: Plug-in com.appexchange.toolkit was unable to load class com.appexchange.plugin.views.SchemaView.

This is using Eclipse 3.1.2 (the only version that I could get it successfully installed on).

I'd love to hear from anyone that is using this!

Thanks!

Todd Breiholz
Meredith Corporation
  • March 22, 2006
  • Like
  • 0
Hey,
 
I searched and found several threads on using the COM object "SForceOfficeToolkit.SForceSession" to access salesforce from ASP but when I try to create this object I get an error as if the COM were not installed.  I have installed the Office Toolkit but it makes no difference.  Do I have the COM name wrong?  do I need a different installation package? ( I installed SForce_Office_Toolkit_MSI and sforce_connect_616 )
 
Thanks