• Thomas Dvornik
  • NEWBIE
  • 405 Points
  • Member since 2011

  • Chatter
    Feed
  • 13
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 97
    Replies

Developer Console shows the Apex log.  But it reads it in via script and it isn't really part of the page.  The filter works but most of the time I do not want to file.  I just want to search for somethings and then scroll up and down.

 

Is there a way from the Dev Console to just the the log as a plain text web page, like in another web browser window?

 

Most of the time, I use Dev Console just to launch annonymous Apex and I have Debug Monitoring on in a browser window so I can get the log as an actual web page.

 

 

Hi,

 

I am trying to call a webservice method from whithin another webservice method from other class. I have tested the werbservices on Developer Console  and work fine. However the Apex code does not compile when adding the call from a webservice method class. Is there any restrinctions I am not aware of?

Here follows the webservices code:

 

 webservice static string batchTrxnLoadValidaion() {
             
    List<TRXN__c> oTxIt =
    [SELECT tx.Name, tx.Amount__c, tx.Type__c, tx.IMEI_IMEISV__c, tx.Mrch_Contract__c   
      FROM TRXN__c tx
      WHERE tx.id IN : Trigger.new 
      FOR UPDATE]; 
    for (TRXN__c Trx : oTxIt)   {
           id trxMember = Member.getMember(Trx.Mrch_Contract__c);
      //  more code here  .....

  

 

This is the Force.IDE message I get:

Save error: Method does not exist or incorrect signature: [String].getMember(String)

 

If I remove this statement the webservice compiles ok.

 

The method called getMember() follows:  (BTW: I tested it on Development Console and works fine)

 

 webservice static ID getMember(string mbContract) {
        ID mbMember = null;
        List<Member__c> activeMembers = [SELECT mb.Name, mb.Contract__c
                                         FROM Member__c mb WHERE mb.Status__c = 'Active'
                                         AND mb.Contract__c =: mbContract LIMIT 1];
        if (!activeMembers.isEmpty()) { mbMember = activeMembers[0].id;
                                      return mbMember;             
        }
        else { return null; }
   } 

 

Thanks for your help!

 

 

 

 

 

 

  • July 24, 2013
  • Like
  • 0

Yes, I'm new to the Salesforce Developer community. But I'm no dummy when it comes to programming and I'm at the end of my rope here. I've been through this 20 different ways now, using various methods I found online and I just cannot get this thing to work.

 

What I'm trying to do is set up an Email Service that creates a case... aka Custom Email-To-Case.

 

I created a sandbox, so that I could write the apex code. My sandbox was empty so I created one account with a contact matching the email address I'm looking for.

 

There are very, very good reasons for doing this...  but the APEX Class absolutely will not look up my contact. Its agonizing.

 

I have an email, lets say it goes like this

 

APEX TEST

From: test@test.com

 

I am able to read in the test@test.com into a string variable and system.debug can write it out correctly.

 

So I'm looking to get the ID of the contact, and the AccountID of the contact.

 

By all accounts, I should be able to do this to access these variables:

 

Linking by email address in variable (this is what I really want)

List<Contact> contacts = [select id from Contact where email = :FinalEmail];

 Linking by hard-coded email address

List<Contact> contacts = [select id from Contact where email = 'test@test.com'];

 Linking to accountID directly

List<Contact> contacts = [select id, AccountId, from Contact where accountId = '001P000000aYGwf'];

 I've tried the older method...

Contact [] contactArray3 = [Select Id, AccountId from Contact where Email =: ContactEmailFinal limit 1];

I've tried setting it to a string variable ....  and about 15 other things

 

But no matter what I do, Index of 0 is out of bounds, and I cannot use the lookups... It simply does not find the contact, ever.

 

The main result I'm looking for is that I can look up a contact, get the contact ID, and connect that to a case

sCase.ContactId = contacts.Id;

 Please help! I'm in so much pain right now. I just want it to work... Thanks in advance.

 

 

 

 

 

  • June 26, 2013
  • Like
  • 0

I am working on a class that will be incorporated into our project that helps build dynamic queries specific to our managed package's process. Everything was going fine until I saved my code and the Developer Console froze up. The mouse cursor wouldn't change, the menu stopped responding, everything. The only thing I could do was to close the Developer Console through the system's close button (but it didn't ask me to "End Process"). At this point, the tab where I was logged into my Developer Edition was also frozen; I had to close this tab as well using the tab's close button. I logged back in and went back to the console, and it immediately froze again. I managed to get the class closed in the Developer Console by hitting File > Close All as soon as the Developer Console popped up (and I still had to close the Console and Developer Edition a second time). This is the new Developer Console. Is there some known glitch?

Hi, 

I am new to Salesforce.com and just going through short language examples (in chap2 of APEX workbook) with Developer Console. Somehow I got DUPLICATE_VALUE: Failed to create createContainerMember for containerId=..." when the console kicks off. I also got  METHOD_NOT_ALLOWED "Unable to delete container member undefined: HTTP Method 'DELETE' not allowed....".

 

I am using Google Chrome on Windows 7. Please advise. Thanks! 

Hi folks,

 

Trying to deploy a really simple trigger and getting into problems - hope someone "out there" can help.

 

BTW, the Collaboration Group named "Technology Roadmap" does indeed exist in both sandbox and production envirtonments so the chatterGroups List variable should contain the single CollaborationGroup object. Instead, the test class errors with the message:

 

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, PostToChatterOnNewTechRoadmap: execution of AfterInsert caused by: System.ListException: List index out of bounds: 0 Trigger.PostToChatterOnNewTechRoadmap: line 9, column 1: []", Failure Stack Tra...

 

Trigger code:

 

trigger PostToChatterOnNewTechRoadmap on Technology_Roadmap__c (after insert) {

	CollaborationGroup chatterGroup;
	List<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup WHERE Name=:'Technology Roadmap' LIMIT 1];
	//if (chatterGroups.isEmpty()) {
	//	chatterGroup = new CollaborationGroup();
	//	chatterGroup.id = '0F9W0000000Cch3KAC';
	//} else {
		chatterGroup = chatterGroups[0];
	//}

	for (Technology_Roadmap__c trm : Trigger.new) {
		FeedItem fitem = new FeedItem();
		fitem.type = 'LinkPost'; //'TextPost,';
		fitem.ParentId = chatterGroup.id; //'0F9W0000000Ccge' = Sandbox; //'0F920000000PItQ' = Production;
		fitem.LinkUrl = '/' + trm.id;
		fitem.Title = 'New Technology Roadmap: ' + trm.Name;
		fitem.Body = 'Design Discipline: ' + ((trm.Design_Discipline__c != null) ? trm.Design_Discipline__c : 'Not specified')
					+ '\nCircuit Application: ' + ((trm.Circuit_Application__c != null) ? trm.Circuit_Application__c : 'Not specified')
					+ '\nSegment: ' + ((trm.Segment__c != null) ? trm.Segment__c + ((trm.Subsegment__c != null) ? ' => ' + trm.Subsegment__c : '') : 'Not specified');
		insert fitem;
	}

}

 

