• andremsalgado
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hello Folks,

Actually this is more than a doubt than a discussion...

I've been working with Salesforce Development more than 03 years and I never get why to use ":" to do variables comparison, like the following :

Sample 1:
List<AnyObject__c> objC = [Select id FROM AnyObject__c WHERE year__c = '1994'];

Sample 2:
String yearSample = '1994';
List<AnyObject__c> objC = [Select id FROM AnyObject__c WHERE year__c =: yearSample];
Yes, I know the both Samples Work and I'm already accustomed to write this way... But it does really grinds my gears!!

Could anyone explain me why? And Kill my curiosity?

Wish all the best! Thank you in advance!

Gentlemen,

 

I am facing the problem with the following query:

 

Select  Id,

              Lookupfield_Table01__c,

              Lookupfiled_Table02__c  

 

             FROM  CustomObject01__c

             WHERE

                      Lookupfield_Table01__c IN (Select Id FROM CustomObject02__c Where CustomFiled01__c = true) AND

                      Lookupfiled_Table02__c IN (Select Id FROM Account Where CustomFiled02__c = false)

 

On error occurs, telling my there are too many SOQL steatmans.

 

Does anybody know some other way to write this query?

 

Thank you in advance,


André Salgado

 

 

 

 

 

 

 

Gentlemen,

 

I created a button with a script similar function "Change Owner" that I found in internet, the difference is that it only takes the case when this case is in a queue. Blocking I take cases from other users.

 

The problem is that when a user who does not have full access to function if this function does not perform.

 

Could anyone help me in this problem? Maybe run this function in adminitrador mode?

 

Thank you in advance.

 

Regards,

André Salgado

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var records = {!GETRECORDIDS($ObjectType.Case)};
var userId = "{!$User.Id}";

var updateRecords = [];
var updateRecordsOther = [];
var updateRecordsSelf= [];
var queryResults = sforce.connection.retrieve("CaseNumber, Id, OwnerId,Owner.Type", "Case", records);

for (var caseIndex=0;caseIndex<queryResults.length;caseIndex++)
{
	var caseObj = queryResults[caseIndex];
				  
	var CaseNum = caseObj.CaseNumber;
	var caseID= caseObj .Id;
	var ExistingOwner = caseObj.OwnerId;

	if (ExistingOwner == '00GU0000000P2gSMAS') 
	{
	   
	 //Otherwise accept it
	var caseUpdate = new sforce.SObject("Case");

	caseUpdate.Id = caseID;
	caseUpdate.OwnerId = userId;
	updateRecords.push(caseUpdate);
	}
	else
	{
		if ('{!JSENCODE($User.Id )}' != '{!JSENCODE( Case.OwnerId )}') 
		{
            updateRecordsOther.push(1);
			
		}else
		{
            updateRecordsSelf.push(1);			
	   }
   }
}

if (updateRecordsOther.length>0) 
{	
	alert('Its already have an owner');
}

if (updateRecordsSelf.length>0) 
{
	
}

if (updateRecords.length>0) 
{
	sforce.connection.update(updateRecords);
	
	alert( updateRecords.length + ' Case to: ' + '{!JSENCODE($User.FirstName )}' + ' ' + '{!JSENCODE( $User.LastName )}');
	window.location.reload();
}

 

Hello Folks,

Actually this is more than a doubt than a discussion...

I've been working with Salesforce Development more than 03 years and I never get why to use ":" to do variables comparison, like the following :

Sample 1:
List<AnyObject__c> objC = [Select id FROM AnyObject__c WHERE year__c = '1994'];

Sample 2:
String yearSample = '1994';
List<AnyObject__c> objC = [Select id FROM AnyObject__c WHERE year__c =: yearSample];
Yes, I know the both Samples Work and I'm already accustomed to write this way... But it does really grinds my gears!!

Could anyone explain me why? And Kill my curiosity?

Wish all the best! Thank you in advance!

Gentlemen,

 

I am facing the problem with the following query:

 

Select  Id,

              Lookupfield_Table01__c,

              Lookupfiled_Table02__c  

 

             FROM  CustomObject01__c

             WHERE

                      Lookupfield_Table01__c IN (Select Id FROM CustomObject02__c Where CustomFiled01__c = true) AND

                      Lookupfiled_Table02__c IN (Select Id FROM Account Where CustomFiled02__c = false)

 

On error occurs, telling my there are too many SOQL steatmans.

 

Does anybody know some other way to write this query?

 

Thank you in advance,


André Salgado