• Edwin Vijay
  • SMARTIE
  • 1498 Points
  • Member since 2008
  • Procore


  • Chatter
    Feed
  • 54
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 55
    Questions
  • 415
    Replies
I am a beginner in Salesforce and Apex. Can anyone help me write TestClass for this Apex Class.

Event Trigger Handler

public class EventTriggerHandler {

    public static String comma = ',';
    
    public static void AfterInsert(Map<id, Event> EventMap)
    {
        try
        {
            String NameTitle ='';
            String Names;
            
            List<EventRelation>EveRelationList=New List<EventRelation>();
            EveRelationList = [SELECT Id, RelationId,EventId FROM EventRelation WHERE EventId In : eventMap.keyset() and RelationId != null];
             system.debug('AfterInsert count_____'+EveRelationList.size());
            Set<Id> WhoIds = New set<Id>();
            for(EventRelation eveRel : EveRelationList){
                WhoIds.add(eveRel.RelationId);
                system.debug('WhoIds after insert_____'+WhoIds);
            }
            List<Contact> ConList = New List<Contact>();
            ConList=[Select Id,Title,FirstName,LastName, Name FROM Contact WHERE Id In : WhoIds and Title != null and Name != null];
            for(Contact c : ConList){
                if(c.Title!= null)
                {
                    NameTitle = NameTitle+c.Name + '(' + c.Title + ')' + comma ;
                }
            }
            Names = NameTitle.removeEnd(comma);
            System.debug('Names'  + Names);
            List<Event> eventList = new List<Event>();
        
            for (Event e : [select id, Title__c from Event where Id in: eventMap.keyset()])
            {
                e.Title__c = Names;
                eventList.add(e);
            }
            update eventList;
        }
        catch(exception e)
        {
             throw e;    
        }
    }
}

Event Trigger

trigger EventTrigger on Event (before insert, before update, after insert) {
    if (Trigger.IsBefore) {
        if (Trigger.isInsert) {
        }
        if (Trigger.isUpdate) {
        }
    }
    if(Trigger.IsAfter)
    {
        if (Trigger.isInsert) {
            EventTriggerHandler.AfterInsert(trigger.newMap);
        }
    }
    
}

 
Hello everyone,

So I had two buttons that were working fine up until yesterday and now both of them are coming back with the same exact error message. They both do the same thing, allow an attachment to a list of e-mail addresses while date stamping a value. Their last modified date was 5/16/2016 and now they are both not working. Here is my code, I haven't run any updates. I am also willing to change this button as long as the same things can be accomplished.
 
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} 

location.replace('/email/author/emailauthor.jsp?retURL=/{!Opportunity.Id}&rtype=003&p24={!Opportunity.OwnerEmail}&p4=(___EMAIL ADDRESSES REMOVED PURPOSELY___)&template_id=239291302&p6={!Opportunity.Name}'); 

var oppObj = new sforce.SObject("Opportunity"); 
oppObj.Id = '{!Opportunity.Id}'; 

var build = new Date(); 

var month = build.getMonth(); 

var day = build.getDate(); 

var year = build.getFullYear(); 

var today = new Date(year,month,day); 
try 
{ 
oppObj.CL2_Binder_Date__c = today; 
sforce.connection.update([oppObj]); 
} 
catch(e) 
{ 
console.log(e.message); 
}

 
Hi
I am trying to write a trigger to set an Opportunity Attachment attribute Private flag set to true, whenver an attachement is added/updated on opportuntiy record, I am new to trigger any help would be greatly appreciated.
thank you
Nagesh Vattikonda
Hey Everyone, 

I created a force.com site but can't get two images to render onto the page. I have static resources setup correctly as the reset of the CSS and js is showing up correctly on the page, except the logo and background image. 

This is my syntax used for the two images in question. 
<section class="mbr-section mbr-parallax-background" style="background-image: url(assets/images/3-wide-2000x913-68.jpg); padding-top: 80px; padding-bottom: 80px;">
<div class="mbr-figure"><img src="assets/images/starbucks-1400x1400-6.png"></img></div>

I've even added these apex stylesheet syntax's to my visualforce page, but I need to modify the CSS Syntax to point to apex syntax in the static source:  
 
<apex:stylesheet value="{!URLFOR($Resource.styles, 'assets/images/starbucks-1400x1400-6.png')}"/>
<apex:stylesheet value="{!URLFOR($Resource.styles, 'assets/images/3-wide-2000x913-68.jpg')}"/>
Can someone help me with the CSS Syntax to point to the static source? 

Thank you!





User-added image

Hi Everyone,

I am using the developer edition and my question is regarding adding multiple If statements to formulas within an object. 

