• Michael Allen
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies
Hi,

I have filtered 'Related Lists' (actually Apex Tables) on Account. I need to do a 'nested' AND statement.

Query is as follows:
SELECT Id, Subject, LastModifiedDate FROM Task WHERE isClosed = FALSE and (NOT Subject LIKE'%Email: %') and OwnerId != '00520000002DBP2' ORDER BY ActivityDate DESC NULLS LAST LIMIT100];
I want to show all open Tasks, except Tasks owned by the specified user that have a Subject starting with 'Email: '

The problem is it excludes all Tasks owned by the User AND all Tasks where Subject starts with 'Email: '.
I want to do something akin to this:
SELECT Id, Subject, LastModifiedDate FROM Task WHERE isClosed = FALSE and
( (NOT Subject LIKE '%Email: %') and OwnerId != '00520000002DBP2' ) ORDER BY ActivityDate DESC NULLS LAST LIMIT 100];
...but can't find out any information on how to do it syntactically. Do I need to nest a whole other query in it?
Any help would be greatly appreciated.

Thanks
Hi All,

Bashing my head on a wall with ths one - should be straight forward, but can't see it.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

IF(ISBLANK({!Lead.Parent_Account__c})){
alert ("Opportunity Amount cannot be blank")
}
else{
window.open('/001/e?acc8={!Lead.Annual_Revenue_as_Number__c}&acc2={!Lead.Company}&00N20000001N2Sm={!Lead.Account_Territory__c}&acc7={!Lead.Industry}&acc10={!Lead.Phone}&acc12={!Lead.Website}&acc17street={!Lead.Street}&acc17city={!Lead.City}&acc17state={!Lead.State}&acc17zip={!Lead.PostalCode}&acc17country={!Lead.Country}&00N20000002MmaF={!Lead.NumberOfEmployees}&00N20000003SB9T={!Lead.Users_with_Admin_Rights__c}& 00N20000002t8Zx={!Lead.End_Point_Protection__c}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Mac OS") , "Mac OS" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Server 2003") , "Server 2003" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Server 2008") , "Server 2008" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Vista") , "Vista" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 2000") , "Windows 2000" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 7") , "Windows 7" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 8") , "Windows 8" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 8.1") , "Windows 8.1" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"XP") , "XP" , "")}&00N20000001z52Q={!Lead.Number_of_Desktops__c}&00N20000001z52V={!Lead.Number_of_Laptops__c}&00N20000003S1MU={!Lead.Macs__c}&00N20000002MauY={!Lead.Number_of_Servers__c}&00N20000009XcUR={!Lead.Id}&retURL=/{!Lead.Id}');
}
In short, I've got a detail page button on Lead that will create an Account thru the URL. Once I realised I needed valudation on it to prevent Accounts being created from Leads that were already associated to Accounts, I changed the button execute Javascript and added the IF statement above.
Problem is, I get this error:
missing ) after argument list
BUT.... if I reference a standard field in the statement (say, {!Lead.Phone}) I get
missing ; after argument list

I'm relatively new to the dev side of SF, and am stumped by this. Can anybody shed any light?

Appreciated as always.
Michael
Hi all,

I'm very new to Apex, but am convinced this scenario is possible. Problem is I can't find any examples anywhere, which surprises me.

I have a text field on Account called 'Originating_Lead__c' containing the 18 char ID of a Lead.

On the Lead is a lookup to Account.

I want to insert the ID of the Account record into the Account lookup field on the Lead record that corresponds to the ID held in the Originating_Lead__c field on Account.

I'm know I can't do this declaratively as it's "going down the tree", but I'm surprised this issue hasn't crept up before on here - have trawled right through and haven't found anything. Does anybody know of any examples of similar triggers for similar problems? 

Have browsed and used this community extensively but never posted a question - never needed to!

Thanks in advance.
Michael
Hi,

I have filtered 'Related Lists' (actually Apex Tables) on Account. I need to do a 'nested' AND statement.

Query is as follows:
SELECT Id, Subject, LastModifiedDate FROM Task WHERE isClosed = FALSE and (NOT Subject LIKE'%Email: %') and OwnerId != '00520000002DBP2' ORDER BY ActivityDate DESC NULLS LAST LIMIT100];
I want to show all open Tasks, except Tasks owned by the specified user that have a Subject starting with 'Email: '

The problem is it excludes all Tasks owned by the User AND all Tasks where Subject starts with 'Email: '.
I want to do something akin to this:
SELECT Id, Subject, LastModifiedDate FROM Task WHERE isClosed = FALSE and
( (NOT Subject LIKE '%Email: %') and OwnerId != '00520000002DBP2' ) ORDER BY ActivityDate DESC NULLS LAST LIMIT 100];
...but can't find out any information on how to do it syntactically. Do I need to nest a whole other query in it?
Any help would be greatly appreciated.

Thanks
Hi All,

Bashing my head on a wall with ths one - should be straight forward, but can't see it.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

IF(ISBLANK({!Lead.Parent_Account__c})){
alert ("Opportunity Amount cannot be blank")
}
else{
window.open('/001/e?acc8={!Lead.Annual_Revenue_as_Number__c}&acc2={!Lead.Company}&00N20000001N2Sm={!Lead.Account_Territory__c}&acc7={!Lead.Industry}&acc10={!Lead.Phone}&acc12={!Lead.Website}&acc17street={!Lead.Street}&acc17city={!Lead.City}&acc17state={!Lead.State}&acc17zip={!Lead.PostalCode}&acc17country={!Lead.Country}&00N20000002MmaF={!Lead.NumberOfEmployees}&00N20000003SB9T={!Lead.Users_with_Admin_Rights__c}& 00N20000002t8Zx={!Lead.End_Point_Protection__c}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Mac OS") , "Mac OS" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Server 2003") , "Server 2003" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Server 2008") , "Server 2008" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Vista") , "Vista" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 2000") , "Windows 2000" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 7") , "Windows 7" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 8") , "Windows 8" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"Windows 8.1") , "Windows 8.1" , "")}&00N20000001z52W={!IF(INCLUDES(Lead.Operating_System__c,"XP") , "XP" , "")}&00N20000001z52Q={!Lead.Number_of_Desktops__c}&00N20000001z52V={!Lead.Number_of_Laptops__c}&00N20000003S1MU={!Lead.Macs__c}&00N20000002MauY={!Lead.Number_of_Servers__c}&00N20000009XcUR={!Lead.Id}&retURL=/{!Lead.Id}');
}
In short, I've got a detail page button on Lead that will create an Account thru the URL. Once I realised I needed valudation on it to prevent Accounts being created from Leads that were already associated to Accounts, I changed the button execute Javascript and added the IF statement above.
Problem is, I get this error:
missing ) after argument list
BUT.... if I reference a standard field in the statement (say, {!Lead.Phone}) I get
missing ; after argument list

I'm relatively new to the dev side of SF, and am stumped by this. Can anybody shed any light?

Appreciated as always.
Michael
Hi all,

I'm very new to Apex, but am convinced this scenario is possible. Problem is I can't find any examples anywhere, which surprises me.

I have a text field on Account called 'Originating_Lead__c' containing the 18 char ID of a Lead.

On the Lead is a lookup to Account.

I want to insert the ID of the Account record into the Account lookup field on the Lead record that corresponds to the ID held in the Originating_Lead__c field on Account.

I'm know I can't do this declaratively as it's "going down the tree", but I'm surprised this issue hasn't crept up before on here - have trawled right through and haven't found anything. Does anybody know of any examples of similar triggers for similar problems? 

Have browsed and used this community extensively but never posted a question - never needed to!

Thanks in advance.
Michael