Test class:

 

@isTest
public class Test_trig_PostToChatterOnNewTechRoadmap{

	static testMethod void verifyPostToChatterOnNewTechRoadmap() {

		//CollaborationGroup chatterGroup = [SELECT Id FROM CollaborationGroup WHERE Name='Technology Roadmap' LIMIT 1];

		CollaborationGroup chatterGroup;
		List<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup WHERE Name=:'Technology Roadmap' LIMIT 1];
		if (chatterGroups.isEmpty()) {
			chatterGroup = new CollaborationGroup();
			chatterGroup.id = '0F9W0000000Cch3KAC';
		} else {
			chatterGroup = chatterGroups[0];
		}

		List<Technology_Roadmap__c> ltrm = new List<Technology_Roadmap__c>{};
		for (integer i=0; i<10; i++) {
			Technology_Roadmap__c trm = new Technology_Roadmap__c(Name = 'trigCoverageTest_' + i);
			trm.Design_Discipline__c = 'AC';
			System.debug('Name: ' + trm.Name);
			System.debug('Design Discipline: ' + trm.Design_Discipline__c);
			ltrm.add(trm);
		}

		test.startTest();
		insert ltrm;
		test.stopTest();

		List<FeedItem> lfi = [SELECT Title, Body FROM FeedItem WHERE ParentId = :chatterGroup.id ORDER BY Title];

		integer j = 0;
		string assTitle;
		for (FeedItem fi : lfi) {
			assTitle = 'New Technology Roadmap: trigCoverageTest_' + j++;
			System.debug(fi.Title);
			System.assertEquals(assTitle, fi.Title);
		}
	}
}

 

 

 

Hello all,

 

I having a hard time when trying to modify a apex code from the previous person that was working in my company. He was a developer and I'm not. My level in Apex is normal, I'm an administrator and I'm trying to pull this up because is kind of urgent for my company. 

 

We have a Scorecard system that will keep track of a number of fields from different objects. The scorecard object contains these cards for each account owner, contact related and leads.

 

 The all idea is that if you fill in a number of fields you will get a percentage in these scorecards. The scorecards have a page layout and in those page layouts you have fields that will keep track of the percentages. Lest say you fill in 50% of you phone field on you accounts, there is a field in your scorecard page layout with a field Account Phone Number Filled = 50%.  

This is done with a number of fields from different objects like I mentioned before. There is an apex schedule that will trigger the apex that update this scorecards every hour. 

 

This is the script: 

 

 

