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


  • Chatter
    Feed
  • 54
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 55
    Questions
  • 415
    Replies
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
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

 
I am encountering below error when trying to deploy the a class. Below is error and class. I am not sure why i get this error.

error is 
No such column 'Single_Donor__c' on entity 'OpportunityLineItem'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 
if(quoteRecordtype=='Primary Cells Request'){ 
        olist = [Select Id, OpportunityId, SortOrder, PricebookEntryId, Quantity,ETA__c, 
        TotalPrice, UnitPrice, ListPrice, ServiceDate, Description, CreatedDate, 
        CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, Sales_Discount__c,opportunity.recordtype.name,
        Age__c,Anticoagulant__c,Cell_Isolation__c,Cells_per_Vial__c,Multiple_Donors__c,Single_Donor__c,Product_State__c,Desired_Cell_type__c,
        Donor_Blood_Type__c,End_Age__c,Ethnicity__c,Gender__c,Healthy_Tissue_Type__c,Product_Specifications__c,
        Medication_Constraints__c,Other_Info__c,Medication_Constraints_Other__c,Specific_Donor_s__c,HLA_Type__c,ADCC_Status__c,
       Other_Requirements__c,additional_testing__c,Spec_Description__c,Smoker__c,Unit_Cost_Price__c,Discount,CurrencyISOCode,
        IsDeleted , PricebookEntry.Name, PricebookEntry.Product2id,  Shipping_Cost__c, PricebookEntry.Product2.recordtype.name, PricebookEntry.Product2.Part_Id__c
        From OpportunityLineItem 
        where OpportunityId = :quote.Opportunity__c and product_sector__c = 'Primary Cells'];
        }

Thanks.
Hello,

I have a custom object which is private and it has 3 lookups.
There are 200 records for this object in total but a user can see 100 records.

I have checked sharing criterias but the user is not part of this group, so i was thinking may it is related to lookup records.

thank you for suggestion !
  • September 01, 2016
  • Like
  • 0
<apex:page standardController="Order__c">
    <apex:relatedList list="Cases"/>
</apex:page>

This is in one of my sandbox orgs. I have System Admin permissions. Yet, I get an Insufficient Privileges error on page load. The Cases related list does work on the standard layout. I am not sure which permission I should change. Thanks!

Hi Everyone,

I am stuck on a trigger. I want this to populate the Inside Sales Representative on the record being saved.  However I am getting an error:

Review all error messages below to correct your data.
Apex trigger OpportunityISR caused an unexpected exception, contact your administrator: OpportunityISR: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.OpportunityISR: line 5, column 1


Here is the Trigger Code:

trigger OpportunityISR on Opportunity (before insert){
    Opportunity oppty;
Set<Id> OpptyId= new Set<Id>();
    
    if(oppty.Inside_Sales_Representative__c == null) {
      oppty.Inside_Sales_Representative__c = Userinfo.getUserId();
      System.debug('Setting Sales Representative to ' + Userinfo.getUserId());       
    } else {
      if(Trigger.isInsert) {
        oppty.Inside_Sales_Representative__c = Userinfo.getUserId();
        System.debug('Setting Opportunity Owner to ' + Userinfo.getUserId());       
      }
}
                     }
Hi,

