• Alexandra Stehman
  • NEWBIE
  • 40 Points
  • Member since 2014
  • Senior Consultant
  • RTS Labs, LLC

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 7
    Replies
Select Id FROM Task 
 where What.RecordType.SObjectType='Opportunity' and
(What.CreatedDate >2015-05-23T11:59:59Z and What.CreatedDate <2015-05-25T00:00:00Z)
That is the query I am using. It seems fairly straightforward to me that only related entities of type Opportunity should be returned.

However, both DataLoader and DeveloperConsole return this error:

What.CreatedDate>2015-05-23T:11:59:59Z
^
ERROR at Row:3:Column:2
No such column 'CreatedDate' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name...."

Where am I goofing up?

THANK YOU!
I am trying to find campaign members for campaigns executed in last 2 years (not via Apex), in order to migrate this data (using Jitterbit).

I have tried couple different queries (from developer console) and can't seem to get the right query. Campaign is a lookup on CampaignMember, so should I not be able to use the __r notation to access?
 
SELECT Id, CampaignId, ContactId, CreatedById, CreatedDate, FirstRespondedDate, HasResponded, IsDeleted, LastModifiedById, LastModifiedDate, LeadId, Status, SystemModstamp 
FROM CampaignMember
where CampaignId = Campaign__r.id and Campaign__r.CreatedDate >= LAST_N_YEARS:2


 
I want to do something pretty basic, which is, add number of business days to a date based on the record type ID.  I made a formula like below.  However, the compiler reports "Error: Syntax error. Extra CASE" 

The only other way I can think of to do this would be a horrible series of if statements which check for the record type id and then each variation of the date mod.   I have about 5 other if clauses to add to this, just did not put everything in for the sake of clarity.

(I'm still new at this - could write this in Java/Grails - am tempted to turn the whole thing into a class?)

 
if (RecordTypeId == '012o00000003jkn')

				CASE( MOD( CreatedDate - DATE( 1900, 1, 7 ), 7 ),
					3, CreatedDate + 2 + 140,
					4, CreatedDate + 2 + 140,
					5, CreatedDate + 2 + 140,
					6, CreatedDate + 1 + 140,
					CreatedDate + 140
				) 

if (RecordTypeId = '012o00000003jks')
				CASE( MOD( CreatedDate - DATE( 1900, 1, 7 ), 7 ),
				    3, CreatedDate + 2 + 10,
				    4, CreatedDate + 2 + 10,
				    5, CreatedDate + 2 + 10,
				    6, CreatedDate + 1 + 10,
				    CreatedDate + 10
				)
CreatedDate


 
I have a background in custom application development and data model design.  I'm used to loading data with sql scripts or other programmatic means.

I'm not sure how best to load data into Salesforce.  I have a brand new instance with data where we have a many-to-many relationship between a custom object and Accounts.  I have to load in the Account data, and for each Account record, there are at least three entries in the custom object.  From what I have seen, my only options are to load the Account records, and then get those Account IDs, and manually copy each record ID into a spreadsheet (at least 3 times) in order to relate those Account records to each of the custom objects.  Then, load the entries for the custom objects, and get those IDs.  Last, a very painful manual step of mapping the ID's of the appropriate custom objects to the IDs of the Account objects in the spreadsheet.

Example:
Account ID 123
Associated Custom Objects IDs 111, 222, 333

Account ID 456
Associated Custom Objects IDs 333,444,555,666

Account ID 789
Associated Custom Objects IDs 111,222,333,444,555,666,777,888,999

What is the best way to do this?  Is there some 'database interface' that allows SQL-like script execution?

Links to tutorials, PDFs, etc appreciated!
I wanted to enforce a minimum price on an item and am managing it as a custom setting.  I have a validation rule checking it, but the text of the validation rule is not properly substituting the text of the custom setting variable reference.

Is this even possible?
First and foremost - THANK YOU for reading this.  I've been trying numerous ways to make this work and have even consulted with the guys in the office.  No one is quite sure what's going on. Online - can't find a lot of information on this, just one singular post that doesn't help me out a ton. 

What I'm trying to do is: modify the price of a Product (that has a schedule set on it) prior to insert on the Opportunity, in order to enforce a minimum price on the Product. Why am I doing it this way? Before setting the schedule on the product, a workflow rule was successfully enforcing the monthly minimum price on the product, using a custom setting.  After setting the schedule on the product,the workflow rule no longer worked. Trying to put a trigger on the OpportunityProduct object, before insert, to get around this.  (If anyone can tell me why the workflow rule stopped working once I set the schedule on the Product, and if it can be worked around, I'd gladly scrap this trigger route.)

When I attempt to add the qualifying product to the Opportunity, it throws this error:
Apex trigger EnforceMinimumPrice caused an unexpected exception, contact your administrator: EnforceMinimumPrice: execution of BeforeInsert caused by: System.InvalidParameterValueException: Invalid SetupOwner for Custom Settings: Price_Limits: Trigger.EnforceMinimumPrice: line 4, column 1 

