• tlaporte
  • NEWBIE
  • 75 Points
  • Member since 2009

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

I'm trying to Forward an Opportunity to a connection, based on it reaching a certain stage. I have the first part of the code working, (yes it was very easy :)).

 

for(Opportunity opp: Trigger.new){

if (opp.StageName == 'Closed Won')

  opp.OwnerId = '00530000001YYX2' ;

 

 

}

} 

 

But now I'm trying to unpickle how S2S works internally. How do you forward a record to a connection programatically? 

  • June 30, 2009
  • Like
  • 0

I updated my IDE plugin this morning and attempted running my unit tests.  The debug log window is empty.  I then attempted installing Eclipse 3.6 (x86 and x64), with the new plugin and they both acted the same.  Is there some obscure setting I am missing?  I sure wish I could see my debug logs through the IDE.

 

PS - yes I attempted to use the standalone installer for both x86 and x64 before posting here.

Hey all, first post.  I'm stuck.

I wrote a trigger on Contact that fires after insert and after update.  The purpose of the trigger is to check the PartnerNetworkRecordConnection able to see if the parent Account on the Contact has been previously shared.  If the condition is met, a second condition is checked to see if the contact has been previously shared.  If this is found not to be true, then a new record in PartnerNetworkRecordConnection is created that shares the Contact with the target org.

I wrote a similar trigger for Tasks.

I have thoroughly tested both triggers using the two orgs' sandboxes, through the platform and the data loader.  Everything works perfectly.

On to the issue - It's time to deploy, and I have written unit tests for both triggers.  The unit tests look nearly identical except for the change from Task to Contact, and WhatId to AccountId.  The Task trigger test class executes perfectly.  The Contact test fails.  I've included my debugging in the post below.

As you can see, the IDs are all lining up properly, and the same exact logic works for Tasks.  I am stumped.  Thanks for the help!

 

Code::

 

*** Beginning Test 1: SyncTasksContactTriggersTest.static testMethod void testContactTrigger()

20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 33, column 10: Insert: SOBJECT:Account
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 33, column 10:     DML Operation executed in 95 ms
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 34, column 10: ----------------Account:Account:{Name=Test Account, Id=001R000000HPQacIAH}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 44, column 86: SOQL query with 1 row finished in 18 ms
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 45, column 10: (PartnerNetworkConnection:{ConnectionName=EDITED OUT, ConnectionStatus=Accepted, Id=04PR00000008UGFMA2})
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 47, column 10: SelectLoop:LIST:SOBJECT:PartnerNetworkConnection
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 48, column 11: ----------------Network:PartnerNetworkConnection:{ConnectionName=City of cityName BPS, ConnectionStatus=Accepted, Id=04PR00000008UGFMA2}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 50, column 11: Insert: SOBJECT:PartnerNetworkRecordConnection
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 50, column 11:     DML Operation executed in 34 ms
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 51, column 11: ----------------PNRC:PartnerNetworkRecordConnection:{ConnectionId=04PR00000008UGFMA2, LocalRecordId=001R000000HPQacIAH, Id=04VR00000008QkqMAE}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 53, column 11: ----------------Contact:Contact:{AccountId=001R000000HPQacIAH, LastName=Contact}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 57, column 12: Insert: SOBJECT:Contact
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 57, column 12:     Changing testing limit context based on DML operation of size: 1
*** Beginning sendContacts on Contact trigger event AfterInsert for 003R000000ENK5J

20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 48, column 3: SelectLoop:LIST:SOBJECT:Contact
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 51, column 79: SOQL query with 1 row finished in 4 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 52, column 3: (PartnerNetworkConnection:{ConnectionName=City of cityName BPS, ConnectionStatus=Accepted, Id=04PR00000008UGFMA2})
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 53, column 4: SelectLoop:LIST:SOBJECT:PartnerNetworkConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 55, column 55: SOQL query with 1 row finished in 4 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 57, column 5: SelectLoop:LIST:SOBJECT:Contact
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 60, column 101: SOQL query with 1 row finished in 6 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 62, column 5: SelectLoop:LIST:SOBJECT:PartnerNetworkRecordConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 65, column 5: -------------Account IDs:( 001R000000HPQacIAH)
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 67, column 101: SOQL query with 0 rows finished in 5 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 69, column 6: SelectLoop:LIST:SOBJECT:PartnerNetworkRecordConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 72, column 6: ----------------Old Contacts:()
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 73, column 52: SOQL query with 1 row finished in 4 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 74, column 6: ----------------New Contacts:(Contact:{AccountId=001R000000HPQacIAH, Id=003R000000ENK5JIAX})
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 76, column 6: SelectLoop:LIST:SOBJECT:Contact
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 83, column 6: ----------------Inserting Records:(PartnerNetworkRecordConnection:{ConnectionId=04PR00000008UGFMA2, LocalRecordId=003R000000ENK5JIAX, ParentRecordId=001R000000HPQacIAH })
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 84, column 6: Upsert: LIST:SOBJECT:PartnerNetworkRecordConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 84, column 6:     DML Operation executed in 14 ms
System.DmlException: Upsert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: [] 

