• amyer2240
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 12
    Replies
To test the "All or none" option on the Jitterbit Connect Salesforce Insert - inserting contacts- I created a sample file of two contacts, one of which had an External ID that matched an existing contact, so it should be rejected. Since I checked "all or none," I would expect both contacts to be rejected. Instead, one contact is inserted and the other is rejected. 

Even weirder, the "all or none" option seems to work fine with opportunities. 

Any ideas? Thank you!User-added image
I have a text field with a date in it (Opt_Out_Date_txt__c), and I'm trying to put that date into a Date-type formula field (Opt_Out_Date_Formula__c). The text field is in MM/DD/YYYY format. Here's what I have:

IF(OR(NOT(ISNULL(Opt_Out_Date_txt__c)), NOT(ISBLANK(Opt_Out_Date_txt__c))), DATEVALUE(RIGHT(Opt_Out_Date_txt__c, 4)+'-'+ LEFT(Opt_Out_Date_txt__c,2)+'-'+RIGHT(LEFT(Opt_Out_Date_txt__c,5),2)), NULL)

This is working fine when the text field is populated, but when it's blank I'm getting a #Error! message in the field (the syntax saves fine).

Any ideas? Thank you!
I have a trigger & test that work fine in my sandbox but when I try to deploy I get the following error:
DUPLICATE_VALUE, duplicate value found: Space_Key__c duplicates on record with id: [id for a space record]

Here is the trigger that's causing this error:

trigger Assignment on Account (after insert) {

//soft-coding space id
List<Space__c> spaces = [Select Name, Id from Space__c];
Map<String, String> spacemap = new Map<String, String>{};
for(Space__c cm: spaces)
spacemap.put(cm.Name, cm.Id);

Space_Account__c newrel = new Space_Account__c ();
for(Account accs : trigger.new){
if(accs.Space_Hidden__c==0)
{

newrel.Space__c = spacemap.get('National');
newrel.Account__c = accs.Id;

//here I tried to query to see if there was already an account key - i didnt get the systemdebug message so I dont think there was
set <Space_Account__c> setkey = new Set <Space_Account__c> ([select Space_Account_Key__c from Space_Account__c where Id =:newrel.Id]);
if(setkey.isEmpty()){

//here I tried to add the +1 to make it unique, but no luck
newrel.Space_Account_Key__c = spacemap.get('National')+cons.Id+1;
}
else {
    System.debug('I contain an account key');
    }

}
upsert newrel;

}}

I really am at a loss about how to avoid the duplicate value error!! Thank you!!
I'm getting the below error on my test class, which is failing:

-------

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, cv.AccountAll: execution of BeforeInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SpaceAssignment: execution of AfterInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [aba__Space__c]: [aba__Space__c]

Trigger.SpaceAssignment: line 18, column 1: []

---------

Here is my quick scenario: I've written two simple triggers which work fine that create a junction object after insert of a contact or account; that junction object is linked to a Space (so after the trigger, all contacts/accounts are linked to Spaces via the junction object). This is all being done with objects in a managed package. My test class kept failing, so I entered the below as my test class. I'd understand if it didn't cover any of the code, but why would it fail?

@isTest 
private class SpaceUpdateTestClass {
static testMethod void testAccount() {
   
Account acc = new Account(Name = 'Test Account');
insert acc;

List <aba__Space_Account__c> spaceacc = [Select Id, Name, aba__Account__c from aba__Space_Account__c where aba__Account__c =:acc.Id];

System.assertEquals(spaceacc[0].aba__Account__c, acc.Id);
}}

Any guidance is appreciated!! Thank you!
I have a trigger that isn't working, and I think it's not working because of the SOQL query below. I'm creating a new record in sandbox that matches the criteria in the query and troubleshooting in the debug log - does anyone see any reason this might not work? Thank you!

List<Opportunity> opportunities = new List<Opportunity>();
Map<Id, Opportunity> opportunitiesById = new Map<Id, Opportunity>(opportunities);
Set<Id> oppsset = new Set<Id>();
oppsset = opportunitiesbyId.keySet();
        
//get the opps and their relshps
cv__Relationship__c[] relationships = 
   [select Id, cv__UniqueId__c, cv__Opportunity__r.Id,  cv__Posted__c, cv__Reversed__c, cv__Posted_Date__c
   from cv__Relationship__c 
   where cv__UniqueId__c != null and cv__Reversed__c = false and cv__Posted__c = true and cv__Opportunity__r.Id in :oppsset and cv__Posted_Date__c < :Date.valueOf('2011-01-01')];

My debug log looks like:
SYSTEM_CONSTRUCTOR_ENTRY [3]|<init>()
SYSTEM_CONSTRUCTOR_EXIT [3]|<init>()
SYSTEM_CONSTRUCTOR_ENTRY [5]|<init>(Integer)
SYSTEM_CONSTRUCTOR_EXIT [5]|<init>(Integer)
SYSTEM_METHOD_ENTRY [6]|MAP<Id,Opportunity>.keySet()
SYSTEM_METHOD_EXIT [6]|MAP<Id,Opportunity>.keySet()
SYSTEM_METHOD_ENTRY [9]|com.salesforce.api.interop.apex.bd.DateMethods.ValueOf(String)
SYSTEM_METHOD_EXIT [9]|com.salesforce.api.interop.apex.bd.DateMethods.ValueOf(String)
SOQL_EXECUTE_BEGIN [9]|Aggregations:0|select Id, cv__UniqueId__c, cv__Opportunity__r.Id, cv__Posted__c, cv__Reversed__c, cv__Posted_Date__c from cv__Relationship__c where (cv__UniqueId != null and cv__Reversed__c = false and cv__Posted__c = true and cv__Opportunity__r.Id = :tmpVar1 and cv__Posted_Date__c < :tmpVar2)
SOQL_EXECUTE_END [9]|Rows:0