global class ScoreCardGenerator {

    global void processScoreCards() {

        final String RESOURCE_NAME_HAS = 'ScorecardQueriesHAS';
        final String RESOURCE_NAME_ALL = 'ScorecardQueriesALL';
    
        Map<String, Map<String, String>> scHASQueries = new Map<String, Map<String, String>>();
        Map<String, Map<String, String>> scALLQueries = new Map<String, Map<String, String>>();
        Map<Id, Score_Card__c> scoreCards = new Map<Id, Score_Card__c>();
        Map<String, String> fieldsToUpdateHAS = new Map<String, String>();
        Map<String, String> fieldsToUpdateALL = new Map<String, String>();
        StaticResource theStaticResource;
        List<Score_Card__c> updatedScoreCards = new List<Score_Card__c>();
        Set<Id> ownerIdKeys = new Set<Id>();
        Map<Id, Map<String, Double>> userHASResults = new Map<Id, Map<String, Double>>();
        Map<Id, Map<String, Double>> userALLResults = new Map<Id, Map<String, Double>>();
        DateTime todayDate = System.Now();
        DateTime startOfYear = DateTime.newInstanceGMT(todayDate.year(), 1, 1, 0, 0, 0);
        Integer currentHour = System.Now().hourGMT();

        try {
            theStaticResource = [SELECT id, Body FROM StaticResource WHERE name = :RESOURCE_NAME_HAS];
            String bodyText = theStaticResource.body.toString();
            List<String> bodyLines = bodyText.split('\n');
            for(String line : bodyLines) {
                if(line.trim().length() != 0) {
                    List<String> keyValuePairs = line.split('~');
                    String mapKey;
                    Map<String, String> tempMap = new Map<String, String>();
                    String objectName = '';
            
                    for(String pairString : keyValuePairs) {
                
                        // Some boilerplate splitting
                        List<String> pairs = pairString.split('#');
                        String key = pairs[0].trim();
                        String value = pairs[1].trim();
    
                        if (key == 'ID') {
                            mapKey = value;
                        }
                        else {
                            tempMap.put(key, value);
                        }
                        
                        if (key == 'OBJECT') {
                            objectName = value;
                        }   
            
                        if (key == 'FIELD') {
                            fieldsToUpdateHAS.put(value, objectName);
                        }
                    }
                    scHASQueries.put(mapKey, tempMap);
                }
            }
        } catch(System.QueryException e) {
            System.debug(e);
            // You should always let the admins/devs know if
            // something unexpected happened.
            // e.g. ExceptionUtils.mail(Administrator);
        }
           
        try {
            theStaticResource = [SELECT id, Body FROM StaticResource WHERE name = :RESOURCE_NAME_ALL];
            String bodyText = theStaticResource.body.toString();
            List<String> bodyLines = bodyText.split('\n');
            for(String line : bodyLines){
                if(line.trim().length() != 0) {
                    List<String> keyValuePairs = line.split('~');
                    String mapKey;
                    Map<String, String> tempMap = new Map<String, String>();
                    String objectName = '';
            
                    for(String pairString : keyValuePairs) {
            
                        // Some boilerplate splitting
                        List<String> pairs = pairString.split('#');
                        String key = pairs[0].trim();
                        String value = pairs[1].trim();
            
                        if (key == 'ID') {
                            mapKey = value;
                        }
                        else {
                            tempMap.put(key, value);
                        }
                        
                        if (key == 'OBJECT') {
                            objectName = value;
                        }   
            
                        if (key == 'FIELD') {
                            fieldsToUpdateALL.put(value, objectName);
                        }
                    }
                    scALLQueries.put(mapKey, tempMap);
                }
            }
        } catch(System.QueryException e) {
            System.debug(e);
            // You should always let the admins/devs know if
            // something unexpected happened.
            // e.g. ExceptionUtils.mail(Administrator);
        }   
        
        String businessUnitSalesTeam;
        if (currentHour == 0 || currentHour == 12) {
            businessUnitSalesTeam = 'Business_Unit__c = \'Benelux\'';
        }
        else if (currentHour == 1 || currentHour == 13) {
            businessUnitSalesTeam = 'Business_Unit__c = \'DACHI\' AND Sales_Team__c = \'Centre\'';
        }
        else if (currentHour == 2 || currentHour == 14) {
            businessUnitSalesTeam = 'Business_Unit__c = \'DACHI\' AND Sales_Team__c = \'North\'';
        }
        else if (currentHour == 3 || currentHour == 15) {
            businessUnitSalesTeam = 'Business_Unit__c = \'DACHI\' AND Sales_Team__c = \'South\'';
        }
        else if (currentHour == 4 || currentHour == 16) {
            businessUnitSalesTeam = 'Business_Unit__c = \'DACHI\' AND Sales_Team__c IN (\'Austria\', \'Dresden\', \'Italy\', \'Switzerland\')';
        }
        else if (currentHour == 5 || currentHour == 17) {
            businessUnitSalesTeam = 'Business_Unit__c IN (\'DB\', \'Consumer\', \'Hong Kong\')';
        }    
        else if (currentHour == 6 || currentHour == 18) {
            businessUnitSalesTeam = 'Business_Unit__c = \'Japan\'';
        }
        else if (currentHour == 7 || currentHour == 19) {
            businessUnitSalesTeam = 'Business_Unit__c = \'Spain\'';
        }
        else if (currentHour == 8 || currentHour == 20) {
            businessUnitSalesTeam = 'Business_Unit__c = \'UK\' AND Sales_Team__c = \'Key\'';
        }
        else if (currentHour == 9 || currentHour == 21) {
            businessUnitSalesTeam = 'Business_Unit__c = \'UK\' AND Sales_Team__c IN (\'Midlands\', \'MOD\')';
        }
        else if (currentHour == 10 || currentHour == 22) {
            businessUnitSalesTeam = 'Business_Unit__c = \'UK\' AND Sales_Team__c IN (\'North\', \'Telesales\')';
        }
        else if (currentHour == 11 || currentHour == 23) {
            businessUnitSalesTeam = 'Business_Unit__c = \'UK\' AND Sales_Team__c = \'South\'';
        }

    if (businessUnitSalesTeam != null) {
            for (Score_Card__c sc : Database.Query('Select Id, User__c FROM Score_Card__c WHERE Active__c = TRUE AND ' + businessUnitSalesTeam)) {
                scoreCards.put(sc.User__c, sc);
            }
        }
        ownerIdKeys = scorecards.keyset();
        for (Integer i = 1; i < scALLQueries.size()+1; i++) {
            String queryALL = scALLQueries.get(String.valueOf(i)).get('QUERYALL');
            for (AggregateResult arALL : Database.Query(queryALL + ' GROUP BY OwnerId ORDER BY OwnerId')) {
                Map<String, Double> tempMap = new Map<String, Double>();    
                if (userALLResults.containsKey(String.valueOf(arALL.get('OwnerId')))) {
                    tempMap = userALLResults.get(String.valueOf(arALL.get('OwnerId')));
                }
                tempMap.put(scALLQueries.get(String.valueOf(i)).get('OBJECT'), Double.valueOf(arALL.get('expr0')));
                userALLResults.put(String.valueOf(arALL.get('OwnerId')), tempMap);                      
            }
        } 
        for (Integer i = 1; i < scHASQueries.size()+1; i++) {
            String queryHAS = scHASQueries.get(String.valueOf(i)).get('QUERYHAS');
            for (AggregateResult arHAS : Database.Query(queryHAS + ' AND OwnerId IN :ownerIdKeys GROUP BY OwnerId ORDER BY OwnerId')) {
                Map<String, Double> tempMap = new Map<String, Double>();
                if (userHASResults.containsKey(String.valueOf(arHAS.get('OwnerId')))) {
                    tempMap = userHASResults.get(String.valueOf(arHAS.get('OwnerId')));
                }
                tempMap.put(scHASQueries.get(String.valueOf(i)).get('FIELD'), Double.valueOf(arHAS.get('expr0')));
                userHASResults.put(String.valueOf(arHAS.get('OwnerId')), tempMap);
            }
        }
        for (Id userId : ownerIdKeys) {
            SObject updateSC = scoreCards.get(userId);
            Set<String> hasFieldNames = fieldsToUpdateHAS.keySet();
            Set<String> allFieldNames = fieldsToUpdateALL.keySet();
            for (String field : hasFieldNames) {

        /*
                if (!userHASResults.get(userId).containsKey(field) || !userALLResults.get(userId).containsKey(fieldsToUpdateHAS.get(field)) || fieldsToUpdateHAS.get(field) == null) {
                  
                    updateSC.put(field, 0);
                }
        */
              if (fieldsToUpdateHAS.get(field) != null && !userALLResults.get(userId).containsKey(fieldsToUpdateHAS.get(field))) {
                updateSC.put(field, 100);
              }
                else if (!userHASResults.get(userId).containsKey(field) || fieldsToUpdateHAS.get(field) == null) {
                    updateSC.put(field, 0);
                }
                else {
                    updateSC.put(field, (userHASResults.get(userId).get(field) / userALLResults.get(userId).get(fieldsToUpdateHAS.get(field))) * 100);
                }
            }
            for (String field : allFieldNames) {
                if (!userALLResults.get(userId).containsKey(fieldsToUpdateALL.get(field))) {
                    updateSC.put(field, 0);
                }
                else {
                    updateSC.put(field, userALLResults.get(userId).get(fieldsToUpdateALL.get(field)));
                }
            }
            updatedScoreCards.add((Score_Card__c)updateSC);
        }       
        if (!updatedScoreCards.isEmpty()) { 
            update(updatedScoreCards);
        }
    } 
}

 

 

