• Chiz
  • NEWBIE
  • 164 Points
  • Member since 2011

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 58
    Replies

 

Hi,

 

I ahve written some Apex Classes in Sandbox. But when i go to the Setup->App Setup->Develop->Apex Classes page i cannot be able to see the classes. I think this is happening after refreshing sandbox. Please help me to see the Apex Classes i have written. I want to delete some.

 

Thanks and Regards

Hari G S

Hi

    Trying to use an array to give a field a value based on the url element 'form' which i have used from a previous page.

I cant seem to get the right format for the for loop, ths code below throws up, Compile Error: Loop must iterate over a collection type: Integer. Am a bit lost as to what to do. Please help if you can, thanks.

 

   String[] mystrings = new String[]{'SIS__c', 'MSQ__c', 'PDQ_39__c'};
    String[] mystring2 = new String[]{'StrImp', 'MSquiz', 'PDQ'};
    public void PNExtMethod(){
        for(Integer i : mystrings.size()){
            if (ApexPages.currentPage().getParameters().get('form') == mystrings[i]){
                System.debug(i);
                pn.Relobject__c = mystring2[i];
            }
        }
    }*

Hi All,

 

       I need to know is it possible to sort aggregate results in sorting?

 

 

Thanks

I've found ApexDoc here -- http://code.google.com/p/apexdoc/

 

I think it is supposed to be an Eclipse plugin.

 

I tried using the Install New Software option in eclipse and pointed it to a jar but I get a "No repository found" error.

 

Anyone know if this is indeed supposed to be installable in Eclipse?

 

If not, how to run it stand alone.

 

 

HI,

 

I am scratching my head hard on this one.  What seemed very simple -- I get zero coverage!  Does anyone have an idea what I am doing wrong?  Thanks

@isTEST
private class Utils_TEST {
    static testMethod void test_1() {        
        User currentUser = new User();
        currentUser = [ Select email, Name , id from User where username = :UserInfo.getUserName() limit 1 ];        
        List<String> toAddresses = new List<String> {currentUser.Email};
        String replyToAddress = currentUser.Email;  
        Test.StartTest();      
        Utils.EmailUtil email = new Utils.EmailUtil(toAddresses);
        email.plainTextBody('Utils.EmailUtil Test');
        email.htmlBody('Utils.EmailUtil Test');
        email.senderDisplayName(currentUser.Name);
        email.subject('Utils.EmailUtil Test');
        email.replyTo(replyToAddress);
        email.bccAddresses(toAddresses);
        email.sendEmail();
        Test.StopTest();
    }
}

 

 

 

 

Is it possible to customize an e-mail which is sent after an event was created?

  • May 03, 2012
  • Like
  • 0

Is there a way to create an Event with some number of invitees from Apex?

Simple

Event e = new Event(any params here);
insert e;

 doesn't help. It can create an event but there is no possibility to add invitees programmaticaly.

 

It can be done from UI only. All we can do is to pre-fielled ids of users we want to invite to this event. But currently logged in user must push Save & Send Update button to create an event and send invitation e-mails to invitees.

 

What we think as workaround is to perform the same http POST request as SF perform after user clicks this button.

I tried to achieve this using HttpRequest class as well as PageReference. But no luck.

 

Maybe anyone had better luck than me?

  • May 02, 2012
  • Like
  • 0

Hi SF developers,

 

I've faced with one interesting issue which I can't manage by myself.

 

Please imagine the situation when you have an custom object with custom fields "Type__c" as a picklist and custom field "Contact__c" as a lookup on Contacts. Standard SF' Contact object in turn has it's custom field named "Type__c". I've done simple lookup filter for Contact__c field for my superior custom object - [superior object] Contact Type equals Contact: Type.

 

Going further.

 

I have VF page.


<apex:pageBlockTable value="{!superiorObjects}" var="so" >
                 
                  <apex:column >
                      <apex:facet name="header"><b>Contact Type</b></apex:facet>
                      <apex:inputField value="{!so.Contact_Type__c}" />
                  </apex:column>
                  <apex:column >
                      <apex:facet name="header"><b>Contact Name</b></apex:facet>
                      <apex:inputField value="{!so.Contact__c}" styleClass="contactName"/>
                  </apex:column>                                      
             </apex:pageBlockTable>

 