Here's a snippet of my code where I'm getting this error:

for(List<Opportunity> opportunities : [Select Id from Opportunity]) 
    {for(Opportunity o : opportunities) 
    {if(o.CloseDate < :Date.valueOf('2011-01-01') && o.StageName = 'Received');}}
Map<Id, Opportunity> opportunitiesById = new Map<Id, Opportunity>(opportunities);

I'm getting the error on the {if(o.CloseDate < :Date.valueOf('2011-01-01') snippet. How can I do a date comparison without the < ?

Thank you!!
I'm trying to write a SOQL statement that will give me a count of opportunity objects grouped by contact role account. These fields aren't related to each other - the path is:

Opportunity -->
OpportunityContactRole -->
Contact -->
Account

In SQL I'd just join these tables, but I don't know how to do this in SOQL. Any ideas? Thank you!!
I'm getting the below error on my test class, which is failing:

-------

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, cv.AccountAll: execution of BeforeInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SpaceAssignment: execution of AfterInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [aba__Space__c]: [aba__Space__c]

Trigger.SpaceAssignment: line 18, column 1: []

---------

Here is my quick scenario: I've written two simple triggers which work fine that create a junction object after insert of a contact or account; that junction object is linked to a Space (so after the trigger, all contacts/accounts are linked to Spaces via the junction object). This is all being done with objects in a managed package. My test class kept failing, so I entered the below as my test class. I'd understand if it didn't cover any of the code, but why would it fail?

@isTest 
private class SpaceUpdateTestClass {
static testMethod void testAccount() {
   
Account acc = new Account(Name = 'Test Account');
insert acc;

List <aba__Space_Account__c> spaceacc = [Select Id, Name, aba__Account__c from aba__Space_Account__c where aba__Account__c =:acc.Id];

System.assertEquals(spaceacc[0].aba__Account__c, acc.Id);
}}

Any guidance is appreciated!! Thank you!
I have a trigger that isn't working, and I think it's not working because of the SOQL query below. I'm creating a new record in sandbox that matches the criteria in the query and troubleshooting in the debug log - does anyone see any reason this might not work? Thank you!

List<Opportunity> opportunities = new List<Opportunity>();
Map<Id, Opportunity> opportunitiesById = new Map<Id, Opportunity>(opportunities);
Set<Id> oppsset = new Set<Id>();
oppsset = opportunitiesbyId.keySet();
        
//get the opps and their relshps
cv__Relationship__c[] relationships = 
   [select Id, cv__UniqueId__c, cv__Opportunity__r.Id,  cv__Posted__c, cv__Reversed__c, cv__Posted_Date__c
   from cv__Relationship__c 
   where cv__UniqueId__c != null and cv__Reversed__c = false and cv__Posted__c = true and cv__Opportunity__r.Id in :oppsset and cv__Posted_Date__c < :Date.valueOf('2011-01-01')];

My debug log looks like:
SYSTEM_CONSTRUCTOR_ENTRY [3]|<init>()
SYSTEM_CONSTRUCTOR_EXIT [3]|<init>()
SYSTEM_CONSTRUCTOR_ENTRY [5]|<init>(Integer)
SYSTEM_CONSTRUCTOR_EXIT [5]|<init>(Integer)
SYSTEM_METHOD_ENTRY [6]|MAP<Id,Opportunity>.keySet()
SYSTEM_METHOD_EXIT [6]|MAP<Id,Opportunity>.keySet()
SYSTEM_METHOD_ENTRY [9]|com.salesforce.api.interop.apex.bd.DateMethods.ValueOf(String)
SYSTEM_METHOD_EXIT [9]|com.salesforce.api.interop.apex.bd.DateMethods.ValueOf(String)
SOQL_EXECUTE_BEGIN [9]|Aggregations:0|select Id, cv__UniqueId__c, cv__Opportunity__r.Id, cv__Posted__c, cv__Reversed__c, cv__Posted_Date__c from cv__Relationship__c where (cv__UniqueId != null and cv__Reversed__c = false and cv__Posted__c = true and cv__Opportunity__r.Id = :tmpVar1 and cv__Posted_Date__c < :tmpVar2)
SOQL_EXECUTE_END [9]|Rows:0

Here's a snippet of my code where I'm getting this error:

for(List<Opportunity> opportunities : [Select Id from Opportunity]) 
    {for(Opportunity o : opportunities) 
    {if(o.CloseDate < :Date.valueOf('2011-01-01') && o.StageName = 'Received');}}
Map<Id, Opportunity> opportunitiesById = new Map<Id, Opportunity>(opportunities);

I'm getting the error on the {if(o.CloseDate < :Date.valueOf('2011-01-01') snippet. How can I do a date comparison without the < ?

Thank you!!
I'm trying to write a SOQL statement that will give me a count of opportunity objects grouped by contact role account. These fields aren't related to each other - the path is:

Opportunity -->
OpportunityContactRole -->
Contact -->
Account

In SQL I'd just join these tables, but I don't know how to do this in SOQL. Any ideas? Thank you!!