What I want is just to add another field in the scorecard object to track the Name in the Contact object.  I noticed that on the scrip there are two lines:

 

        final String RESOURCE_NAME_HAS = 'ScorecardQueriesHAS';
        final String RESOURCE_NAME_ALL = 'ScorecardQueriesALL';

 

These two lines are very important becasue they contain the query for the fields that are in the scorecards.

Here it is one of the files (ScorecardQueriesHAS):

 

ID#1~OBJECT#Event~FIELD#Events_with_Comments__c~QUERYHAS#SELECT OwnerId  count(Subject) FROM Event WHERE StartDateTime >= :startOfYear AND EndDateTime <= :todayDate AND Sales_Comments__c != '',,
ID#2~OBJECT#Account~FIELD#Accounts_with_Address__c~QUERYHAS#SELECT ownerId count(Name) FROM Account WHERE BillingStreet != '' AND BillingCity != '' AND BillingPostalCode != '' AND BillingCountry != '', ,
ID#3~OBJECT#AccountExact~FIELD#Accounts_with_Exact_Debtor_Number__c~QUERYHAS#SELECT OwnerId count(Name) FROM Account WHERE Id IN (SELECT AccountId FROM Opportunity WHERE IsWon = true AND RecordTypeId != '01280000000PydL') AND Exact_Debtor_Number__c != '',,
ID#4~OBJECT#Account~FIELD#Accounts_with_Segmentation__c~QUERYHAS#SELECT ownerId count(Name) FROM Account WHERE ((Industry != '' AND Life_Segment__c != '' AND Sub_Sector__c != '') OR (Segment__c != '' AND Industry__c != '' AND Dimension__c != '' AND Organization__c != '')), ,
ID#5~OBJECT#Account~FIELD#Accounts_with_Status__c~QUERYHAS#SELECT ownerId count(Name) FROM Account WHERE Account_Status__c != '', , ID#6~OBJECT#Account~FIELD#Accounts_with_Territory__c~QUERYHAS#SELECT ownerId count(Name) FROM Account WHERE Territory__c != '', , ID#7~OBJECT#Account~FIELD#Accounts_with_Zone__c~QUERYHAS#SELECT ownerId count(Name) FROM Account WHERE Zones__c != '',, ID#8~OBJECT#Account~FIELD#Accounts_with_Phone_Number__c~QUERYHAS#SELECT ownerId count(Name) FROM Account WHERE Phone != '', , ID#9~OBJECT#Account~FIELD#Contacts_with_Email_Address__c~QUERYHAS#Select ownerId COUNT(Name) FROM Account WHERE Id IN (SELECT AccountId FROM Contact WHERE Email != '' AND RecordTypeId != '01280000000PydJ'),,
ID#10~OBJECT#OpportunityProduct~FIELD#Open_Opportunities_with_Products__c~OBJECT#Opportunity~QUERYHAS#SELECT ownerId count(Name) FROM Opportunity WHERE IsClosed = FALSE AND HasOpportunityLineItem = true AND StageName NOT IN ('F- First Phase Open' 'P - Qualified Prospect'), ,
ID#11~OBJECT#Opportunity~FIELD#Open_Opportunities_with_Net_Revenue__c~QUERYHAS#SELECT OwnerId count(Name) FROM Opportunity WHERE IsClosed = FALSE AND Net_Revenue__c != NULL,,
ID#12~OBJECT#Account~FIELD#Contact_with_First_Name__c~QUERYHAS#Select ownerId COUNT(Name) FROM Account WHERE Id IN (SELECT AccountId FROM Contact WHERE Name != '' AND RecordTypeId != '01280000000PydJ'),,

 I added the last line ID#12. 

