• lashak
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies

Hi All,

I am looking into options to update an excel workbook tab with opportunity data.  The requirement is to have this tab updated when a user clicks a button on the page and then open the excel file.  The excel file is going to be stored in salesforce so we have one place to keep it updated and current for our users.

 

Any help or guidance will be greatly appreciated.

 

Thank you,

Hi All,

I have gone through all of the posts on this board and have been unable to determine what my issue is.  I am using the below code to test the login but I keep getting invalid user name, password or token.  The user is set up to not have a token assigned through api and is working fine for all other apps we have running. 

 

Note I have removed the user id and password and just attached the code:

 

My question is two - fold:

1.  Do I need to have the excel connector installed to use the office toolkit API?

2.  Is there anything you can see that is wrong with the code below?

 

*******************************************************************

Dim g_sfApi As SForceOfficeToolkitLib3.SForceSession3
Public LoginTest As Boolean
Public myusername As String
Public mypassword As String
Public myserverurl As String
Public mymessage As String

Sub MyMain()
    LoginTest = True
    If LoginTest = True Then
        myusername = "
        mypassword = ""        'this might be different from below
        'mypassword = "password + token"        'this might be different from below
        myserverurl = "https://test.salesforce.com/services/Soap/c/17.0"
    Else
        myusername = ""
        mypassword = ""        'this might be different from above
        myserverurl = "https://www.salesforce.com/services/Soap/c/17.0"
    End If
     
If SampleLogin(myusername, mypassword) = True Then
    mymessage = "Logged into: " & g_sfApi.ServerUrl
    MsgBox mymessage
    'CreateAccount
Else
    mymessage = "Login failed, " & g_sfApi.ServerUrl & g_sfApi.ErrorField & g_sfApi.ErrorMessage
    MsgBox mymessage
    MsgBox (g_sfApi.ErrorField & g_sfApi.ErrorMessage)
    'Unload Me
End If

End Sub

Public Function SampleLogin(Username, Password) As Boolean
    Set g_sfApi = New SForceOfficeToolkitLib3.SForceSession3
    Debug.Print "Default URL: ", g_sfApi.ServerUrl
   
    If LoginTest = True Then
        g_sfApi.SetServerUrl (myserverurl)
        Debug.Print "New URL: ", g_sfApi.ServerUrl
    End If

    SampleLogin = g_sfApi.Login(Username, Password)
End Function

********************************************************************************

 

Thank you,

 

 

Hello,

I am trying to get my query to only return Accounts that have a client Id as well as opportunities that are in stage 6 or have a client id.

 

This is what I have so far:

 

Select a.Website, a.Sub_Status__c, a.Status__c, a.Official_Name__c, a.Name, a.Industry, a.Id, a.Client_ID__c,

(Select o.Id, o.Name, o.StageName, o.AccountId From Opportunities o Where o.StageName = '6 - Closed/Won' Or o.Account.Client_ID__c != NULL ),

a.Business_Unit__c, a.BillingStreet, a.BillingState, a.BillingPostalCode, a.BillingCountry, a.BillingCity,

a.D_U_N_S__c, a.Tax_Number__c, a.Owner.Name, a.Owner.EmployeeNumber, a.Company_Reg__c, a.Channel_Owner__c From Account a

 

The above returns me all of the accounts for our company and joins the opportunities that are either stage 6 or have a client id. 

 

What I need the query to do is return only Accounts with a client ID as well as Accounts that have an opportunity in Stage 6 or opportunities that have a client ID.

 

If I add a where clause at the end of the main select such as WHERE a.Client_ID__c !=NULL, I get all the accounts that have client ids but I miss the accounts that have an opportunity in stage 6 that don't have a client ID.

 

I am really hoping someone out here can help me out.

 

Thank you,

 

  • January 26, 2010
  • Like
  • 0

Hi All,

I don't think this is possible, but before I gave up and just ran two queries, I wanted to check with you smart folks.  I am trying to get the Account Owner Name and Employee number from an opportunity query.  I know I can get to the Account.OwnerId but that is as far as it goes without writing another query to the User object for the name and employee number.

 

Here is my query:

Select o.Id, o.Account.Business_Unit__c, o.Account.Sub_Status__c, o.Account.Official_Name__c,

o.Account.Status__c, o.Account.Client_ID__c, o.Account.OwnerId, o.Account.Industry, o.Account.Website,

o.Account.BillingCountry, o.Account.BillingPostalCode, o.Account.BillingState, o.Account.BillingCity,

o.Account.BillingStreet, o.Account.Id, o.AccountId From Opportunity o

Where o.StageName >= '6 - Closed/Won'

 

I also need to return the Account Owner Name and Employee number but I have come up empty thus far except writing another query to the User object where User.Id = o.Account.OwnerId. 

 

Any thoughts or suggestions will be greatly appreciated.

 

Thanks,

Steve

  • January 14, 2010
  • Like
  • 0

I am stuck.  We are moving a process that was going after a local database that was replicating our salesforce data to go directly after salesforce.  The problem I am having is how to mimic the following PHP code in regards to a join on the User and Opportunity objects:

 

 function getSalesforceProspects()
 {
  $msquery="select Opportunity.sfOpportunityId as SFXRefID
from
    Account
    inner join Opportunity on Opportunity.AccountId = Account.sfAccountId
    inner join Users on Users.sfUserId = Opportunity.OwnerId

where
    -- 'Channel Sales & Marketing Opportunity' and 'Direct Sales & Marketing Opportunity' record types:
    Opportunity.RecordTypeId in ('0123000000056kxAAA', '012300000004zjnAAA') ORDER BY Opportunity.OpportunityName";
  $result = mssql_query($msquery);
  /* Error occurred, return given name by default */
  if(!$result || (mssql_num_rows ($result) < 1)){
   return NULL;
  }
  /* Return result array */
  while($row = mssql_fetch_array($result)){
      $dbarray[]=$row['SFXRefID'];
  }
  return $dbarray;

 } // end func

