• Alexander_E
  • NEWBIE
  • 35 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 6
    Questions
  • 19
    Replies
Hi there, 

we are starting to implement a middleware tool and want to use SOAP API.

Is there any Tool to test / validate a soap message.
We want to distinguish, if either the message or the tool has to be reviewed/modified.

(It would be great, if the tool works on windows.)

 

Hello,

 

has anyone else problems in contacting https://cs7-api.salesforce.com/ with Eclipse?

 

We have three developments on three different Sandbox Orgs on three independent computers. and eclipse installations work well on all of them and on any other instance, but not for CS7.

 

After contacting Salesforce Support and looking on "trust.salesforce.com/status" Salesforce is explaining some delays for Reports and Dashboards, but still nothing about Eclipse.

 

Even the Excel-Connector is working well, but a refresh with eclipse fails on timeout.

 

Here the notice from trust.salesforce for CS7.

 

02:00 PM UTC: CS7 Performance Degradation
The salesforce.com Technology Team is working to isolate a performance degradation issue affecting Dashboard and Report refreshes on the CS7 instance. A small subset of customers may experience delays when using these features.

Please check the status of trust.salesforce.com frequently for updates regarding this issue.

does anyone has created a new project in eclipse after installing the update eclipse integration "force.com ide"?

 

since I have updated it, I can't see the email folder anymore...

 

I searched now for hours, but cannot find it anymore.

deleting and recreating the project ; updating the metadata components or just new starting the hole computer after updating Java is not working.

 

any ideas/hints are welcome

Hi there,

 

I want to add several attachments to one email and sending this out.

I have no idea, where to add several attachments to the email in the code below. The two attachments are both pdf and less than 200KB.

 

If you can give me a hint, it would be great.

 

my first idea was to change

1.a Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();

to

1.b List<Messaging.Emailfileattachment> efa = new List<Messaging.Emailfileattachment>();

 

but than I am running to the issue not to be able to add the EmailFileAttachment to the (Messaging.SingleEmailMessage) email.

 

Here the code from the VisualForce Document http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_sending_attachments.htm modified by me.

 

 

public class sendEmail {
    public String subject { get; set; }
    public String body { get; set; }

    private final Account account;

    // Create a constructor that populates the Account object 
    
    public sendEmail() {
        account = [SELECT Name, 
                  (SELECT Contact.Name, Contact.Email FROM Account.Contacts) 
                   FROM Account 
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Account getAccount() {
        return account;
    }

    public PageReference send() {
        // Define the email 
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        // Reference the attachment page and pass in the account ID 
        Integer numAtts=[SELECT count() FROM attachment WHERE parentid=: account.Id];
        system.debug('Number of Attachments Atts = '+ numAtts);
        List<Attachment> allAttachment = new List<Attachment>();
    	allAttachment = [SELECT Id, Name, ContentType, Body FROM Attachment WHERE parentid =: account.Id];
        // Create the email attachment 
        //List<Messaging.Emailfileattachment> efa = new List<Messaging.Emailfileattachment>();
        Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();
		// try{ 
		if(numAtts > 0){
				for (Integer i = 0; i < numAtts; i++){
					system.debug(allAttachment[i].Name);
					efa.setFileName(allAttachment[i].Name);
					efa.setBody(allAttachment[i].Body);
					efa.setContentType(allAttachment[i].ContentType);
				}
		}
		 // } catch (ListException  e){
			// |DEBUG|List index out of bounds: 2
		 //         system.debug( e.getMessage() );
		// } 

        String addresses;
        if (account.Contacts[0].Email != null) {
            addresses = account.Contacts[0].Email;
            // Loop through the whole list of contacts and their emails 
    
            for (Integer i = 1; i < account.Contacts.size(); i++) {
                if (account.Contacts[i].Email != null) {
                    addresses += ':' + account.Contacts[i].Email;
                }
            }
        }

        String[] toAddresses = addresses.split(':', 0);

        // Sets the paramaters of the email 
    
        email.setSubject( subject );
        email.setToAddresses( toAddresses );
        email.setPlainTextBody( body );
        //email.setFileAttachments(new Messaging.EmailFileAttachment[] {List<efa>()});
        if(numAtts > 0){
        	email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        }

        // Sends the email 
        Messaging.SendEmailResult [] r = 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});   
        return null;
    }
}

 

 

 