I converted my date field in string, so I can updated my other field in account.

    for (Account acc: [SELECT Id, Data_pedido_AR__c, Data_pedido_SA__c FROM Account WHERE id IN: ids]){

    for (Case c: trigger.new) {
   
    if(c.motivo__c == 'Formandos AR' && c.Data_pedido_AR__c != null && Trigger.oldMap.get(c.id).Data_pedido_AR__c != c.Data_pedido_AR__c){
    Datetime d = Date.Valueof(c.Data_pedido_AR__c);   
    String dateStr = d.format('dd/MM/yyyy');
    System.debug('::::::::::: ' + dateStr) ;

        acc.Data_pedido_AR__c = dateStr;
    }
update acc;


It works fine but in my account my field is one day less.
If I put c.Data_pedido_AR__c = 20/05/2014
I get acc.Data_pedido_AR__c = 19/05/2014

Why?

Hello,

 

I have been looking at an unusual situation.

 

I'm editing a record, specifically a lookup field on the record (which has up to this point been null). I have an action support (onchange) on the field that triggers a rerender on a picklist field that gets its options from a function in the controller that uses the lookup field value in a SOQL query.

 

The problem is that the value of the lookup field is still NULL when the query runs in the function.

 

However, if I fill in the lookup field, save and edit again, this time if I change the lookup field, the value IS up to date in the controller when I go and do the query.

 

What can be causing this? what can I do?

 

How can I get the value in the input field in a reliable way?

 

Here is the APEX Page and the Controller. (nPrescripcion.Medicamento__c is the lookup field that is not up to date in the controller when I run the query, I know this based on a system.debug statement)

 

<apex:page standardController="Prescripcion_Paciente__c" showHeader="false" sidebar="false" extensions="PrescripcionExtension">
    <apex:form style="padding-left:25px;padding-right:25px;padding-top:25px;">
        <apex:pageBlock title="Prescripción" tabstyle="Tratamiento__c"  mode="edit" >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save" /> 
                <apex:commandButton action="{!cancel}" value="Cancelar" id="btn_Cancel"/>
                </apex:commandButton> 
            </apex:pageBlockButtons>  
            <apex:pageBlockSection id="MedicamentoVE" title="Medicamento" showHeader="true" collapsible="false" columns="2" >
                <apex:inputField label="Principio Activo" id="iPrincipioActivo"  required="true" value="{!Prescripcion_Paciente__c.Medicamento__c}">
                    <apex:actionSupport event="onchange" reRender="iMarca1,iMarca2" />
                </apex:inputField>
                <apex:selectList value="{!Prescripcion_Paciente__c.Marca_Comercial_1__c}" size="1" id="iMarca1" required="false">
                    <apex:selectOptions value="{!MarcasComerciales}"/>
                </apex:selectList>
            </apex:pageBlockSection>     
        </apex:pageBlock>
    </apex:form>  
</apex:page>

 

public class PrescripcionExtension {
    private Prescripcion_Paciente__c nPrescripcion;
    public ApexPages.StandardController stdCtrl { set; get; }
   
    public PrescripcionExtension (ApexPages.StandardController controller) {
        this.nPrescripcion= (Prescripcion_Paciente__c)controller.getRecord();
        stdCtrl=controller;
    }
    
    public List<SelectOption> getMarcasComerciales()
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('','--Ninguna--'));
        options.add(new SelectOption('Otra','Otra'));
        system.debug(nPrescripcion.medicamento__c);
        Tratamiento__c[] nMeds = [Select marcas__c from Tratamiento__c where id=:nPrescripcion.medicamento__c];
        if (nMeds.size()>0){
            if (nMeds[0].marcas__c!=null && nMeds[0].marcas__c!='')
            {
                String[] marcas = nMeds[0].marcas__c.split(';');
                for (Integer j=0;j<marcas.size();j++)
                {
                  options.add(new SelectOption(marcas[j],marcas[j]));
                }
            }
        }
        return options;
    }
}

 

 

 

Hello,

 

I have a custom setting which stored the name of a JavaScript file.  I wish to  get the name from the custom setting and include it when referencing/including a JavaScrpt file in my visualforce page.

 

I tired to do the following 

 

<apex:includeScript value="{!URLFOR($Resource[MyCustomObject__c.getInstance(Site.getName()).javaScriptFileName__c])}"/>

 

and 

 

<apex:includeScript value="{!$Resource.[MyCustomObject__c.getInstance(Site.getName()).javaScriptFileName__c]}"/>

 

but these would not save correctly.

 

For the above requirement, should this be possible, to get a custom setting value at the same time as trying to set it as a resource to load with my visualforce page?

 

Thanks in advance for any help.

I'm looking to create a simple data sheet for an individual record that includes an image created and uploaded by a user.  I'd like the user to be able to use the standard "Notes & Attachments" to add the image to the record, but I don't see any examples of being able to embed a Notes & Attachments image in a VF page. Is this possible? How can I avoid the user having to either (A) edit a static resource or (B) upload to a different server and then paste the URL?

Has anyone worked in developing a typical Web Portal kind HOME page within SFDC?

 

We are trying to figure out best way to design this solution which should show multiple subsections within home page

1. One widget for Chatter feed

2. another widget for my alerts

3. one subsection for showing document links pertaining to User role in org

 

This is not hard coded VF but each application user should be able to personalize this page as per his/her preferences, not limited to below

 

1. Choosing which widget to add in their HOME page view

2. Choosing placement of Widget on HOME page (top left, bottom right)

3. Skins and Themes of HOME page

 

If anyone has done something similar and can share relevant experience as to how they handled it, any roadblock faced etc, it will be greatly helpful.

 

Thanks

Satgur

 

  • March 15, 2012
  • Like
  • 0

