• Chiz
  • NEWBIE
  • 164 Points
  • Member since 2011

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

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.

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

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?

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>?

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.

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?

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!

 

 

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

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