It works fantastic. It filters contacts by selected type. It is great.

BUT. Imagine next steps:

1) select type A;

2) select contact;

3) change type to B.

 

And after this I have a question: how to clear contact name automatically? User can do it manually. Neither by selecting input field and clear text in it or by opening lookup window and clear filter there. It will work fine. But is there a way to do it automatically?

 

If it was not a table I would use an <apex:actionSupport> component. But I don't know how to use it for the table. I can't set id for each inputField in each row for Contact name column and tell actionSupport to clear specific id when change the value in type combo box.

 

Can someone advise me some solution for automatic clear in the <apex:pageBlockTable>?

  • December 02, 2011
  • Like
  • 0

Hi all,

I have a new question from a quiz:

 

---

State whether the following statement is True or False.

In the Iteration method of accessing components, the concept of DOM ids is used.

 

a. False

b. True

---

 

Please, can you point me into documentation where you find the answer?

  • November 14, 2011
  • Like
  • 0

Hi all,

 

I'm passing some tests on freelance sites. On one of them I faced with question:

"Which type of apps are built using only the Force.com API to access the Salesforce service?"

And the answers:

"

a. Composite apps

b. Client apps

c. Native apps

d. All of the above

"

 

Can you point me where to find answer on this question? Or maybe someone explaines me what this question mean.

  • November 10, 2011
  • Like
  • 0

Hi all,

When you hit Run All Tests in browser it shows code coverage for all classes in yuor org. When you hit Run Tests on classes folder in IDE it will do the same. BUT results will be different. Why?

I have class x with ONE method. In IDE it shows 100% coverage and in browser 73%. Where is the truth???

  • October 28, 2011
  • Like
  • 0

Hi everyone,

 

Today I faced with one issue related to displaying test coverage in Apex Test Runner tab in IDE. It worked today but after PC reboot it stoped.

Actually it is working in interesting maner. It shows TRIGGERs coverage but not CLASSes. It was showing today class coverage but now it isn't. I just downloaded Windowse's updates and reboot my PC. No changes in Salesforce environment or IDE.

If I run the same test class from browser it shows classes coverage as ussual.

What can be the problem?

 

Update: I just tested run test on other's developer PC and there is the same situation - no class coverage.

 

Update 2: if I click Run Tests on classes folder it shows me apex classes code coverage. If I click Run Tests on ONE particular class then no. But yesterday it showed my code coverage for classes if I click Run Tests on one particular class. What is going on?

  • October 27, 2011
  • Like
  • 0

Here is a code:

<apex:page id="thePage" standardController="Contact">
    
    <script src="https://maps-api-ssl.google.com/maps/api/js?v=3&sensor=false"
        type="text/javascript">
    </script>    
    
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0px; padding: 0px }
      #map_canvas { height: 100% }
    </style>

    <apex:pageBlock id="mapBlock" title="Map">
        <apex:outputPanel title="map_canvas title" id="map_canvas" onclick="initialize22();" layout="block" style="width:100%; height:100%">
        Click here to view map
        </apex:outputPanel>
    </apex:pageBlock>
    
    <apex:pageBlock title="My Contact Details">      
      <apex:outputPanel id="map_canvas2" onclick="alert('{!$Component.map_canvas2}');" layout="block" style="width:100%; height:100%">
        <p>Hello, {!contact.FirstName}!</p>
        </apex:outputPanel>
    </apex:pageBlock>

    <apex:detail relatedList="false" />    
    
    <script type="text/javascript">
      function initialize22() {
        var latlng = new google.maps.LatLng(-34.397, 150.644);
        var myOptions = {
          zoom: 8,
          center: latlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        alert({!$Component.map_canvas});
        var map = new google.maps.Map(document.getElementById({!$Component.map_canvas}),
            myOptions);
        alert("Map loaded!");
      }
    </script>
    
</apex:page>

 In initialize22 function I can't get id of the element 'map_canvas'. If I post alert in attribute 'onclick' of '

apex:outputPanel' tag it will display. But in JS written separate - no. It's undefined.

Maybe I post JavaScript in wrong place?

 

Tested in Firefox 4, Chrome and IE 9.

  • June 17, 2011
  • Like
  • 0

Hi to everyone!

 

How to activate/turn on Content Assist in Eclipse for VF pages, so I can press Ctrl+Space and see what tags I can use? It works in classes, but not in pages. Is it possible to have Content Assist for VF pages?

  • June 15, 2011
  • Like
  • 0

I have a trigger on after insert and after update

within the code i have a class that limits the trigger from firing once as i have a workflow field update

In my test class i have inserted a new record and then later i am updating it. its not covering the update part of it.

Can anyone tell me what i am missing in the code.

  • May 07, 2012
  • Like
  • 0

Is it possible to customize an e-mail which is sent after an event was created?

  • May 03, 2012
  • Like
  • 0

Is there a way to create an Event with some number of invitees from Apex?

Simple

Event e = new Event(any params here);
insert e;

 doesn't help. It can create an event but there is no possibility to add invitees programmaticaly.

 

It can be done from UI only. All we can do is to pre-fielled ids of users we want to invite to this event. But currently logged in user must push Save & Send Update button to create an event and send invitation e-mails to invitees.

 

What we think as workaround is to perform the same http POST request as SF perform after user clicks this button.

I tried to achieve this using HttpRequest class as well as PageReference. But no luck.

 

Maybe anyone had better luck than me?

  • May 02, 2012
  • Like
  • 0

Hi SF developers,

 

I've faced with one interesting issue which I can't manage by myself.

 

Please imagine the situation when you have an custom object with custom fields "Type__c" as a picklist and custom field "Contact__c" as a lookup on Contacts. Standard SF' Contact object in turn has it's custom field named "Type__c". I've done simple lookup filter for Contact__c field for my superior custom object - [superior object] Contact Type equals Contact: Type.

 

Going further.

 

I have VF page.


<apex:pageBlockTable value="{!superiorObjects}" var="so" >
                 
                  <apex:column >
                      <apex:facet name="header"><b>Contact Type</b></apex:facet>
                      <apex:inputField value="{!so.Contact_Type__c}" />
                  </apex:column>
                  <apex:column >
                      <apex:facet name="header"><b>Contact Name</b></apex:facet>
                      <apex:inputField value="{!so.Contact__c}" styleClass="contactName"/>
                  </apex:column>                                      
             </apex:pageBlockTable>

 

It works fantastic. It filters contacts by selected type. It is great.

BUT. Imagine next steps:

1) select type A;

2) select contact;

3) change type to B.

 

And after this I have a question: how to clear contact name automatically? User can do it manually. Neither by selecting input field and clear text in it or by opening lookup window and clear filter there. It will work fine. But is there a way to do it automatically?

 

If it was not a table I would use an <apex:actionSupport> component. But I don't know how to use it for the table. I can't set id for each inputField in each row for Contact name column and tell actionSupport to clear specific id when change the value in type combo box.

 

Can someone advise me some solution for automatic clear in the <apex:pageBlockTable>?

  • December 02, 2011
  • Like
  • 0

Hi all,

 

I'm passing some tests on freelance sites. On one of them I faced with question:

"Which type of apps are built using only the Force.com API to access the Salesforce service?"

And the answers:

"

a. Composite apps

b. Client apps

c. Native apps

d. All of the above

"

 

Can you point me where to find answer on this question? Or maybe someone explaines me what this question mean.

  • November 10, 2011
  • Like
  • 0

Hi,

i have this trigger (worked fine) - but i cant figure out how to create a testclass to go with it. Can anyone help me please?

this trigger is update Account object (custom lookup field - Related_Contract_Number__c) with the contractnumber from the Contract object when few criteria will change.

 

Here is my trigger (worked fine) - it does seems to work but i cant get the testmethod.

 