Hi,

 

I have a VisualForce page with a link:

 

https://na1.salesforce.com/apex/Visualforce_Page

 

Soon we are migrating from na1 to another instance and would like to know how to automatically retrieve the Salesforce Instance to do the same changes in all the visualforce pages.

 

I have tried to use relative links as in any custom link:

 

/apex/Visualforce_Page

 

but is not working

 

I have found this link below

 

http://stackoverflow.com/questions/9369653/retrieve-salesforce-instance-url-instead-of-visualforce-instance

 

Does anyone knows how should I replace

 

https://na1.salesforce.com/apex/Visualforce_Page

 

So next month with the instance change all will keep working?

 

Thank you

 

  • March 13, 2012
  • Like
  • 0

Hi can anyone help me with creating a hyper link it the value entered is a url in the textbox.

 

thanks in advance to anyone who helps :)

Hi,

   I've made a custom search page. Its has a <apex:form> which contains the paramaters of search. I wanna create a reset button, that does two things. Firstly it should clear all the values given in the <apex:form> and then it sould render the lower <apex:pageblocksection> that displays the serach results. Please help me!!!!!

<body>

Hi,

I want to do something like this in Page:

 

for  (j=0; j< {!getGetMyDossiersIntilak.size}; j++ ) { 
     
      
     geocoder.geocode( { 'address':'{!getGetMyDossiersIntilak[j].Ville__c}' }, function(results, status)

 

But it's not working because of the variable "j" in {!getGetMyDossiersIntilak[j].Ville__c} . If I put an integer number instead as "0" it will work but I want to make it work with a variable.

 

Some help please :)

 

 </body>

 

 

 

 

Hi,

 

Can anyone explain me the steps to be followed to invoke an apex webservice from the Java application? It would be grateful if you attach some code samples or reference.

 

Regards,

SuBaa

  • February 21, 2012
  • Like
  • 0

I don't know exactly where to post this, so here it is....

 

I woud like to have a custom object report that takes the value of a field (#red, #yellow, or #green) and highlights the background of that record in that colour, in the report. It's not a summary field; it's a field that would be set by the record owner. It's intended to make it easier for the execs to zoom in on which records are in trouble.

 

Any idea of how to do this?

Is there a way to reconstruct/recreate a dashboard in a visualforce page?

 

I am happy with all of the standard Salesforce dashboard components but I need to display them in a way other than the standard three column format. Is this possible? We have several large flat screen monitors posted on our sales floor but the three column layout doesn't use all of the horizontal real estate on the screen and some of the componenets are cut off becaue there isn't as much vertical space. 

 

I essentially need to restyle the existing dashboard to fit the horizontal layout of the monitors. Our execs are requesting more visual metrics and they will not be visible in the standard layout. If anyone can give me some suggestions or point me to some code samples I'd really appreciate it.

 

Full disclosure: I am not a coder. I know enough HTML and CSS to be dangerous and I can implement/tweak just about any Javascript I find out in the wild. Thanks in advance.

 

-Natty

static testMethod void AssetAtRiskTest(){

        Account acc = new Account(name = 'foo');

      insert acc;

 

        ApexPages.StandardController sc = new ApexPages.StandardController(acc);

        PageReference pageRef = sc.view();

               

        AssetAtRisk a = new AssetAtRisk(sc);                

        test.startTest();       

        test.setCurrentPage(pageRef);       

        pageRef = a.autoRun();                       

        test.stopTest();

}

 

so this is my test code minus the assertions of course. The issue is that when the autorun function is running the following line always produces null.

 

String theId = ApexPages.currentPage().getParameters().get('id');

 

I would expect this line to set theId to the Id of the new account I created in the test method, however this is not the case. Am I missing something simple here?

I followed the instructions as outlined here https://help.salesforce.com/articleView?id=networks_seo.htm&type=0&language=en_US&release=206.17 and was not able to generate the sitemap.xml file in sandbox. I was able to generate the file in production.
Any pointers on what might be wrong? The community is published and active in sandbox.

Thanks in advance ! 
Apex Code:
try{               
                    update(itemsToUpdate);
                    showsuccess = true;
                  }
                catch(DmlException e){
                    for(integer i=0; i < e.getNumDml(); i++){
                        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getDmlMessage(i)));
                     }
                    showsuccess = false;
                    return null;
                }