Message Edited by tlaporte on 07-01-2009 11:28 AM

I updated my IDE plugin this morning and attempted running my unit tests.  The debug log window is empty.  I then attempted installing Eclipse 3.6 (x86 and x64), with the new plugin and they both acted the same.  Is there some obscure setting I am missing?  I sure wish I could see my debug logs through the IDE.

 

PS - yes I attempted to use the standalone installer for both x86 and x64 before posting here.

Hello,

 

We are seeing odd behavior with business hours in Apex. We are setting Milestone dates for a Project by starting with the Live Date (the final Milestone), and working backwards through the list of Milestones – each of which has a “days since previous Milestone”.  

 

This is the relevant portion of the block of code:

milliseconds = milestoneMap.get(j).Days_Since_Previous_Milestone__c.longValue() * 86400000L * -1;

 

System.debug('XXXXXX About to subtract ' + milliseconds + ' from ' + milestoneDateTime + ' for ' + projectMilestone.Milestone__c);

 

newMidDay = BusinessHours.add(bh.Id, milestoneDateTime, milliseconds);

 

System.debug('XXXXXX The number of milliseconds subtracted was ' + BusinessHours.diff(bh.id, newMidDay, milestoneDateTime)); 

 

When we run the Debug Log, it reads “XXXXXX About to subtract -172800000 from 2010-06-22 00:00:00 for a09R0000005dlMSIAY”, which is correct, because the next Milestone is two business days earlier, and there are 172800000 milliseconds in two days (it does read that it’s going to “subtract” a negative number, but you can see how the code is actually adding the negative number).  Now, the next debug entry, which is after only one line of code (the BusinessHours.add) states “XXXXXX The number of milliseconds subtracted was 86400000”.  How could this be?  So, it’s saying “I’m about to subtract 172800000 milliseconds, but I actually subtracted 86400000.”

 

