• Justin Manchester
  • NEWBIE
  • 10 Points
  • Member since 2014
  • Mobile Tech Support Analyst
  • Salesforce

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 6
    Replies
I'm writing a trigger that will:

Every time a new contact is created, of Record Type 'Consumer', I want to create a corresponding record in the master-detail custom object Compliance2__c.  The only field that needs to be passed is the lookup value.  The other fields on Compiance2__c are formulas.  
The error I'm getting is: "Error: Compile Error: unexpected token: 'for' at line 5 column 4"

My code is:
trigger createCompliance on Contact (after insert) {
    
    List <Compliance2__c> compToInsert = new List <Compliance2__c>
    
    for (Contact c : Trigger.new) {
        
        //check if this is a Consumer being created
        if (c.RecordType.Name = 'Consumer') {
            //create a new Compliance for each new Consumer
            Compliance2__c i = new Compliance2__c ();
            i.Consumer__c = c.Id;
            //add to the list of Compliances to insert
            compToInsert.add(i);
        } //end if
    } //end for c
    //after loop, insert new Compliances
    insert complianceToInsert;  
}

Any help is appreciated.
Thank you!
Hi ,I created trigger annd class in Eclipse and I wanted to test it in the saleforce UI.When I try to save Class in Eclipes.On the first line of code ,I see an x  red color checkbox which says

Multiple Markets at this line-
                                  -------------------File only saved locally,Not to the server

                                                                   --------------------------- save erro:-enitity is not org accessible.

The below given line is the first line and It gives me an error on this line,Saying 

Multiple Markets at this line-
                                  -------------------File only saved locally,Not to the server

                                                                   --------------------------- save erro:-enitity is not org accessible.

public class Reservation
{




Can somebody please help how to get rid of this error so that its gets saved to the salesforce from eclipse.?

Hi Fellow Developers,

I have created a visualforce page which I'm rendering as PDF. The page header looks like this:

<apex:page Standardcontroller="Opportunity" extensions="RFController" standardStylesheets="False" showHeader="False" sidebar="False" cache="True" renderAs="PDF" docType="html-5.0" contentType="application/pdf">

The page displays perfectly in the standard Salesforce org.

However if I try to display the same page in the the Salesforce1 App by calling the page from a custom button on Opportunity with content source set as the Visualforce page, the page doesn't render and the animated circular fetch gif keeps moving. Screenshot below:

User-added image

The page never loads. 

Additional Info: I also tried the same thing by creating an empty Visualforce page, with renderAs="PDF" but to no avail.

I also noticed when I press the back arrow on the app, the pdf shows for a fraction of a second and the view shifts back to the Opportunity record.

Please help out if anyone has a clue about this. Thank you very much


Hi All,

I am working on the case trigger which will update an acount object.I just started and got the folowing error.Can somebody help?
In the below given code I am assigning accountid to the map and along with the acocuntid I am trying to the add the complete record in map.However,When I
do that I get the following error.I want to use map here so I will appreciate if somebody can correct this error.I do not want ot use set or list here.

Method does not exist or incorrect signature: [MAP<String,Case>].add(Id, SOBJECT:Case) at line 7 column 18

Trigger UpaatingPicklist on Case (After insert,after update)
{
    Map<String,case> cap=new Map<String,case>();
        for(case c:trigger.new)
            {
           
                 cap.add(c.accountid,c);
                
            }
}