I am new to SOQL and I have been trying to figure out a way to mimic the above query with no luck.  Any help will be greatly appreciated.

 

Thanks,

  • December 30, 2010
  • Like
  • 0

Hi All,

I have gone through all of the posts on this board and have been unable to determine what my issue is.  I am using the below code to test the login but I keep getting invalid user name, password or token.  The user is set up to not have a token assigned through api and is working fine for all other apps we have running. 

 

Note I have removed the user id and password and just attached the code:

 

My question is two - fold:

1.  Do I need to have the excel connector installed to use the office toolkit API?

2.  Is there anything you can see that is wrong with the code below?

 

*******************************************************************

Dim g_sfApi As SForceOfficeToolkitLib3.SForceSession3
Public LoginTest As Boolean
Public myusername As String
Public mypassword As String
Public myserverurl As String
Public mymessage As String

Sub MyMain()
    LoginTest = True
    If LoginTest = True Then
        myusername = "
        mypassword = ""        'this might be different from below
        'mypassword = "password + token"        'this might be different from below
        myserverurl = "https://test.salesforce.com/services/Soap/c/17.0"
    Else
        myusername = ""
        mypassword = ""        'this might be different from above
        myserverurl = "https://www.salesforce.com/services/Soap/c/17.0"
    End If
     
If SampleLogin(myusername, mypassword) = True Then
    mymessage = "Logged into: " & g_sfApi.ServerUrl
    MsgBox mymessage
    'CreateAccount
Else
    mymessage = "Login failed, " & g_sfApi.ServerUrl & g_sfApi.ErrorField & g_sfApi.ErrorMessage
    MsgBox mymessage
    MsgBox (g_sfApi.ErrorField & g_sfApi.ErrorMessage)
    'Unload Me
End If

End Sub

Public Function SampleLogin(Username, Password) As Boolean
    Set g_sfApi = New SForceOfficeToolkitLib3.SForceSession3
    Debug.Print "Default URL: ", g_sfApi.ServerUrl
   
    If LoginTest = True Then
        g_sfApi.SetServerUrl (myserverurl)
        Debug.Print "New URL: ", g_sfApi.ServerUrl
    End If

    SampleLogin = g_sfApi.Login(Username, Password)
End Function

********************************************************************************

 

Thank you,

 

 

Hello,

I am trying to get my query to only return Accounts that have a client Id as well as opportunities that are in stage 6 or have a client id.

 

This is what I have so far:

 

Select a.Website, a.Sub_Status__c, a.Status__c, a.Official_Name__c, a.Name, a.Industry, a.Id, a.Client_ID__c,

(Select o.Id, o.Name, o.StageName, o.AccountId From Opportunities o Where o.StageName = '6 - Closed/Won' Or o.Account.Client_ID__c != NULL ),

a.Business_Unit__c, a.BillingStreet, a.BillingState, a.BillingPostalCode, a.BillingCountry, a.BillingCity,

a.D_U_N_S__c, a.Tax_Number__c, a.Owner.Name, a.Owner.EmployeeNumber, a.Company_Reg__c, a.Channel_Owner__c From Account a

 

The above returns me all of the accounts for our company and joins the opportunities that are either stage 6 or have a client id. 

 

What I need the query to do is return only Accounts with a client ID as well as Accounts that have an opportunity in Stage 6 or opportunities that have a client ID.

 

If I add a where clause at the end of the main select such as WHERE a.Client_ID__c !=NULL, I get all the accounts that have client ids but I miss the accounts that have an opportunity in stage 6 that don't have a client ID.

 

I am really hoping someone out here can help me out.

 

Thank you,

 

  • January 26, 2010
  • Like
  • 0

I am stuck.  We are moving a process that was going after a local database that was replicating our salesforce data to go directly after salesforce.  The problem I am having is how to mimic the following PHP code in regards to a join on the User and Opportunity objects:

 

 function getSalesforceProspects()
 {
  $msquery="select Opportunity.sfOpportunityId as SFXRefID
from
    Account
    inner join Opportunity on Opportunity.AccountId = Account.sfAccountId
    inner join Users on Users.sfUserId = Opportunity.OwnerId

where
    -- 'Channel Sales & Marketing Opportunity' and 'Direct Sales & Marketing Opportunity' record types:
    Opportunity.RecordTypeId in ('0123000000056kxAAA', '012300000004zjnAAA') ORDER BY Opportunity.OpportunityName";
  $result = mssql_query($msquery);
  /* Error occurred, return given name by default */
  if(!$result || (mssql_num_rows ($result) < 1)){
   return NULL;
  }
  /* Return result array */
  while($row = mssql_fetch_array($result)){
      $dbarray[]=$row['SFXRefID'];
  }
  return $dbarray;

 } // end func

I am new to SOQL and I have been trying to figure out a way to mimic the above query with no luck.  Any help will be greatly appreciated.

 

Thanks,

  • December 30, 2010
  • Like
  • 0