I am trying to write a formula to assign a value to certain feilds so I can create a score for each account and rate them base on the score.
For example, one of the creiteria for the score is a feild name, "Number of properties" which happens to be 30 I want to assign a score of 25.
using if :  IF(logical_test, value_if_true, value_if_false) 
Heres what i got so far: 
IF((number_of_property__c <= 5), 5, 0)
IF((5 < number_of_property__c) <= 10), 10, 0)
IF((10 < number_of_property__c) <= 20),15, 0)
IF((20 < number_of_property__c) <= 30),20, 0)
IF((30 < number_of_property__c)),25, 0)

i keep getting a "Error: Syntax error. Extra IF" on the second IF on line 2

if there is a better way to do this or if you know why im getting this error please let me know anything helps

I am using  ANT tool to get data from org .Then i need to deploy to another org.

How can i get Reports and dashboards in to my local folder?
How can i retrieve them from one org?
Also email templates?
Do i need to indivdually get field updates and other?or just workflow rule brings them?

Thank you .
Getting Error "'OpportunityProjectItems__r' is not a valid child relationship name for entity Project " on visual force page while clicking project to open. Can you suggest how to resolve this?

This is happening only for one profile
Hello All,

I am using JSP and Rest Api to access Knowledge Articles.
I get the articles but the images are broken.
I changed the url in all img tags as https://["domainName"].cs15.force.com/servlet/rtaImage?eid=ka**********&feoid=*********&refid=*********
Still I dont see the images in the Knowledge article.
Can somebody help?
Thanks,
Jayesh
 
Hi,
I am an admin, I am trying to create a field that counts total number of Acconts for custom object "Building". There is no relationship between these two objects.

I'm not sure of the best way to accomplish this. Any suggestions would be helpful!
 
I've got the following trigger working, to map the value of an industry to a different industry:
 
trigger MapDataCOMIndustry on Account (before insert, before update) {
    for(Account a1: Trigger.new){
        if(a1.industry=='Government'){
           a1.industry='Emergency Services';
        }
    }  
}

Now I have to do that for a long list of industries, see below. What is the best way to write this in the trigger? Can I use something like a "case" method? Or does it need to be a bunch of else if statements?
 
trigger MapDataCOMIndustry on Account (before insert, before update) {
    for(Account a1: Trigger.new){
    
        if(a1.industry=='Government'){
           a1.industry='Emergency Services';
        }
        
        else if(a1.industry=='Agriculture'){
           a1.industry='Agriculture & Fisheries';
        }
        
        else if(a1.industry=='Apparel'){
            a1.industry='Other';
        }
        
        else if(a1.industry=='Banking'){
            a1.industry='Finance';
        }
    }  
}



User-added image

 
Hi All,

It's my first post on salesforce community .Brand new in salesforce .

I want to populate picklist data from custom field .

I Created one custom object City and City name is field just create some record  .
Now i want to populate city name inside picklist .Is there any way to do this without code .

Thanks in advance !!

 
Hello,

I'm composing an email template that will have variable text only if the account subtype (custom field) validates against a set value for premium customers. The end results would be something like:
 
"You are now certified to sell our products and you have access to our premium services."

I have tried every combination of IF and CONTAINS I can think of, defining the premium text as both an inline value and as the contents of a containing tag, including the examples below:
 
<apex:outputtext value=" and you have access to our premium services" rendered="{!IF(Account.Sub_Type__c == "B2B - Premium Customer")}" />

<apex:outputtext value=" and you have access to our premium services" rendered="{!CONTAINS(Account.Sub_Type__c, "Premium Customer")}" />

<apex:outputtext value=" and you have access to our premium services" rendered="{!IF(CONTAINS(Account.Sub_Type__c, "Premium Customer"), true, false)}" />

<apex:outputtext rendered="{!IF(CONTAINS(Account.Sub_Type__c, "Premium Customer"), true, false)}"> and you have access to our premium services</apex:outputtext>

Is this a syntax issue, is this a problem with outputText? Can I not validate account fields in an email to a contact? Any help you can provide would be appreciated.
Hi All,

We have a requirment where we have an attachment and on certain condition we will have to create a Knowledge Article with the attachment.
Any leads would be quite helpful.

Thanks in advance!!

Hi All,

 

Does Site.com support a way to dynamically generate a public accessible sitemap.xml file based on the sitemap you have created with site.com studio? If so, how?

 

Ideally it should be following the sitemaps.xml standard (http://www.sitemaps.org/protocol.html)

 

Or must we build one manually instead?

Any help and insight is greatly appreciated.

 

Thank you,

 

Yuri Lausberg