Error message:
OppLnItemTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0064000000f8EeIAAU; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The selected product does not exist in EDW yet.Please update your selection or try again later.: [] Class.TriggerHandlerBase.updateObjects: line 172, column 1 Class.TriggerHandlerBase.processObjects: line 61, column 1 Class.TriggerDispatcherBase.execute: line 128, column 1 Class.OppLnItemDispatcher.afterUpdate: line 78, column 1 Class.TriggerFactory.execute: line 43, column 1 Class.TriggerFactory.createTriggerDispatcher: line 19, column 1 Trigger.OppLnItemTrigger: line 2, column 1

I only want to display the error message: 'The selected product does not exist in EDW yet.Please update your selection or try again later'

Any help is appreciated. THANKS 
Hello All,

We use a ETL tool to extract data from several salesforce objects on a daily basis. Since May 12 2016 on our NA2 instance there has been a significant decrease in the extraction time (jobs which took 30 minutes now only take 15 minutes). While this is great new, i was wondering what upgrades from Salesforce might have caused this? Any help is highly appreciated.

Thank You!!!!
Provided the limitation that 'Export Reports' option is not availbale with Lightning, can i open only the Reports tab in a salesforce classic view and all others in the lightning UI? I would basically like to know if i could use a combination on both?
Hello All,

We are using jenkins and SVN for source control. Below are the steps for the issue i am facing. Any help is greatly appreciated.
  1. I used the salesforce ANT tool to retrieve ALL workflow and pageLayout components from production.
  2. I used the retrived folder to deploy the same to production again.
  3. Error thrown: 
    1. Workflow - Question : Cannot create workflow directly; must create the CustomObject first
    2. Workflow - SocialPost : Cannot create workflow directly; must create the CustomObject first
    3. Workflow - Reply : Cannot create workflow directly; must create the CustomObject firs
    4. Page Layout - FeedItem-Feed Item Layout: Layout must have at least 1 section
    5. Page Layout - SocialPost-Social Post Layout: Layout must have at least 1 section
Please note: the page layouts and workflows are not custom, the look like standard ones since they are without the __c.
I see there is a <apex:detail> tag to use the detail page layout of an object. But is there a way to access the New/Edit page as well???

I want to use the existing page layout  and not manually define each field in the visualforce page.

Any help is highly appreciated.

Here is the error i get,

 

helloworldservlet.java:145: cannot find symbol
symbol : method get(java.lang.String)
location: class com.sforce.soap.partner.sobject.SObject

 

I have the necessary imports, not sure what might be the problem.. Any ideas?

Hello,

 

I am trying to call a controller's method in my extension class and was able to do it with the class.methodname syntax.

 

However, when i try to use the pagereference returned by the method i am unable to save the class with a error message "Unable to process the requested change"

 

Here is how my class looks like, this is the one that works

 

Public void savestep7()
    {
        savemeeting();
        controller.save();
        
    }    

 The one that does not work

 

Public Pagereference savestep7()
    {
        savemeeting();
        Pagereference p = controller.save();
        return p;
    }    

 

Hello,

 

How do i create a summary report which groups the users based on whether they are a FULL License or a PLATFORM License?

 

Had to do this using the data loader, is there a way to do this with standard reports?

 

Thanks!

Here is the error message.

 

Cannot find symbol

 

symbol : method getField(java.lang.String)
location: class com.sforce.soap.partner.sobject.SObject

 

 

I used the getId() method and the code works, only when i use getField the code doesn't.... Any pointers appreciated

Hi All,

 
I have got a visualforce page which has to be displayed on a blackberry. There is a javascript code on the visualforce page which shows/hides a div when a button is clicked. While i could see that the javascript function is called appropriately, the line "document.getElementById('sample').style.display = 'block';" does not seem to work. The blackberry version is 4.6.x, and the blackberry developer documentation states that the above line of code is supported in versions 4.6 and above.
 
Below are some other options i tried,
 
  • Tried using visibility:hidden. It doesn't work as well.
  • Tried document.getElementById('sample').setAttribute("style","display:block;"). Doesn't work.

Any help is much appreciated.

 
Thanks,
Edwin

Hello All,

 

I have a Visualforce Page which  when viewed as an Admin works fine, the page has a rerender portion when on selecting a value from a drop down a couple of text boxes get rerendered.

 

I logged in as a different user and the page shows up fine, when i change the drop down the rerender gets called and i end up getting the message

 

"Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. "

 

The VF page, the apex class, the extension class, the objects used (have C R E D), all have the permissions for this profile. Also, all fields of the associated objects are visible to this profile.

 