trigger ContractNumUpdate on Contract (after update) {

    List<ID> AccIds = New List<ID>();
    for(Contract c : Trigger.new)
    {
        if(c.Status == 'Act' && c.Type__c == 'MS' && c.ContractNumber !=null)
        {
            AccIds.add(c.AccountId);
        }
    }
   
    List<Account> accList = [Select Id, Related_Contract_Number__c from Account where Id in :AccIds];
    Map<id,Contract>accContract = New Map<id,Contract>();
    for (Contract con : Trigger.new)
    {
        accContract.put(con.AccountId,con);
    }
   
   
    for(integer i=0; i < accList.size(); i++)
    {
        accList[i].Related_Contract_Number__c = accContract.get(accList[i].Id).Id;
    }
    update accList;
}

Yup, it's me again.

I dunno if I just suck, or if I'm really pushing this parser. I am making a call to facebook to get user data. The user data comes back as JSON. Most of it is simple string data. There are 3 fields that are arrays. Those arrays contain only 2 items (id and name). I have attempted to create the class based on the JSON and deserialize into it. I am receiving another salesforce system error.

 

System.UnexpectedException: Salesforce System Error: 996229906-358 (-433257328) (-433257328) 
An unexpected error has occurred. Your solution provider has been notified. (system)

Here is the json I am attempting to parse (cleaned up a bit)

{
    "id": "XXXXX",
    "name": "XXXXXX XXXXXXX",
    "first_name": "XXXXXX",
    "last_name": "XXXXXX",
    "link": "http://www.facebook.com/XXXXXX",
    "username": "XXXXXX",
    "about": "some data about the person.",
    "birthday": "00/00/0000",
    "hometown": {
        "id": "XXXXXXXXXXXXXXXXXXXXXXXX",
        "name": "Somewhere, New York"
    },
    "location": {
        "id": "XXXXXXXXXXXXXXXXXXXXXXXX",
        "name": "Nowhere, Nevada"
    },
    "bio": "This is some demo text",
    "inspirational_people": [
        {
            "id": "109425469076258",
            "name": "Miyamoto Musashi"
        },
        {
            "id": "112377255503169",
            "name": "Kenshin Himura"
        },
        {
            "id": "135952326470380",
            "name": "Spike Spiegel"
        },
        {
            "id": "146133595436195",
            "name": "Kamina"
        },
        {
            "id": "12534674842",
            "name": "Albert Einstein"
        },
        {
            "id": "184049470633",
            "name": "Bruce Lee"
        }
    ],
    "gender": "male",
    "email": "XXXXXX@XXXXXX.com",
    "timezone": -4,
    "locale": "en_US",
    "verified": true,
    "updated_time": "2011-11-07T21:17:55+0000"
}


OR EASILY PASTEABLE VERSION
{ "id": "XXXXX", "name": "XXXXXX XXXXXXX", "first_name": "XXXXXX", "last_name": "XXXXXX", "link": "http://www.facebook.com/XXXXXX", "username": "XXXXXX", "about": "some data about the person.", "birthday": "00/00/0000", "hometown": { "id": "XXXXXXXXXXXXXXXXXXXXXXXX", "name": "Somewhere, New York" }, "location": { "id": "XXXXXXXXXXXXXXXXXXXXXXXX", "name": "Nowhere, Nevada" }, "bio": "This is some demo text", "inspirational_people": [ { "id": "109425469076258", "name": "Miyamoto Musashi" }, { "id": "112377255503169", "name": "Kenshin Himura" }, { "id": "135952326470380", "name": "Spike Spiegel" }, { "id": "146133595436195", "name": "Kamina" }, { "id": "12534674842", "name": "Albert Einstein" }, { "id": "184049470633", "name": "Bruce Lee" } ], "gender": "male", "email": "XXXXXX@XXXXXX.com", "timezone": -4, "locale": "en_US", "verified": true, "updated_time": "2011-11-07T21:17:55+0000" } 

 

 Here is the code I am trying to run. You should be able to run this in execute anonymous. I have tried running it regular as well (being invoked by the page, which has the class as a controller) and get the same error either way.