The first think that I'm not sure is when I try to view ScorecardQueriesHAS from the the Static Resources. I see that the file is a 

MIME Typeapplication/vnd.ms-excel

 and if I click on View file, I get a file and when I try to open this file I get the msg in excel: 'Excel has detected that 'ScorecardQueriesHAS (11).xls' is a SYKL file, but cannot load it. Either the file has errors or it is not a SKYLK file format.'

 

I beileve this is a csv file but I was wondering if there is any particular way to save this files or to modify them, because when I modified the file and put it back to the static resourcers the line ID#12 is not doing what it is suppose to do.

 

So, I need to know what I'm doing wrong here in order for me to be able to modify this. Any ideas?

 

One more question :( , I have to wait about one hour to see if there is any luck after making any modification. There is a way to execute this from the Developer Console?

 

Thanks in advance.

 

 

 

When using Firefox 18, users can't open developer console at all.

 

However, it's ok when using with chrome and IE, and also Firefox 18 safe mode.

 

Even clear all of historial data and cookies, and disable all of plugins and extensions it is unable to open developer console well.

 

Firefox 18 can only open developer console by safe mode.

Hello there,

 

In my project, I have sites to use customer portal. Now, I want to access the debug log through Developer Console but I am not able to do so. Is there any other way to get this debug log?? Please help!

 

Help will be really appreciated.

 

Thank you.

  • December 13, 2012
  • Like
  • 0

Hi, 

 

I would like to copy the value from one field to another automatically.
I made the following code, but it does not run.
Someone must help me?

 

<apex:page standardController="Opportunity" id="page1" >

<apex:sectionHeader title="Test"/>
<apex:messages />
<apex:form id="form1">
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" title="Salvar" value="Salve"  />
<apex:commandButton action="{!cancel}" title="Cancelar" value="Cancel" />
</apex:pageBlockButtons>



<apex:panelGrid columns="2">
<apex:outputLabel >Client:</apex:outputLabel>
<apex:inputField value="{!Opportunity.AccountId}" required="true" id="campo2" />
<apex:outputLabel > Name: </apex:outputLabel>
<apex:inputField value="{!Opportunity.name}" id="campo1" onblur="copyT()" />
<apex:outputLabel > Stage: </apex:outputLabel>
<apex:inputField value="{!Opportunity.StageName}" />
<apex:outputLabel > Date: </apex:outputLabel>
<apex:inputField value="{!Opportunity.CloseDate}" />

</apex:panelGrid>

</apex:pageBlock>
</apex:form>  

<script type="text/javascript">
        function copyT(){
                valor = document.getElementById('{!$Component.campo1}').value;
                
                    document.getElementById('{!$Component.campo2}').value = valor;
            }
           
    </script>

  
</apex:page>

 

Over the last 2-3 days I've been getting the following message when trying to a query through the developer console in Salesforce.

 

Response to EXEC to /_ui/common/apex/debug/ApexCSIAPI was : -1, transaction aborted

 

I am on na3 instance. Anyone have any ideas?

Hello,

I am not able to save my components or refresh my components from Server via Eclipse IDE for Force.com after I updated to Winter 12. I always get Connection Timeout exception. 

 

java.net.SocketTimeoutException: connect timed out
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
	at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:133)
	at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
	at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:92)
	at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:88)
	at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
	at com.sforce.soap.metadata.MetadataConnection.describeMetadata(MetadataConnection.java:345)
	at com.salesforce.ide.core.remote.MetadataStubExt.describeMetadata(MetadataStubExt.java:303)
	at com.salesforce.ide.core.remote.MetadataStubExt.describeMetadata(MetadataStubExt.java:311)
	at com.salesforce.ide.core.remote.MetadataStubExt$$FastClassByCGLIB$$9404e285.invoke(<generated>)
	at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
	at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
	at com.salesforce.ide.core.internal.aspects.MetadataOperationsRetryAspect.metadataOperationsRetry(MetadataOperationsRetryAspect.java:22)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
	at com.salesforce.ide.core.remote.MetadataStubExt$$EnhancerByCGLIB$$c1ac1f9d.describeMetadata(<generated>)
	at com.salesforce.ide.core.services.MetadataService.getDescribeMetadata(MetadataService.java:54)
	at com.salesforce.ide.core.services.PackageDeployService.adjustDeployOptions(PackageDeployService.java:300)
	at com.salesforce.ide.core.services.PackageDeployService.deployWork(PackageDeployService.java:264)
	at com.salesforce.ide.core.services.PackageDeployService.deploy(PackageDeployService.java:144)
	at com.salesforce.ide.core.services.PackageDeployService.deploy(PackageDeployService.java:127)
	at com.salesforce.ide.core.services.PackageDeployService.deploy(PackageDeployService.java:111)
	at com.salesforce.ide.ui.actions.SaveToServerActionController.deploy(SaveToServerActionController.java:132)
	at com.salesforce.ide.ui.actions.SaveToServerActionController.saveResourcesToServer(SaveToServerActionController.java:114)
	at com.salesforce.ide.ui.actions.SaveToServerAction$1.execute(SaveToServerAction.java:63)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

 Please let me know if anyone has the similar problem.

 