Hello,

 

I have some experience in APEX and Visualforce, but still found issues on developing.

 

Could someone please give me an advice, how to overwrite the close date on Opportunities?

 

I have generated a new field on Opportunity, called NewDate__c (Date, Label: "New Close Date"). and a save-button on my ExtensionController.

everytime, when I access the NewDate__c in the method {!overridenewdatetoclosedate}, I receive this exeption:

Attempt to de-reference a null object
An unexpected error has occurred. Your development organization has been notified. 

 

my VF-PAge is this:

<apex:page standardController="Opportunity"
	extensions="ClsOppChangeCloseDate" action="{!init}">
	<apex:form id="FormChangeCloseDate1">
		<apex:pageBlock mode="inlineEdit" id="pb">
			<apex:pageBlockSection id="pbs1">
				<apex:commandButton action="{!overridenewdatetoclosedate}"
					value="Save all" id="btnSave" />
			</apex:pageBlockSection>
			<apex:pageBlockSection id="pbs2">
				<apex:outputField value="{!opportunity.closeDate}" />
				<apex:outputField value="{!opportunity.NewDate__c}" />
			</apex:pageBlockSection>
			<apex:pageBlockSection id="pbs3">
				<apex:outputText value="{!oldDate}" />
				<apex:outputText value="{!newDate}" />
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

my ExtensionController is this:

public class ClsOppChangeCloseDate {
	private ApexPages.StandardController stdCtrl;

	public Datetime oldDate {get; set;}
	public Datetime newDate  {get; set;}
	public Integer difDate {get; set;}

	public Opportunity chOpp {get; set;}

	public ClsOppChangeCloseDate(ApexPages.StandardController std){
		stdCtrl=std;
	}

	public void init(){
		Opportunity chOpp = [SELECT Id, Name, CloseDate, NewDate__c FROM Opportunity WHERE Id = :stdCtrl.getId()];
		oldDate = chOpp.CloseDate;
		newDate = chOpp.NewDate__c;
	} // end init();

	public PageReference overridenewdatetoclosedate(){
	newDate = chOpp.NewDate__c;
	stdCtrl.save();
	return null;
	}

	public PageReference save() {
		stdCtrl.save();
		return null;
	}
}

 

any hints are welcome!

Hello,

 

I can't save my developments in Eclipse Force.com IDE directly to the server.

 

When I click the disk to save the current modifications,

I have to click "save to server" separately.

 

On my Eclipse Log-file is the following entry:

 

 

!ENTRY com.salesforce.ide.core 2 0 2011-06-27 16:38:40.628
!MESSAGE  WARN [2011-06-27 16:38:40,627] (DefaultBuilder.java:applyDirtyMarkers:85) - TODO: apply 'Save locally only...' markers on each resource

 

 

If some one can tell me, where I can find the mistake, it would be very helpful.

 

The header of the log-file:

 

java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product

 

I am using Force.com IDE version 20.0.1.20101112

and Eclipse Helios Service Release 2

 

in Eclipse -> Project -> "Automatic Building" is activated.

 

It would be nice, if some one has an idea.

 

kind regards

 

Alexander

 

I'm trying to send emails to clients that are triggered by changes to the Opportunity. I've created two new fields on the Opportunity to hold the client's name and email address.

I've writted a trigger which works great expcept when you go to convert a lead into a contact with a new Opportunity.

trigger UpdateClientEmail on Opportunity (after update) {
   for (Opportunity o : Trigger.new) {
if (o.StageName <> 'Closed/Lost') {

       OpportunityContactRole ContactRole =
            [SELECT ContactID from OpportunityContactRole where IsPrimary = True and OpportunityId = :o.id]; 
       Contact c =
            [SELECT FirstName, Email FROM Contact WHERE ID = :ContactRole.ContactID];
       o.Client_Name__c = c.FirstName;
       o.Client_Email__c = c.Email;
       }
     }
     }

When I go to convert a new lead I get this error:

Error: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateClientEmail: execution of AfterUpdate caused by: System.QueryException: List has no rows for assignment to SObject Trigger.UpdateClientEmail: line 5, column 1: [] Class.leadconvert.BulkLeadConvert.handleOpportunityInserts: line 730, column 1 Class.leadconvert.BulkLeadConvert.convertLead: line 104, column 1