Our only Business Hours record has 24 hours Mon - Fri and zero hours on Sat and Sun (I've confirmed through Apex Explorer).  No holidays.  The above example is subtracting two days from Monday and arriving at Friday (when it should arrive at Thursday, and should also not contradict itself with stating it's going to subtract one number but actually subtracting another).  This is also odd, because if it was "ignoring" business hours completely, it would have subtracted two days from Monday and arrived at Sunday.  Yet, if it subtracts two days from a Thursday, it accurately arrives at Tuesday (the debug log states “I’m about to subtract 172800000 milliseconds, and I did subtract 172800000.”

 

Thoughts?

 

Thanks,

Marc

I have installed this application and when I try to attache a pdf to the quote, I get 5 blank files with the appropriate quote number. Since I no absolutely nothing about programming, I wonder if there are any application notes or suggested changes that need to be made to get the application operational for actually creating the pdf?

 

Thanks

Hey all, first post.  I'm stuck.

I wrote a trigger on Contact that fires after insert and after update.  The purpose of the trigger is to check the PartnerNetworkRecordConnection able to see if the parent Account on the Contact has been previously shared.  If the condition is met, a second condition is checked to see if the contact has been previously shared.  If this is found not to be true, then a new record in PartnerNetworkRecordConnection is created that shares the Contact with the target org.

I wrote a similar trigger for Tasks.

I have thoroughly tested both triggers using the two orgs' sandboxes, through the platform and the data loader.  Everything works perfectly.

On to the issue - It's time to deploy, and I have written unit tests for both triggers.  The unit tests look nearly identical except for the change from Task to Contact, and WhatId to AccountId.  The Task trigger test class executes perfectly.  The Contact test fails.  I've included my debugging in the post below.

As you can see, the IDs are all lining up properly, and the same exact logic works for Tasks.  I am stumped.  Thanks for the help!

 

Code::

 

*** Beginning Test 1: SyncTasksContactTriggersTest.static testMethod void testContactTrigger()

20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 33, column 10: Insert: SOBJECT:Account
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 33, column 10:     DML Operation executed in 95 ms
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 34, column 10: ----------------Account:Account:{Name=Test Account, Id=001R000000HPQacIAH}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 44, column 86: SOQL query with 1 row finished in 18 ms
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 45, column 10: (PartnerNetworkConnection:{ConnectionName=EDITED OUT, ConnectionStatus=Accepted, Id=04PR00000008UGFMA2})
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 47, column 10: SelectLoop:LIST:SOBJECT:PartnerNetworkConnection
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 48, column 11: ----------------Network:PartnerNetworkConnection:{ConnectionName=City of cityName BPS, ConnectionStatus=Accepted, Id=04PR00000008UGFMA2}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 50, column 11: Insert: SOBJECT:PartnerNetworkRecordConnection
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 50, column 11:     DML Operation executed in 34 ms
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 51, column 11: ----------------PNRC:PartnerNetworkRecordConnection:{ConnectionId=04PR00000008UGFMA2, LocalRecordId=001R000000HPQacIAH, Id=04VR00000008QkqMAE}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 53, column 11: ----------------Contact:Contact:{AccountId=001R000000HPQacIAH, LastName=Contact}
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 57, column 12: Insert: SOBJECT:Contact
20090701150801.066:Class.SyncTasksContactTriggersTest.testContactTrigger: line 57, column 12:     Changing testing limit context based on DML operation of size: 1
*** Beginning sendContacts on Contact trigger event AfterInsert for 003R000000ENK5J

20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 48, column 3: SelectLoop:LIST:SOBJECT:Contact
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 51, column 79: SOQL query with 1 row finished in 4 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 52, column 3: (PartnerNetworkConnection:{ConnectionName=City of cityName BPS, ConnectionStatus=Accepted, Id=04PR00000008UGFMA2})
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 53, column 4: SelectLoop:LIST:SOBJECT:PartnerNetworkConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 55, column 55: SOQL query with 1 row finished in 4 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 57, column 5: SelectLoop:LIST:SOBJECT:Contact
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 60, column 101: SOQL query with 1 row finished in 6 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 62, column 5: SelectLoop:LIST:SOBJECT:PartnerNetworkRecordConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 65, column 5: -------------Account IDs:( 001R000000HPQacIAH)
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 67, column 101: SOQL query with 0 rows finished in 5 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 69, column 6: SelectLoop:LIST:SOBJECT:PartnerNetworkRecordConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 72, column 6: ----------------Old Contacts:()
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 73, column 52: SOQL query with 1 row finished in 4 ms
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 74, column 6: ----------------New Contacts:(Contact:{AccountId=001R000000HPQacIAH, Id=003R000000ENK5JIAX})
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 76, column 6: SelectLoop:LIST:SOBJECT:Contact
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 83, column 6: ----------------Inserting Records:(PartnerNetworkRecordConnection:{ConnectionId=04PR00000008UGFMA2, LocalRecordId=003R000000ENK5JIAX, ParentRecordId=001R000000HPQacIAH })
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 84, column 6: Upsert: LIST:SOBJECT:PartnerNetworkRecordConnection
20090701150801.277:Class.SyncTasksContactTriggers.sendContactsTocityName: line 84, column 6:     DML Operation executed in 14 ms
System.DmlException: Upsert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: [] 

Message Edited by tlaporte on 07-01-2009 11:28 AM

I am trying to use the method EncodingUtil.urlEncode as shown below to encode a string passed into my method 'checkProduct'.  For example, if I call checkProduct('Jelly Beans'), I am expecting that the econdedURL would equal https://somewhere.com/something/Jelly%20Beans.  I am not getting that.  I am getting https://somewhere.com/something/Jelly++Beans.

 

What I need is for any of the spaces to be converted to %20.  I thought this is what the urlEncode method would do?  Any help would be appreciated.

 

public String checkProduct(String target) { String URL = 'https://somewhere.com/something/'; String encodedURL; System.debug('URL= ' + URL); encodedURL = URL + EncodingUtil.urlEncode(target, 'UTF-8'); System.debug('encodedURL= ' + encodedURL); )

 

I'm trying to Forward an Opportunity to a connection, based on it reaching a certain stage. I have the first part of the code working, (yes it was very easy :)).

 

for(Opportunity opp: Trigger.new){

if (opp.StageName == 'Closed Won')

  opp.OwnerId = '00530000001YYX2' ;

 

 

}

} 

 

But now I'm trying to unpickle how S2S works internally. How do you forward a record to a connection programatically? 

  • June 30, 2009
  • Like
  • 0

I have a page where an event is entered, so it has a datetime inputField.   The visualforce page renders a single text input with a datepicker, so the date and time can be entered (by typing in the time after the date has been selected), but it's not very user friendly.  The native Salesforce.com page to enter an event splits this into two fields -- date and time -- which is much more intuitive.

I'm probably missing something, but what's the best way to achieve this (without resorting to raw text inputs)?

Thanks
Kenny