i am running WIndows 7 professional, Eclipse Indigo R1 and have latest Force.com IDE plugin available.

 

 

Hi All,

 

Just want to share my concerns with the Developer Console. 

Yesterday I was working on some Classes and Triggers but I needed to start coding 3 times (I know right?).

 

When I was working and writing code, I continuously saved the code and performed some testing. All seemed to be fine until on one moment, the code I had written an hour before, disappeared. Reopening the console, looking in Eclipse, checking on the Admin Menu, nothing. Developments just disappeared. 

 

This happened to me 3 times!!!! Luckily I started to save my code using Eclipse and Subversion. But nevertheless, quiet annoying and not motivating in using this tool.

 

Any ideas what could be the problem or just a general issue?

 

For your information: was using latest version of Chrome/FireFox (both same problem). Internet connection was up.

 

Kind Regards,

R

  • October 30, 2013
  • Like
  • 0

Developer Console shows the Apex log.  But it reads it in via script and it isn't really part of the page.  The filter works but most of the time I do not want to file.  I just want to search for somethings and then scroll up and down.

 

Is there a way from the Dev Console to just the the log as a plain text web page, like in another web browser window?

 

Most of the time, I use Dev Console just to launch annonymous Apex and I have Debug Monitoring on in a browser window so I can get the log as an actual web page.

 

 

I heard a rumor that setup is moving to Dev Console.  Anyone thing it's true?

 

Please say it ain't so.

 

I really am not at all impressed with Dev Console.

 

First, javascript in a web browser is just not a robust architecture.  It's slow. It hangs.  I loses some of the regular old browser features.

 

Second, the best thing about SF it it is mostly just web pages retrieved with HTTP gets.  That makes it simple and reliable.  It lets you cut and paste links.  So  you want another developer to look at a field definition, just copy the URL.  You want the same window, a new tab, a new tab, just click or right-click and pick where you want the link target in to appear.

 

 

Very strange. I'm developing a trigger that sends me an email, and I have been debugging it by monitoring myself in the Debug. Now (this is really weird), suddenly, after running my trigger and deleting the accumulated logs, I am no longer able to monitor myself!! I am able to add any other user in the system, except myself.

 

Could I have hit some kind of limit?

 

Hi,

 