I'm not sure how to change my trigger so that it only applies to opportunities that have already been created. I've got workflows that get the fields updated correctly when a lead is created and converted. The only time I need the trigger is when the Primary Contact is changed from one contact to another or when the email address for the contact is changed.

Any help is much appreciated.

Hi,

 

Can you plaese give me an example or suggestion to Read Ms word (.doc/.docx)file through Apex.

  • October 25, 2013
  • Like
  • 1

I have a custom button that executes javascript.

 

{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")}
sforce.apex.execute("TestClass","CreateTestRecords", {id:"{!Case.Id}"});

 

In my apex class I want to return a PageReference to the same page from where the custom button was clicked (refreshing the page).  Is that possible using a webservice static method?

 

global class TestClass {
	
	WebService static void CreateTestRecords(String caseId) {
		List<Fulfillment__c> fulfillmentsToCreate = [select Id from Fulfillment__c where Case__c =: caseId];
		
		if(!fulfillmentsToCreate.isEmpty() && fulfillmentsToCreate.size() > 0) {
			insert fulfillmentsToCreate;
		}

	}
}

 

I was trying to avoid using a VF page and just handle everything in a controller.  Is that possible?

 

Thanks.

I am displaying documents in force.com sites but  large document with size 300kb  not displayed in sites.

I got the error like  Error: Insufficient Privileges .  Small size documents are  displaying perfectly but  large size documents are not displaying............


How to print large size documents in force.com sites.

my apex code is

 public transient list<document> doc {get;set;}
         public list<document> getFile() {
     
            doc = [SELECT Id, Name, Description, ContentType, Type, Url, BodyLength, Body ,keywords
                    FROM Document where name like 'a%'];
                 
           return doc;            
        } 

 

<apex:dataTable value="{!file}" var="item3"> 

   <apex:outputLink target="_blank" value="/servlet/servlet.FileDownload?file={!item3.Id}">  document view  </apex:outputLink>                                         

      </apex:dataTable>

 

Please help me !.....

  • September 24, 2012
  • Like
  • 0

does anyone has created a new project in eclipse after installing the update eclipse integration "force.com ide"?

 

since I have updated it, I can't see the email folder anymore...

 

I searched now for hours, but cannot find it anymore.

deleting and recreating the project ; updating the metadata components or just new starting the hole computer after updating Java is not working.

 

any ideas/hints are welcome

Hi there,

 

I want to add several attachments to one email and sending this out.

I have no idea, where to add several attachments to the email in the code below. The two attachments are both pdf and less than 200KB.

 

If you can give me a hint, it would be great.

 

my first idea was to change

1.a Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();

to

1.b List<Messaging.Emailfileattachment> efa = new List<Messaging.Emailfileattachment>();

 

but than I am running to the issue not to be able to add the EmailFileAttachment to the (Messaging.SingleEmailMessage) email.

 

Here the code from the VisualForce Document http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_sending_attachments.htm modified by me.

 

 

public class sendEmail {
    public String subject { get; set; }
    public String body { get; set; }

    private final Account account;

    // Create a constructor that populates the Account object 
    
    public sendEmail() {
        account = [SELECT Name, 
                  (SELECT Contact.Name, Contact.Email FROM Account.Contacts) 
                   FROM Account 
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Account getAccount() {
        return account;
    }

    public PageReference send() {
        // Define the email 
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        // Reference the attachment page and pass in the account ID 
        Integer numAtts=[SELECT count() FROM attachment WHERE parentid=: account.Id];
        system.debug('Number of Attachments Atts = '+ numAtts);
        List<Attachment> allAttachment = new List<Attachment>();
    	allAttachment = [SELECT Id, Name, ContentType, Body FROM Attachment WHERE parentid =: account.Id];
        // Create the email attachment 
        //List<Messaging.Emailfileattachment> efa = new List<Messaging.Emailfileattachment>();
        Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();
		// try{ 
		if(numAtts > 0){
				for (Integer i = 0; i < numAtts; i++){
					system.debug(allAttachment[i].Name);
					efa.setFileName(allAttachment[i].Name);
					efa.setBody(allAttachment[i].Body);
					efa.setContentType(allAttachment[i].ContentType);
				}
		}
		 // } catch (ListException  e){
			// |DEBUG|List index out of bounds: 2
		 //         system.debug( e.getMessage() );
		// } 

        String addresses;
        if (account.Contacts[0].Email != null) {
            addresses = account.Contacts[0].Email;
            // Loop through the whole list of contacts and their emails 
    
            for (Integer i = 1; i < account.Contacts.size(); i++) {
                if (account.Contacts[i].Email != null) {
                    addresses += ':' + account.Contacts[i].Email;
                }
            }
        }

        String[] toAddresses = addresses.split(':', 0);

        // Sets the paramaters of the email 
    
        email.setSubject( subject );
        email.setToAddresses( toAddresses );
        email.setPlainTextBody( body );
        //email.setFileAttachments(new Messaging.EmailFileAttachment[] {List<efa>()});
        if(numAtts > 0){
        	email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        }

        // Sends the email 
        Messaging.SendEmailResult [] r = 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});   
        return null;
    }
}

 

 

 


    for(Ordr__c o : Trigger.new)
    {     
      //record created by manager, assign ownership to employee
        if(o.Employee__c!=null)
      {
        if(employeeMap.get(o.Employee__c).User_Name__c==null)
        {
               o.OwnerId=employeeMap.get(o.Employee__c). State__r.Mkt__r.AGM__c  ;
        }

 

What i am basically doing is i have an order in which there is an employee field which is a look up to employee  and employee is look up to user

 

When employee field is nul in an order the owner of the order should be assigned to the market agm

 

When  i am trying to make the employee field blank and save its not getting updated....Could you say where shuld i make a change

 

I want multiple orgs to be able to copy my apex code from my org, so I expected the Enterprise  to be best placed for this, but could also use the Partner wsdl and the query method to query ApexClass object.

 

But when I try to import the wsdl I get errors

 

The faultPartnerSoapSforceCom sobjectPartnerSoapSforceCom class are made, but not partnerSoapSforceCom



 

Error: partnerSoapSforceCom


Error: unexpected token: 'delete' at 670:51

 

 

Hello,

 

I have some experience in APEX and Visualforce, but still found issues on developing.

 

Could someone please give me an advice, how to overwrite the close date on Opportunities?

 

I have generated a new field on Opportunity, called NewDate__c (Date, Label: "New Close Date"). and a save-button on my ExtensionController.

everytime, when I access the NewDate__c in the method {!overridenewdatetoclosedate}, I receive this exeption:

Attempt to de-reference a null object
An unexpected error has occurred. Your development organization has been notified. 

 

my VF-PAge is this:

<apex:page standardController="Opportunity"
	extensions="ClsOppChangeCloseDate" action="{!init}">
	<apex:form id="FormChangeCloseDate1">
		<apex:pageBlock mode="inlineEdit" id="pb">
			<apex:pageBlockSection id="pbs1">
				<apex:commandButton action="{!overridenewdatetoclosedate}"
					value="Save all" id="btnSave" />
			</apex:pageBlockSection>
			<apex:pageBlockSection id="pbs2">
				<apex:outputField value="{!opportunity.closeDate}" />
				<apex:outputField value="{!opportunity.NewDate__c}" />
			</apex:pageBlockSection>
			<apex:pageBlockSection id="pbs3">
				<apex:outputText value="{!oldDate}" />
				<apex:outputText value="{!newDate}" />
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

my ExtensionController is this:

public class ClsOppChangeCloseDate {
	private ApexPages.StandardController stdCtrl;

	public Datetime oldDate {get; set;}
	public Datetime newDate  {get; set;}
	public Integer difDate {get; set;}

	public Opportunity chOpp {get; set;}

	public ClsOppChangeCloseDate(ApexPages.StandardController std){
		stdCtrl=std;
	}

	public void init(){
		Opportunity chOpp = [SELECT Id, Name, CloseDate, NewDate__c FROM Opportunity WHERE Id = :stdCtrl.getId()];
		oldDate = chOpp.CloseDate;
		newDate = chOpp.NewDate__c;
	} // end init();

	public PageReference overridenewdatetoclosedate(){
	newDate = chOpp.NewDate__c;
	stdCtrl.save();
	return null;
	}

	public PageReference save() {
		stdCtrl.save();
		return null;
	}
}

 

any hints are welcome!

Hello,

 

I can't save my developments in Eclipse Force.com IDE directly to the server.

 

When I click the disk to save the current modifications,

I have to click "save to server" separately.

 

On my Eclipse Log-file is the following entry:

 

 

!ENTRY com.salesforce.ide.core 2 0 2011-06-27 16:38:40.628
!MESSAGE  WARN [2011-06-27 16:38:40,627] (DefaultBuilder.java:applyDirtyMarkers:85) - TODO: apply 'Save locally only...' markers on each resource

 

 

If some one can tell me, where I can find the mistake, it would be very helpful.

 

The header of the log-file:

 

java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product

 

I am using Force.com IDE version 20.0.1.20101112

and Eclipse Helios Service Release 2

 

in Eclipse -> Project -> "Automatic Building" is activated.

 

It would be nice, if some one has an idea.

 

kind regards

 

Alexander

 

Hello,

 

The Issue i am facing is, After the migration of data from legacy system. Changed the text field to Autonumber so that after all the legacy data is brought in it starts with a sequence. Now when records are created the Autonumber field is not showing up in the sequence as it is meant to be (ex: 12102, 12204, 13518) sequence is not followed when new records are created.

 

 

Could please let me know what could have caused for the autonumber to mess up with sequence.

 

Thanks in Adavance.

 

 


 I am running the Trigger in which i m trying to debug the "Trigger.new" in which i am not able to see the listprice field of QuoteLineItem. All other fields are displaying but not the listprice field.  It is read only field. I am getting the value from PriceBookEntry's unitprice field into the listprice field of QuoteLineItem.  When I am checking the QLI(QuoteLineItem)

has been inserted. I am able get the value in listprice field but it is not displaying in the Trigger.new. By this i am not able to do my Test Coverage 100%. It is just coming 47%.

Any help will be appreciated in this regard.

 

Trigger

---------------------

trigger SampleTestTrigger on QuoteLineItem(before insert, before update)
{

for(QuoteLineItem li: Trigger.new){
if(li.listprice!=null)
{
If(li.unitprice!=null){
if(li.discount==null)
{
-- some code here--
li.unitprice=li.listprice;
}
}
}
}

 

Test Class

------------

 

PricebookEntry pbe=new PricebookEntry();
pbe.Pricebook2Id=pb.id;
pbe.Product2Id=p.id;
pbe.IsActive=true;
pbe.UnitPrice=10;
insert pbe;


QuoteLineItem qli = new  QuoteLineItem();
qli.quoteId=q.id;
qli.pricebookentryid=pbe.id;
qli.quantity=1;
qli.unitprice=5;
qli.discount=0.02;
insert qli;

qli.discount=null;
Test.startTest();
update qli;
Test.stopTest();

 

// checking the QLI has been inserted

 

for(QuoteLineItem y :[select discount,unitprice,listprice from quotelineItem where createdDate=Today and unitprice=5])
{

// here value of listprice coming
}

 

Hello everybody, maybe someone can help me? I stuck again with my Extension Controller / maybe with my visualforce Page too. 

I am training myself in a Developer-Edition, to understand Controllers and Visiualforce more.

 

I builded a Visualforce Page which is the Template for the Salesforce Quote Template (rendered as PDF)

My Quote line Items are sorted by a line Item Field maually by the user. All this worked out well.

 

Now i wanted push this more forward. My Goal is to sort the line items in groups so i can give out a price for every group.

 

For Example:

Group 1         Group Total Value 60 €             

#1   Line item a   10€

#2   Line item b   20€

#3   Line item c   30€

 

Group 2         Group Total Value 180 €

#4   Line item d   50€

#5   Line item e   60€

#6   Line item f    70€

 

.... and so on

 

What i did:

There is a custom Object called "QuotePhase" where Quote is the Master Object.

I have a Lookup field on the QuoteLineItems so i can reference them to the different Phases/Groups

- also set up a lookup-filter to make sure a user can only select a Phase that belongs to the quote which is the master of the Phase

- and a apex trigger which calculates values of all related Items related to the Phase (rollup is not available for lookups :-/ )

 

So here i stuck: i don't get the list to work proberbly.

I think its maybe a little detail on my controller or my List call on the visualforce. But all my try and error approaches brought me to results here.

 

Here is my Controller Extension:

public with sharing class ExtensionControllerQuote {

    public List<QuoteLineItem> QuoteLineItemsSorted {public get; private set;}
    public List<QuotePhase__c> QuotePhaseSorted {public get; private set;}
    Quote selectedQuote = new Quote();
    
    // constructor
    public ExtensionControllerQuote(ApexPages.StandardController cont)
    {
        selectedQuote = (Quote)cont.getRecord();
        QuoteLineItemsSorted = new List<QuoteLineItem>();
        QuoteLineItemsSorted =
            [Select o.New_Section_Headline__c,
                    o.Sort_Order__c,
                    o.Quantity,
                    o.Einheit__c,
                    o.PricebookEntry.Name,
                    o.PricebookEntryId,
                    o.Product_lineitem_description__c,
                    o.UnitPrice,
                    o.TotalPrice
             From QuoteLineItem o
             Where o.QuoteId =: selectedQuote.id
             ORDER BY Sort_Order__c ASC
             limit 1000
                ];
        selectedQuote = (Quote)cont.getRecord();
        QuotePhaseSorted = new List<QuotePhase__c>();
        QuotePhaseSorted =
            [Select q.Sum_of_Phases__c,
                    q.Name
             From QuotePhase__c q
             Where q.RelatedQuoteID__c =: selectedQuote.id
             ORDER BY q.Name ASC
             limit 1000
                ];

    }
}


And here Code Snippets out of my Visualforce:

<apex:page standardController="Quote" renderas="pdf" showHeader="false" extensions="ExtensionControllerQuote">

 

.... Blah blah ..... there comes the repeat:

 

<apex:repeat value="{!QuotePhaseSorted}" var="phase">
{QuotePhase_Name}
    <apex:repeat value="{!QuoteLineItemsSorted}" var="line">
       {!line.Quantity}
    </apex:repeat>
</apex:repeat>

 

</apex:page>

 

If needed i can post the whole Visualforce code here. But i guess i made an obvious error somewhere which is maybe easy to find for those who are more skilled than me. Please teach me what i do wrong here.

 

Controller

System.debug('opportunityLineItems ------------------'+opportunityLineItems);
for(OpportunityLineItem opportunityLineItem:opportunityLineItems){
System.debug('opportunityLineItem------------------'+opportunityLineItem);
System.debug('PricebookEntryId------------------'+opportunityLineItem.PricebookEntryId);
System.debug('PricebookEntry Name------------------'+opportunityLineItem.PricebookEntry.Name);

}

 

VF

<apex:pageBlockTable value="{!OpportunityLineItems}" var="item" headerClass="headerRow" rowClasses="odd even">
<apex:column value="{!item.PricebookEntry.Name}" headerClass="headerRow" headerValue="Deal Products" />
<apex:column value="{!item.PricebookEntry.ProductCode}" headerClass="headerRow" headerValue="Part Number" />
<apex:column headerClass="headerRow" headerValue="QTY" value="{!item.Quantity}"/>
<apex:column headerClass="headerRow" headerValue="MSRP" value="{!item.ListPrice}" />
</apex:pageBlockTable>

  • April 21, 2011
  • Like
  • 0
To use the built in formatter of Eclipse we can ideally use the ctrl+shift+F key. However this doesnt seem to work when I try formatting my apex classes.
Can anyone tell me if I need to change some settings to format the code?


Hi All,

I am writting a unit testing method for my apex trigger and when running the following piece of code in the apex class I get the error message INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY while creating the "OpportunityLineItemSchedule". I have tried putting the "OpportunityLineItemId" hard coded then also it is showing the same error message. I cannot re move this as this is a required field.

public class testCodeCoverage
{
    static testMethod void myTest()
    {
        OpportunityLineItem acccobj = new OpportunityLineItem(OpportunityId = 'AAAAAAAAAA', Description='This is a test descriptiion',Quantity=3,UnitPrice=5000,PricebookEntryId='11111');
        insert acccobj;
        OpportunityLineItemSchedule acccobj1 = new OpportunityLineItemSchedule(OpportunityLineItemId=acccobj.Id,Description='This is a test description',Revenue=10000,ScheduleDate=Date.newInstance(2008,02,02),Quantity=2,Type='both');
        insert acccobj1;
    }
}

Thanks in anticipation of your kind and helpful response.

thanks and regards
pallav
  • February 05, 2008
  • Like
  • 0

Hi,

 

Can you plaese give me an example or suggestion to Read Ms word (.doc/.docx)file through Apex.

  • October 25, 2013
  • Like
  • 1