string jsonData = '{ "id": "XXXXX", "name": "XXXXXX XXXXXXX", "first_name": "XXXXXX", "last_name": "XXXXXX", "link": "http://www.facebook.com/XXXXXX", "username": "XXXXXX", "about": "some data about the person.", "birthday": "00/00/0000", "hometown": { "id": "XXXXXXXXXXXXXXXXXXXXXXXX", "name": "Somewhere, New York" }, "location": { "id": "XXXXXXXXXXXXXXXXXXXXXXXX", "name": "Nowhere, Nevada" }, "bio": "This is some demo text", "inspirational_people": [ { "id": "109425469076258", "name": "Miyamoto Musashi" }, { "id": "112377255503169", "name": "Kenshin Himura" }, { "id": "135952326470380", "name": "Spike Spiegel" }, { "id": "146133595436195", "name": "Kamina" }, { "id": "12534674842", "name": "Albert Einstein" }, { "id": "184049470633", "name": "Bruce Lee" } ], "gender": "male", "email": "XXXXXX@XXXXXX.com", "timezone": -4, "locale": "en_US", "verified": true, "updated_time": "2011-11-07T21:17:55+0000" }';    
class facebookUser
    {
        public string id;
        public string name;
        public string first_name;
        public string last_name;
        public string link;
        public string username;
        public string about;
        public string birthday;
        public string gender;
        public string email;
        public string timezone;
        public string locale;
        public string verified;
        public string updated_time;
        public list<dataItem> hometown;
        public list<dataItem> location;
        public list<dataItem> inspirational_people;
        
        public facebookUser(string id, string name, string first_name, string last_name, string link, string username, string about, string birthday, string gender, string email, string timeZone, string locale, string verified, string updated_time)
        {
            this.id = id;
            this.name = name;
            this.first_name = first_name;
            this.last_name = last_name;
            this.link = link;
            this.username = username;
            this.about = about;
            this.birthday = birthday;
            this.gender = gender;
            this.email = email;
            this.timeZone = timeZone;
            this.locale = locale;
            this.verified = verified;
            this.updated_time = updated_time;
            this.hometown =  new list<dataItem>();
            this.location =  new list<dataItem>();
            this.inspirational_people = new list<dataItem>();      
        }
    }
    
    class dataItem 
    {
        public string id;
        public string name;
        
        public dataItem(string id, string name)
        {
            this.id = id;
            this.name = name;
        }
    }

//I have tried deserializing to a list, as well as a single object list<facebookUser> d = (list<facebookUser>)JSON.deserialize( jsonData,facebookUser.class);

//This fails too
facebookUser d = (facebookUser)JSON.deserialize( jsonData,facebookUser.class); 

 

Any thoughts would be much appreciated. Thank you.

Hi everyone,

 

Today I faced with one issue related to displaying test coverage in Apex Test Runner tab in IDE. It worked today but after PC reboot it stoped.

Actually it is working in interesting maner. It shows TRIGGERs coverage but not CLASSes. It was showing today class coverage but now it isn't. I just downloaded Windowse's updates and reboot my PC. No changes in Salesforce environment or IDE.

If I run the same test class from browser it shows classes coverage as ussual.

What can be the problem?

 

Update: I just tested run test on other's developer PC and there is the same situation - no class coverage.

 

Update 2: if I click Run Tests on classes folder it shows me apex classes code coverage. If I click Run Tests on ONE particular class then no. But yesterday it showed my code coverage for classes if I click Run Tests on one particular class. What is going on?

  • October 27, 2011
  • Like
  • 0

Hi,

 

 

I have made the integration between SalesForce and ZenDesk and I am trying to create a new organization every time a new Account is created in SalesForce. Has somebody done this already? It would be really helpful if somebody could point me to any documents or materials or API samples which dwells into similar scenarios.

 

Thanks!

 

 

  • October 26, 2011
  • Like
  • 0

The code is  like this When the claim.Checked_GP_Date__c have value I will rerender the Id btnApprove.but only the button on the top of block is actived.the bottom one is still grey.

 

 <apex:commandButton id="btnApprove" value="Approve" disabled="{!ISNULL(claim.Checked_GP_Date__c)}" action="{!saveApprovedClaim}" status="splashStatus" reRender="procedurePanel,errorPanel,pageBlk" onclick="setSubmit()"/>

 

any sugesstions?

Thanks

  • July 24, 2011
  • Like
  • 0

I am getting timeout error (600 secs) - limit reached when trying to save code to SFDC.

 

Has anyone else got this error? I can also confirm that the site is operational (checked via trust.salesforce.com) and not currently under maintenance