I am trying to call a webservice method from whithin another webservice method from other class. I have tested the werbservices on Developer Console  and work fine. However the Apex code does not compile when adding the call from a webservice method class. Is there any restrinctions I am not aware of?

Here follows the webservices code:

 

 webservice static string batchTrxnLoadValidaion() {
             
    List<TRXN__c> oTxIt =
    [SELECT tx.Name, tx.Amount__c, tx.Type__c, tx.IMEI_IMEISV__c, tx.Mrch_Contract__c   
      FROM TRXN__c tx
      WHERE tx.id IN : Trigger.new 
      FOR UPDATE]; 
    for (TRXN__c Trx : oTxIt)   {
           id trxMember = Member.getMember(Trx.Mrch_Contract__c);
      //  more code here  .....

  

 

This is the Force.IDE message I get:

Save error: Method does not exist or incorrect signature: [String].getMember(String)

 

If I remove this statement the webservice compiles ok.

 

The method called getMember() follows:  (BTW: I tested it on Development Console and works fine)

 

 webservice static ID getMember(string mbContract) {
        ID mbMember = null;
        List<Member__c> activeMembers = [SELECT mb.Name, mb.Contract__c
                                         FROM Member__c mb WHERE mb.Status__c = 'Active'
                                         AND mb.Contract__c =: mbContract LIMIT 1];
        if (!activeMembers.isEmpty()) { mbMember = activeMembers[0].id;
                                      return mbMember;             
        }
        else { return null; }
   } 

 

Thanks for your help!

 

 

 

 

 

 

  • July 24, 2013
  • Like
  • 0

We have three lookup fields on our Account page to a custom object we created called 'Partners':

 

Email_Provider__c

Social_Media_Management__c

Facebook_Ad_Platform__c

 

 

 

We also have a junction object called 'Account/Partner Relationship' that includes a lookup field to Accounts and a lookup field to Partners.

 

Basically, if someone populates one of those three look-up fields I listed at the top, we want a new Account/Partner Relationship record to be created with the Account being populated in the account look-up field and partner chosen in the partner look-up field.

 

I'm assuming We need a trigger to do this, but I have zero experience with APEX code. Any help would be greatly appreciated. Let me know if you need more information from me.

 

Thanks!

 

Hi,

 

It appears that my session in the Development Console is running cached code. After I make a code change, and save it, then rerun I am not seeing the new code change.

 

Is there a way to flush the old cache out of memory?

 

Thanks.

  • July 17, 2013
  • Like
  • 0

Hi,

I am trying to debug a permissions issue in my apex code, it only happens when the user has only got access to the contact through a sharing rule.

 

So I use the login from the list of users to login as the restricted user.

But when I then go to the developer console I get the message "Error loading configuration: Server Error"

 

I don't have the developer console available when I log in straight as the restricted user, because giving him "View all data" would hide the error.

 

How do I get rid of the "Server error" message?

 

I need to write SOQL queries to retrieve Chatter posts. I dont see a Developer tab under my name. I am in my companys sandbox environment. It is a full Sandbox. How can I get Developer Console?

Yes, I'm new to the Salesforce Developer community. But I'm no dummy when it comes to programming and I'm at the end of my rope here. I've been through this 20 different ways now, using various methods I found online and I just cannot get this thing to work.

 

What I'm trying to do is set up an Email Service that creates a case... aka Custom Email-To-Case.

 

I created a sandbox, so that I could write the apex code. My sandbox was empty so I created one account with a contact matching the email address I'm looking for.

 

There are very, very good reasons for doing this...  but the APEX Class absolutely will not look up my contact. Its agonizing.

 

I have an email, lets say it goes like this

 

APEX TEST

From: test@test.com

 

I am able to read in the test@test.com into a string variable and system.debug can write it out correctly.

 

So I'm looking to get the ID of the contact, and the AccountID of the contact.

 

By all accounts, I should be able to do this to access these variables:

 

Linking by email address in variable (this is what I really want)

List<Contact> contacts = [select id from Contact where email = :FinalEmail];

 Linking by hard-coded email address

List<Contact> contacts = [select id from Contact where email = 'test@test.com'];

 Linking to accountID directly

List<Contact> contacts = [select id, AccountId, from Contact where accountId = '001P000000aYGwf'];

 I've tried the older method...

Contact [] contactArray3 = [Select Id, AccountId from Contact where Email =: ContactEmailFinal limit 1];

I've tried setting it to a string variable ....  and about 15 other things

 

But no matter what I do, Index of 0 is out of bounds, and I cannot use the lookups... It simply does not find the contact, ever.

 

The main result I'm looking for is that I can look up a contact, get the contact ID, and connect that to a case

sCase.ContactId = contacts.Id;

 Please help! I'm in so much pain right now. I just want it to work... Thanks in advance.

 

 

 

 

 

  • June 26, 2013
  • Like
  • 0

string s = '|'+'Test';
system.debug(Logginglevel.ERROR,'::::s3:::::::'+s);

 

Output:

::::s3:::::::&#124;Test

 

Expected Output:

::::s3:::::::    |Test

 Is it possible to get the above output?

Okay, so I have been trying fruitlessly, for awhile now, to wrap my head around the Javascript API that is provided for the Salesforce Sales app. I've opened a number of tickets, scoured StackOverflow, watched a number of videos, read some articles I've found on the main saiesforce website, all to answer a few simple questions. Perhaps I haven't taken the time to fully educate myself on the platform, fine, but given the extreme simplicity of what I'm trying to do, the labyrinthian, outdated developer pages have been a huge pain.

 

With that aside, perhaps someone here can answer the following questions for me.

 

A) What is the current version of the AJAX library? 

 

Admittedly, this is the least of my problems, and hasn't been much of an issue thus far. With that said however, I'm amazed at how difficult finding an answer to this has been. All over the Salesforce documentation, I've found references to different versions in the 

{!REQUIRESCRIPT} statement. A quick Google search brought me to this page: http://www.salesforce.com/us/developer/docs/ajax/ but, when I try to include it, I get a 404 error in the console. 

 

 

B) What on Earth is "{!...}" supposed to mean?

 

