• grahamjroy
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hi.


I have been working through this article which shows how to set up a Salesforce2Salesforce connection:

http://wiki.developerforce.com/index.php/An_Introduction_to_Salesforce_to_Salesforce

I have managed to set up the connection between the two installations but the code for the automation doesn't seem to work. 

What I want to be able to do is create an apex trigger on a custom object (myObject_c) which when created automatically puts the myObject_c and parent Account object across to the partner. My code looks like:

trigger shareWithPartner on myObject_c(after insert) {
PartnerNetworkRecordConnection newConnection =
                    new PartnerNetworkRecordConnection(
                        ConnectionId = networkId,
                        LocalRecordId = newContact.Id,
                        SendClosedTasks = false,
                        SendOpenTasks = false,
                        SendEmails = false,
                        ParentRecordId = myObject_c.AccountId);
insert newConnection;
}

but I get the error that networkId variable doesn't exist. Do I need to put in the connection id for the partner relationship in here? If I use the Id that is present in the url when I look at the connection:

https://na7.salesforce.com/p/pnetwork/Response/d?id=xyz123456789

in the code then I get the following errors:

                        ConnectionId = xyz123456789,
returns: Compile Error: expecting a right parentheses, found 'xyz123456789'

 

Hi.

 

I have an application (built in Ruby) that logs into my saleforce account and retrieves the token in the response. When I try and use this token with curl however I am always just getting the error that:

 

 

  "message" : "Session expired or invalid",
  "errorCode" : "INVALID_SESSION_ID"

 

 

I have seen a couple of other posts that I have tried to revolve the problem with:

 

I definitely have the user set up with API access as per here

 

I also have an escaping character in the token which I am handling using a variable on my machine as per here

 

So my steps are:

 

I have a Ruby on Rails app that redirects me to salesforce and make me log in. The callback URL is then triggered which returns my token (with the escape character) like nnnnnnnnnnnnnnnn!nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn

 

I store this token variable in my .bash_profile file as

 

export token=nnnnnnnnnnnnnnnn!nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn

 

and if I run echo $token from the console it outputs the token correctly.

 

I then try and perform a curl command to the salesforce api constructed like:

 

 

curl https://na1.salesforce.com/services/data/v20.0/ -H "Authorisation: OAuth "$token -H "X-PrettyPrint:1"

Has anyone else experienced this problem, or is there something wrong witht he way I am trying to pass the token value?

 

 

Hi.


I have been working through this article which shows how to set up a Salesforce2Salesforce connection:

http://wiki.developerforce.com/index.php/An_Introduction_to_Salesforce_to_Salesforce

I have managed to set up the connection between the two installations but the code for the automation doesn't seem to work. 

What I want to be able to do is create an apex trigger on a custom object (myObject_c) which when created automatically puts the myObject_c and parent Account object across to the partner. My code looks like:

trigger shareWithPartner on myObject_c(after insert) {
PartnerNetworkRecordConnection newConnection =
                    new PartnerNetworkRecordConnection(
                        ConnectionId = networkId,
                        LocalRecordId = newContact.Id,
                        SendClosedTasks = false,
                        SendOpenTasks = false,
                        SendEmails = false,
                        ParentRecordId = myObject_c.AccountId);
insert newConnection;
}

but I get the error that networkId variable doesn't exist. Do I need to put in the connection id for the partner relationship in here? If I use the Id that is present in the url when I look at the connection:

https://na7.salesforce.com/p/pnetwork/Response/d?id=xyz123456789

in the code then I get the following errors:

                        ConnectionId = xyz123456789,
returns: Compile Error: expecting a right parentheses, found 'xyz123456789'

 

Hi.

 

I have an application (built in Ruby) that logs into my saleforce account and retrieves the token in the response. When I try and use this token with curl however I am always just getting the error that:

 

 

  "message" : "Session expired or invalid",
  "errorCode" : "INVALID_SESSION_ID"

 

 

I have seen a couple of other posts that I have tried to revolve the problem with:

 

I definitely have the user set up with API access as per here

 

I also have an escaping character in the token which I am handling using a variable on my machine as per here

 

So my steps are:

 

I have a Ruby on Rails app that redirects me to salesforce and make me log in. The callback URL is then triggered which returns my token (with the escape character) like nnnnnnnnnnnnnnnn!nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn

 

I store this token variable in my .bash_profile file as

 

export token=nnnnnnnnnnnnnnnn!nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn

 

and if I run echo $token from the console it outputs the token correctly.

 

I then try and perform a curl command to the salesforce api constructed like:

 

 

curl https://na1.salesforce.com/services/data/v20.0/ -H "Authorisation: OAuth "$token -H "X-PrettyPrint:1"

Has anyone else experienced this problem, or is there something wrong witht he way I am trying to pass the token value?