The trigger code (note on line 4, I've also tried  getInstance('Price_Limits'):
trigger EnforceMinimumPrice on OpportunityLineItem (before insert) {
    for (OpportunityLineItem oli :  Trigger.new)    
    {
        Price_Limits__c priceLimits = Price_Limits__c.getInstance('Price Limits');
        Decimal MIN_MONTHLY_FEE = priceLimits.Min_Mnthly_Fee__c;
        if ( (oli.Product2.Name.equals('Hardcoded Product Name')) && 
             (oli.Quantity == 1) && 
             (oli.UnitPrice < MIN_MONTHLY_FEE)
           )
        {            oli.UnitPrice = MIN_MONTHLY_FEE;           }    } }

Here is an (obfuscated) screenshot of the custom settings:
Custom Settings Screen Shot

Thank you!
Select Id FROM Task 
 where What.RecordType.SObjectType='Opportunity' and
(What.CreatedDate >2015-05-23T11:59:59Z and What.CreatedDate <2015-05-25T00:00:00Z)
That is the query I am using. It seems fairly straightforward to me that only related entities of type Opportunity should be returned.

However, both DataLoader and DeveloperConsole return this error:

What.CreatedDate>2015-05-23T:11:59:59Z
^
ERROR at Row:3:Column:2
No such column 'CreatedDate' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name...."

Where am I goofing up?

THANK YOU!
I am trying to find campaign members for campaigns executed in last 2 years (not via Apex), in order to migrate this data (using Jitterbit).

I have tried couple different queries (from developer console) and can't seem to get the right query. Campaign is a lookup on CampaignMember, so should I not be able to use the __r notation to access?
 
SELECT Id, CampaignId, ContactId, CreatedById, CreatedDate, FirstRespondedDate, HasResponded, IsDeleted, LastModifiedById, LastModifiedDate, LeadId, Status, SystemModstamp 
FROM CampaignMember
where CampaignId = Campaign__r.id and Campaign__r.CreatedDate >= LAST_N_YEARS:2


 
I have a background in custom application development and data model design.  I'm used to loading data with sql scripts or other programmatic means.

I'm not sure how best to load data into Salesforce.  I have a brand new instance with data where we have a many-to-many relationship between a custom object and Accounts.  I have to load in the Account data, and for each Account record, there are at least three entries in the custom object.  From what I have seen, my only options are to load the Account records, and then get those Account IDs, and manually copy each record ID into a spreadsheet (at least 3 times) in order to relate those Account records to each of the custom objects.  Then, load the entries for the custom objects, and get those IDs.  Last, a very painful manual step of mapping the ID's of the appropriate custom objects to the IDs of the Account objects in the spreadsheet.

Example:
Account ID 123
Associated Custom Objects IDs 111, 222, 333

Account ID 456
Associated Custom Objects IDs 333,444,555,666

Account ID 789
Associated Custom Objects IDs 111,222,333,444,555,666,777,888,999

What is the best way to do this?  Is there some 'database interface' that allows SQL-like script execution?

Links to tutorials, PDFs, etc appreciated!
I wanted to enforce a minimum price on an item and am managing it as a custom setting.  I have a validation rule checking it, but the text of the validation rule is not properly substituting the text of the custom setting variable reference.

Is this even possible?
First and foremost - THANK YOU for reading this.  I've been trying numerous ways to make this work and have even consulted with the guys in the office.  No one is quite sure what's going on. Online - can't find a lot of information on this, just one singular post that doesn't help me out a ton. 

What I'm trying to do is: modify the price of a Product (that has a schedule set on it) prior to insert on the Opportunity, in order to enforce a minimum price on the Product. Why am I doing it this way? Before setting the schedule on the product, a workflow rule was successfully enforcing the monthly minimum price on the product, using a custom setting.  After setting the schedule on the product,the workflow rule no longer worked. Trying to put a trigger on the OpportunityProduct object, before insert, to get around this.  (If anyone can tell me why the workflow rule stopped working once I set the schedule on the Product, and if it can be worked around, I'd gladly scrap this trigger route.)

When I attempt to add the qualifying product to the Opportunity, it throws this error:
Apex trigger EnforceMinimumPrice caused an unexpected exception, contact your administrator: EnforceMinimumPrice: execution of BeforeInsert caused by: System.InvalidParameterValueException: Invalid SetupOwner for Custom Settings: Price_Limits: Trigger.EnforceMinimumPrice: line 4, column 1 

The trigger code (note on line 4, I've also tried  getInstance('Price_Limits'):
trigger EnforceMinimumPrice on OpportunityLineItem (before insert) {
    for (OpportunityLineItem oli :  Trigger.new)    
    {
        Price_Limits__c priceLimits = Price_Limits__c.getInstance('Price Limits');
        Decimal MIN_MONTHLY_FEE = priceLimits.Min_Mnthly_Fee__c;
        if ( (oli.Product2.Name.equals('Hardcoded Product Name')) && 
             (oli.Quantity == 1) && 
             (oli.UnitPrice < MIN_MONTHLY_FEE)
           )
        {            oli.UnitPrice = MIN_MONTHLY_FEE;           }    } }

Here is an (obfuscated) screenshot of the custom settings:
Custom Settings Screen Shot

Thank you!