I've noticed that any Javascript I write will first be fed through a preprocessor in order to provide more convenient interfaces with the API. Fine. But am I doing with them exactly? What is the difference between the same expression the form of a string "{!Foo.id}" and not {!REQUIRESCRIPT..}? Nowhere in the documentation have I seen this addressed.

 

 

C) How can I modify fields through javascript?

 

This is along the same lines as the previous question. I take it that these "{!...}" expressions will allow me to interface with the api. Specifically, what I would like to do is modify a field value on button click. This has been difficult simply because I don't understand the method in which I can access fields. What is in the global scope? What objects can I access? How do I access them? 

 

I've tried the following:

 

    // Maybe I object is in the global scope

    console.log(Case)

 

    // Oops! Hmm, maybe I can access it with those strange {!...} expressions

    console.log({!Case})

    console.log("{!Case}")

 

    // No dice... but oddly enough "{!Case.id}" works... what the hell?

    // I have to create an "SObject" ...?

    var foo = new sforce.SObject("Case"); // not sure what the parameters are, but all examples I've seen do something similar...

    

    // Okay, now maybe I can access the desired fields from my Object

    > foo.get("MyField__c")

    null

    

     // Drat! Maybe it's expecting the label...

     >foo.get("MyField")

     null

 

Sorry if I've come off a bit rude or irritated, but after speaking with multiple people over the phone, had multiple tickets closed without my input, and hours of searching, I've lost patience.

 

Thanks

 

    

I am working on a class that will be incorporated into our project that helps build dynamic queries specific to our managed package's process. Everything was going fine until I saved my code and the Developer Console froze up. The mouse cursor wouldn't change, the menu stopped responding, everything. The only thing I could do was to close the Developer Console through the system's close button (but it didn't ask me to "End Process"). At this point, the tab where I was logged into my Developer Edition was also frozen; I had to close this tab as well using the tab's close button. I logged back in and went back to the console, and it immediately froze again. I managed to get the class closed in the Developer Console by hitting File > Close All as soon as the Developer Console popped up (and I still had to close the Console and Developer Edition a second time). This is the new Developer Console. Is there some known glitch?

I finally got around to watching the adv testing and debugging webinar.  The new developer console looks to be greatly improved from the old one (which I was never able to make heads or tails of).  However, I noticed that some of the windows have scroll bars that will auto-magically scroll back up to the top of the window.  I am seeing this in the window when I look at class or trigger source code...scroll down by dragging the bar and when you let it go it scrolls back up to the top.  In fact it does this even if you do not let the bar go.  It is annoying and makes it almostt impossible to inspect the code, code coverage results, etc.

 

I am using Chrome on Windows.  Any one else seeing this?

Developer console looks a bit different.

 

I'm not complain'   :-)

 

Where can I find some docs or release notes about what they are doing with it?

 

 

Hello,

 

I'm trying to avoid duplicate sobjects in my list of sobjects that I submit for update/delete/insert.  I realized that Sets are great for this.  The documentation states the following concerning uniqueness of sObjects in Sets:

 

http://www.salesforce.com/us/developer/docs/apexcode/index.htm

 

"Uniqueness of sObjects is determined by IDs, if provided. If not, uniqueness is determined by comparing fields. For example, if you try to add two accounts with the same name to a set, only one is added"

 

However, in my experience, this is not the case.  In the following example, I have provided the ID of the opportunities, but after changing one field, both opportunities are still added to the Set.  This is not the expected behavior because the ID of the opportunities are supplied and identical.

 

 

Opportunity opp1 = [Select Id from Opportunity Where  Id = '006Q00000054J7u'];
Set<Opportunity> opps = new Set<Opportunity>(); 
opps.add(opp1); 
opp1.Name = 'Something new';
opps.add(opp1);
System.debug('SIZE: ' + opps.size()); //prints 2, expect 1

 

 

 

What am I doing wrong?  Is this an API version issue?  I believe I'm using api version 19.0.

 

I will need to rewrite a lot of code if the Set uniqueness does not work as advertised.

 

Thanks for any help you might provide,

 

Andrew