With this error message i am unable to get any clue of what is happening actually, it's just supposed to rerender a few text boxes which are not associated with any access privileages.

 

Moreover, the debug log says "SUCCESS" and all getter and setter methods are called fine. Its only when the page refreshes itself that something goes wrong somewhere.

 

Please let me know your thoughts.

 

Thanks,

Edwin

Hello All, I have a master object with a roll-up summary field. This field is visible to all profiles, whereas the master object is only visible to the administrators.. I have a Visualforce page which displays this roll-up summary field. This field is only visible to the administrators and not to others... I use an apex class to query the record from the master object.. While other fields display for all users only the roll-up field doesn't... I guess that giving a read access to the object for all profiles would solve the problem.. But, i can't understand the reason why the field doesn't display..

I just did a small visualforce page and saw that the date picker appears by default, i do not understand from where it came.. See Image below

 

Removed the apex:form tags and it disappears.. Did anyone face such similar issue???

 

Hi All,

 

We have SSO enabled. When a user clicks on a link in our website, i would like to open up a visualforce page.

 

Since its through SSO, i just give the URL and the link opens up with no issues.

 

But i would like to authenticate the login of the user before showing the visualforce page, since its not always necessary that the user logs in through SSO before clicking the link.

 

One thought that came to my mind,

  • Create a HTML page.
  • Add this page to the link.
  • Call a javascript function which validates the login of the user.
  • If login is YES, display the Visualforce Page as a frame.
  • If login is NO, display an error message.

Any thoughts or pointers to code samples would be highly appreciated.

 

Thank you,

Edwin

Hi all,

 

I am about to develop a toolbar for Chatter.

 

http://sites.force.com/answers/ideaView?id=087300000007p6mAAA . Exactly the idea of this user. I have a set of questions to determine if this is possible.

 

  • Is there a way to show automatic notifications in the toolbar. If so, how can it be acheived ( should i call an external webservice everytime a new feed is created??)

Please forgive me, i dont know much about webservices except that they are used to send and receive data...

 

Any guidance is appreciated..

 

Thanks

Hi All,

 

I tried installing this app from the appexchange and it does not install..

 

http://sites.force.com/appexchange/listingDetail?listingId=a0N30000003GJVoEAO

 

Any help is appreciated!!!

 

Thanks!

Hi All,

 

My requirement is simple...  The chatter component on the Home Page has to be hidden. This is because we already have a lot of coponents in our home page and we actually do not have enough real estate for chatter...

 

I found a solution for this. I created a sidebar component, and hid the style "div" of the chatter component using "display:none;"...  I also placed a button in the sidebar which says "Show Chatter" and when clicked the user is redirected to the Profile Tab....

 

But, i noticed that the feeds that show up in your home page (includes feeds from users you follow), is different from the feeds that show up in your Profile page (includes only feeds you post, or from records you follow)...

 

Is there a way to make the Profile Page show feeds in the same way as it shows in the Home Page...

 

Thanks in advance!!!

Hi All,

 

I have a custom application which has been developed using Visualforce. Everything works fine with the old User Interface theme.

 

I turned on the new User Interface theme, and the UI looks too bad. Luckily, i was able to narrow down on one particular line which has been causing this problem.

 

We have a javascript function which is used to track site visitors. This function has the following lines

 

<script language="JavaScript" type="text/javascript">
<!--
var s_code=s.t();if(s_code)document.write(s_code)
//-->
</script>

 The colored part is a valid single line comment format in javascript, but not in visualforce. Hence, i had to remove the colored part and the function works as expected.

 

With the new UI, the document.write(s_code) statement causes my visualforce page to extend beyond the pageblock placeholder.

 

A sample of the image is below. Any suggestions highly appreciated.

 

 

 

Thanks,

Edwin

 

 

 

Dear All,

 

We have an application which consists of a set of Visualforce pages. We have used our own CSS files to apply custom look and feel to the pages.

 

Now, with the introduction of the new UI, our visualforce pages look messy. I debugged the pages and found out that our visualforce pages have a fixed width and all elements inside the page are aligned relative to the fixed width.

 

Here is a screenshot

Sample

 

 

However, the new UI displays a white block and our page does not fix into this white block.

 

 

<div id="Wrapper" class="leftbox">

 

The width of this div is 1200px - fixed in the CSS. If i make the div's width "auto" then all other elements get misaligned, however the white block of the new UI extends to fit my page.

 

 

Thanks for any help that you can provide...

 

Regards,

Edwin

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

  • October 18, 2016
  • Like
  • 0
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