• Shot
  • NEWBIE
  • 229 Points
  • Member since 2015

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 64
    Replies
Afternoon everyone,

So I was wondering how to approach the following situation, i've been on the platform for about a year and a half now and still learning the programming side of things.

We have a custom obj called Employment History ("EH") which looks up to Contacts (since contacts can have many "employment" records). The EH associates to specific accounts that the person has worked for. The lookup field is called Contact_LU__c and the child relationship name for the lookup is Employment_Ownership_Histories.

What I am trying to do is the following:

I made a standard controller using Account with an extension (ExtensionEHReport) which will get the data so I can show it in a VFP.

I am trying to have the controller get the current EH for the account where status = active as a list and then iterate through the list. My problem is setting criteria in for loop for the list. So I have something like the following:
 
Account acct;
 public  List<Employment_History__c>       getEH {get; set;}
 public  List<Employment_History__c>       pastEH {get; set;}

public EHReportExtension(Apexpages.standardcontroller std)
{  
acct = (Account)std.getRecord();

getEH = [SELECT Contact_LU__c FROM Employment_History__c WHERE Account__c = :acct.Id AND Employee_Type__c ='Principal' AND Employee_Status__c = 'Active' ];

for(Employment_History__c a : getEH)
{
PastEH = [SELECT Account__c,Employee_Type__c,Job_Title__c,Employee_Status__c,Contact_Lu__c,
Disclosure_Date__c,of_Shares_Owned__c,of_ownership__c
FROM Employment_History__c WHERE  <I need to set the Contact_LU__c to the value in the list above (getEH).... but it doesn't work> ];
}
Now I tried using maps, but since they're unordered; I feel as if that's not the right approach, but to be honest I am uncertain about maps and sets and how to use them properly anyway. 

Any help you can provide would be awesome. Thanks.
 
Hey guys, I have a trigger with code:
/*// Trigger runs getLocation() on Accounts with no Geolocation

trigger SetGeolocation on Account (after insert, after update) {
    for (Account a : trigger.new)
    if (a.Location__Latitude__s == null)
          LocationCallouts.getLocation(a.id);
}*/

// Trigger runs getLocation() on Accounts with no Geolocation

trigger SetGeolocation on Account (after insert, after update) {
    for (Account a : trigger.new){
        if(system.isFuture() == FALSE){
          LocationCallouts.getLocation(a.id);
        }
    }
}

This pulls an apex class that has this code:
 
public class LocationCallouts {

     @future (callout=true)  // future method needed to run callouts from Triggers
      static public void getLocation(id accountId){
        // gather account info
        Account a = [SELECT BillingCity,BillingCountry,BillingPostalCode,BillingState,BillingStreet FROM Account WHERE id =: accountId];

        // create an address string
        String address = '';
        if (a.BillingStreet != null)
            address += a.BillingStreet +', ';
        if (a.BillingCity != null)
            address += a.BillingCity +', ';
        if (a.BillingState != null)
            address += a.BillingState +' ';
        if (a.BillingPostalCode != null)
            address += a.BillingPostalCode +', ';
        if (a.BillingCountry != null)
            address += a.BillingCountry;

        address = EncodingUtil.urlEncode(address, 'UTF-8');

        // build callout
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('http://maps.googleapis.com/maps/api/geocode/json?address='+address+'&sensor=false');
        req.setMethod('GET');
        req.setTimeout(60000);

        try{
            // callout
            HttpResponse res = h.send(req);

            // parse coordinates from response
            JSONParser parser = JSON.createParser(res.getBody());
            double lat = null;
            double lon = null;
            while (parser.nextToken() != null) {
                if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) &&
                    (parser.getText() == 'location')){
                       parser.nextToken(); // object start
                       while (parser.nextToken() != JSONToken.END_OBJECT){
                           String txt = parser.getText();
                           parser.nextToken();
                           if (txt == 'lat')
                               lat = parser.getDoubleValue();
                           else if (txt == 'lng')
                               lon = parser.getDoubleValue();
                       }

                }
            }

            // update coordinates if we get back
            if (lat != null){
                a.Location__Latitude__s = lat;
                a.Location__Longitude__s = lon;
                update a;
            }

        } catch (Exception e) {
        }
    }
}

The problem is, I am going above the 10 max limit of future calls in Apex...

can someone please explain how I would convert my apex class intoa batch apex class so it runs request one at a time? See this threaD:

https://developer.salesforce.com/forums/ForumsMain?id=906F000000091NoIAI
I am working on a Trailhead Challenge and receive this error when I execute.

User-added image

Create an Apex class that returns contacts based on incoming parameters.

For this challenge, you will need to create a class that has a method accepting two strings. The method searches for contacts that have a last name matching the first string and a mailing postal code (API name: MailingPostalCode) matching the second. It gets the ID and Name of those contacts and returns them.The Apex class must be called 'ContactSearch' and be in the public scope.
The Apex class must have a public static method called 'searchForContacts'.
The 'searchForContacts' method must accept two incoming strings as parameters, find any contact that has a last name matching the first, and mailing postal code matching the second string. The method should return a list of Contact records with at least the ID and Name fields.
The return type for 'searchForContacts' must be 'List<Contact>'.

Here's my code:

User-added image

Can someone assist me? Please.

Thank you,
Darren
Hi,

I have just passed the challenge Using Apex in Components. But i am not satisfied with my solution. Here is it :
Component :
<aura:component controller="DisplayCaseController">
    <aura:attribute name="record" type="Case"/>
    <aura:attribute name="caseId" type="String" default="500F000000XgaGj"/>
    <br/>
    <ui:inputText label="Case Id: " value="{!v.caseId}"/>
    <ui:button label="Get Case" press="{!c.getCase}" />
    <br/>
    <ui:outputText value="{!v.record.Subject}"/>
    <br/>
    <ui:outputTextArea value="{!v.record.Description}"/>
    <br/>
    <ui:outputText value="{!v.record.Status}"/>
    <br/>
</aura:component>

Client Side Controller
({
    getCase : function(component) {
        var action=component.get("c.getCaseFromId");
        action.setParams({"caseID" : component.get("v.caseId")});
        action.setCallback(this, function(a){
            if (a.getState() === "SUCCESS") {
                component.set("v.record",a.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    }
})
The weaknesses are in my opinion :
* if no id or a bad id like 25000 or 0 is given as input then " An internal server error has occurred Error ID: 1632438745-20058 (-467814789)" is displayed.
  The server side component got an exception 15:10:49:826 FATAL_ERROR System.StringException: Invalid id: 25000 or 0
* If the input id is a contact id for example then the apex controller works as expected and returns the '"first" contact.
* I can figure out how to get a case id set to null in the server side controller nor how to validate the id in the client side controller.
Could someone give some clue or some reference to improve this solution ?
Thanks in advance

 
I am using a Marketing Automation Tool that will Create a Contact (not using Leads), I created a trigger to create Account (FirstName LastName and - Account, I get error and trigger and test class below:

Error Message System.ListException: List index out of bounds: 0
Stack Trace Class.CreateAccountFromContact_UnitTest.runTest: line 14, column 1

trigger CreateAccountFromContact on Contact (before insert) {
//Collect list of contacts being inserted without an account
    List<Contact> needAccounts = new List<Contact>();
    for (Contact c : trigger.new) {
        if (String.isBlank(c.accountid)) {
            needAccounts.add(c);
        }
    }
   
    if (needAccounts.size() > 0) {
        List<Account> newAccounts = new List<Account>();
        Map<String,Contact> contactsByNameKeys = new Map<String,Contact>();
        //Create account for each contact
        for (Contact c : needAccounts) {
            String accountName = c.firstname + ' ' + c.lastname + ' ' + ' - Account ';
            contactsByNameKeys.put(accountName,c);
            Account a = new Account(name=accountName);
            newAccounts.add(a);
        }
        insert newAccounts;
       
              
  }     
}
 
@isTest
public with sharing class CreateAccountFromContact_UnitTest {
    @isTest
    public static void runTest(){
        String firstname = 'first';
        String lastname = 'last';
               
        //Create contact
        Contact c = new Contact(firstname=firstname, lastname=lastname);
        insert c;
        
        //Verify account
        c = [select id, accountid, firstname, lastname from Contact where id =:c.Id][0];
        Account a = [select id, name from Account where id = :c.accountId][0];
        
        system.assertEquals(firstname + ' ' + lastname + ' ' + ' - Account ', a.name);
        
        
    }
}
  • March 04, 2015
  • Like
  • 0
Hello Everyone,

I am trying to write a test class for my trigger which updates the Contacts Mailing to Accounts Biliing Address whenever the  Accounts Billing Address is updated.
This is my Trigger

trigger UpdateContactBillingAddress on Account (after update) {

    Set<Id> accountId = new Set<Id>();
    List<Contact> contactsToUpdate = new List<Contact>();
    
    for(Account acc: Trigger.new){

        // Please perform a check to see if address was updated

        accountId.add(acc.Id); //accounts that were updated.
    }
    
    for(Contact c : [Select Id, MailingCity, MailingStreet, MailingCountry, 
                            Account.BillingCity, Account.BillingStreet, Account.BillingCountry 
                      from Contact where Account.Id in: accountId]){

                 c.MailingCity = c.Account.BillingCity;
                 ///same for rest of the fields
                 
                 contactsToUpdate.add(c);
    }

    update contactsToUpdate;
    
}

I am having a hard time writing its test Class,This is what I have done so far:
@isTest 
public class UpdateContactBillingAddress_Test{
    static testMethod void testupdates() {

     // Let's create our records from scratch!
       Account a= new Account();
       a.Name='TestAccount';
       a.BillingStreet='hjasadhj';
       insert a;
        Contact c = [SELECT Id, MailingStreet,MailingCity FROM Contact WHERE AccountId = :a.Id];
        System.assertEquals('hjasadhj', c.MailingStreet);
        System.assertEquals('High', c.MailingStreet);
       }
      }

Why am i getting error while running the code?
Any help will be appreciated.
Thanks.
Hi guys, here is the case, i have some record with fields, which i show in table on the page. And lets say user update one of the fields, so i want to save time when he\she modified this record to some hidden field. So need somehow send id of the record to javascript and do this there or use somehow a actionFunction. Can you help me with some examples.
<script>
        function updateModifyAtField(questionId){
            ...update ModifyAt field here
        }
    </script>

<apex:actionFunction name="updateModifyAtField" action="..." rerender="form"/>

<apex:column headerValue="Name" >
   <apex:inputField value="{!question.Name}" onChange="updateModifyAtField()"/>
</apex:column>

<apex:column headerValue="ModifyAt" >
   <apex:inputField id="{!question.Id}"  value="{!question.ModifyAt}" />
</apex:column>

 
  • October 28, 2015
  • Like
  • 0
Guys, stuck with the problem with mavensmate (MM), it doesnt pull any updates from my org, if i change any file on server and in MM click on this file -> refresh from server, it wont update it. And if i add a new class in org it wont appear in MM. But at the same time MM pushes updates to org. So password, token is right. Looks like it has connection only in one way. Any suggestions about this issue?
  • August 06, 2015
  • Like
  • 0
I don't know how i missed this before, but recently i realized, that my accountList vf page doesnt work without id.
And it is ok if we use standardController only. But if we use recordSetVar, which should give us some random elements form database, why it needs id also?

Lets say we created this VF page:
<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
  <apex:pageBlock >
    <apex:pageBlockTable value="{!accounts}" var="a">
      <apex:column value="{!a.name}"/>
    </apex:pageBlockTable>
  </apex:pageBlock>
</apex:page>
Then we click Preview and dont see anything.
User-added image

Now if we check the link we will find something like ...​visual.force.com/apex/AccountListTest?core.apexpages.request.devconsole=1
Let's add any id, even fake one: ...​visual.force.com/apex/AccountListTest?core.apexpages.request.devconsole=1&id=11111000003hffW
Boom! It works now:
User-added image


 
  • March 19, 2015
  • Like
  • 0
I wrote some test logic for sending an email from VF page with using apex class.
Javascript from VF page:
function sendMessage(){
        var receiver = document.getElementById("receiverId").value;
        var pattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/;
        if(receiver.length > 0 && pattern.test(receiver)){
            var subject = "{!$User.FirstName}" + " " + "{!$User.LastName}" + " contact information";
            var body = document.getElementById("info").innerHTML.trim();
            
            sforce.connection.sessionId = "{!$Api.Session_ID}"; 
            var success = sforce.apex.execute("Emailer", "sendEmail", {toAddress: receiver, subject: subject, body: body});
            
            if(success){
                alert("Email was sent successfully.");
            } else {
                alert("Email was not sent. There is some error!");
            }
        } else {
            alert("Wrong email");
        }
    };
Apex class:
global class Emailer {
    webService static Boolean sendEmail(String toAddress, String subject, String body){
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[]{toAddress};
        mail.setToAddresses(toAddresses);
        mail.setSubject(subject);
        mail.setPlainTextBody(body);
        Messaging.SendEmailResult[] result = Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
        
        return result[0].isSuccess();
    }    
}
Is there a way to do the same without apex class, just using VF and javascript(remote objects or something like that)?
  • March 18, 2015
  • Like
  • 0
Stuck with this task. Tried many ways to do in Process Builder (checked if AccountId not null, checked if account street, city, country, state not null, checked if these fields were changed etc), but always have mistake:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. 
A flow trigger failed to execute the flow with version ID 30124000000L3C5. 
Contact your administrator for help.: []

On mail i get:
caused by element : FlowDecision.myDecision
caused by: The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.

Any ideas, how to pass this task?
Thanks
  • March 09, 2015
  • Like
  • 0
public class CaseListCtrl {
    public String s1 {get;set;}
    public String s2 {get;set;}
    public String s3 {get;set;}
    public String s4 {get;set;}
    public String s5 {get;set;}
    public String s6 {get;set;}
    public String s7 {get;set;}
    
    /*List<Case> caseList = [SELECT Id, Labels2__c FROM Case Limit 20];
    
    ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(caseList);*/
    
    private final Case c;
    
    public CaseListCtrl(ApexPages.StandardSetController controller) {
        this.c = (Case)controller.getRecord();
    }
    
    public List <Case> getCases(){
        return [SELECT Id, Labels2__c FROM  Case];
    }
    
    public List<Case> caseRecords {
        get {
            return [SELECT Id, Labels2__c FROM Case];
        }
        private set;
    }
    
    /*public List<Case> getCaseListCtrl() {
        return (List<Case>) caseRecords.getRecords();
    }*/
    
    Public ApexPages.Action getIt(){
        List<List<String>> lstS = new List<List<String>>();
        String[] setS = new List<String>();
        for (integer i = 0; i < 20; i++){
            Case cR = caseRecords[i];
        	lstS.add(cr.Labels2__c.split(';'));
        }
        if (lstS != null){
            for (integer i = 1; i < lstS.size(); i++){
                s1 = lstS.get(i)[0];
                s2 = lstS.get(i)[1];
                s1 = lstS.get(i)[2];
                s2 = lstS.get(i)[3];
                s1 = lstS.get(i)[4];
                s2 = lstS.get(i)[5];
                s1 = lstS.get(i)[6];
                s2 = lstS.get(i)[7];
            }
        }
		return null;
    }
}
<apex:page standardController="Case" recordSetVar="cases" sidebar="true" standardstylesheets="false" showheader="true" extensions="CaseListCtrl" action="{!getIt}">
<apex:form >
    {!s1}
    {!s2}
    {!s3}
    {!s4}
    {!s5}
    {!s6}
    {!s7}

</apex:form>
</apex:page>

My intent is to grab values from a multi-picklist field "labels2__c" and display it as a single value in a visualforce page.

This is the error: 

 

System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!getIt}' in component <apex:page> in page testctrlcase: Class.CaseListCtrl.getIt: line 40, column 1
Class.CaseListCtrl.getIt: line 40, column 1

Thanks,
Adelchi

Hi guys, here is the case, i have some record with fields, which i show in table on the page. And lets say user update one of the fields, so i want to save time when he\she modified this record to some hidden field. So need somehow send id of the record to javascript and do this there or use somehow a actionFunction. Can you help me with some examples.
<script>
        function updateModifyAtField(questionId){
            ...update ModifyAt field here
        }
    </script>

<apex:actionFunction name="updateModifyAtField" action="..." rerender="form"/>

<apex:column headerValue="Name" >
   <apex:inputField value="{!question.Name}" onChange="updateModifyAtField()"/>
</apex:column>

<apex:column headerValue="ModifyAt" >
   <apex:inputField id="{!question.Id}"  value="{!question.ModifyAt}" />
</apex:column>

 
  • October 28, 2015
  • Like
  • 0
Guys, stuck with the problem with mavensmate (MM), it doesnt pull any updates from my org, if i change any file on server and in MM click on this file -> refresh from server, it wont update it. And if i add a new class in org it wont appear in MM. But at the same time MM pushes updates to org. So password, token is right. Looks like it has connection only in one way. Any suggestions about this issue?
  • August 06, 2015
  • Like
  • 0
Hi ,

I have 4 fields containg text values of time it took to complete an application

Form_Completion_Time_Application_Form_P1__c
Form_Completion_Time_Application_Form_P2__c
Form_Completion_Time_Application_Form_P3__c
Form_Completion_Time_Application_Form_P4__c

and the data these fields return are "Consistant enough". Here are all possible  Scenarios
3 min. 41 sec.
13 min. 31 sec
12 min. 1 sec
1 min. 9 sec.
28 sec.
9 sec.

I would like to be able to add up all of those 4 fields to get a total, and not sure how to go about it. I tried many things, Substitute formula being the closest I got to it, but still not good enough

The total could either be in total seconds, mm:ss or whatever idea any of you can help me with 


Thank you in advance :)
  • April 09, 2015
  • Like
  • 0
Afternoon everyone,

So I was wondering how to approach the following situation, i've been on the platform for about a year and a half now and still learning the programming side of things.

We have a custom obj called Employment History ("EH") which looks up to Contacts (since contacts can have many "employment" records). The EH associates to specific accounts that the person has worked for. The lookup field is called Contact_LU__c and the child relationship name for the lookup is Employment_Ownership_Histories.

What I am trying to do is the following:

I made a standard controller using Account with an extension (ExtensionEHReport) which will get the data so I can show it in a VFP.

I am trying to have the controller get the current EH for the account where status = active as a list and then iterate through the list. My problem is setting criteria in for loop for the list. So I have something like the following:
 
Account acct;
 public  List<Employment_History__c>       getEH {get; set;}
 public  List<Employment_History__c>       pastEH {get; set;}

public EHReportExtension(Apexpages.standardcontroller std)
{  
acct = (Account)std.getRecord();

getEH = [SELECT Contact_LU__c FROM Employment_History__c WHERE Account__c = :acct.Id AND Employee_Type__c ='Principal' AND Employee_Status__c = 'Active' ];

for(Employment_History__c a : getEH)
{
PastEH = [SELECT Account__c,Employee_Type__c,Job_Title__c,Employee_Status__c,Contact_Lu__c,
Disclosure_Date__c,of_Shares_Owned__c,of_ownership__c
FROM Employment_History__c WHERE  <I need to set the Contact_LU__c to the value in the list above (getEH).... but it doesn't work> ];
}
Now I tried using maps, but since they're unordered; I feel as if that's not the right approach, but to be honest I am uncertain about maps and sets and how to use them properly anyway. 

Any help you can provide would be awesome. Thanks.
 
Hey guys, I have a trigger with code:
/*// Trigger runs getLocation() on Accounts with no Geolocation

trigger SetGeolocation on Account (after insert, after update) {
    for (Account a : trigger.new)
    if (a.Location__Latitude__s == null)
          LocationCallouts.getLocation(a.id);
}*/

// Trigger runs getLocation() on Accounts with no Geolocation

trigger SetGeolocation on Account (after insert, after update) {
    for (Account a : trigger.new){
        if(system.isFuture() == FALSE){
          LocationCallouts.getLocation(a.id);
        }
    }
}

This pulls an apex class that has this code:
 
public class LocationCallouts {

     @future (callout=true)  // future method needed to run callouts from Triggers
      static public void getLocation(id accountId){
        // gather account info
        Account a = [SELECT BillingCity,BillingCountry,BillingPostalCode,BillingState,BillingStreet FROM Account WHERE id =: accountId];

        // create an address string
        String address = '';
        if (a.BillingStreet != null)
            address += a.BillingStreet +', ';
        if (a.BillingCity != null)
            address += a.BillingCity +', ';
        if (a.BillingState != null)
            address += a.BillingState +' ';
        if (a.BillingPostalCode != null)
            address += a.BillingPostalCode +', ';
        if (a.BillingCountry != null)
            address += a.BillingCountry;

        address = EncodingUtil.urlEncode(address, 'UTF-8');

        // build callout
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('http://maps.googleapis.com/maps/api/geocode/json?address='+address+'&sensor=false');
        req.setMethod('GET');
        req.setTimeout(60000);

        try{
            // callout
            HttpResponse res = h.send(req);

            // parse coordinates from response
            JSONParser parser = JSON.createParser(res.getBody());
            double lat = null;
            double lon = null;
            while (parser.nextToken() != null) {
                if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) &&
                    (parser.getText() == 'location')){
                       parser.nextToken(); // object start
                       while (parser.nextToken() != JSONToken.END_OBJECT){
                           String txt = parser.getText();
                           parser.nextToken();
                           if (txt == 'lat')
                               lat = parser.getDoubleValue();
                           else if (txt == 'lng')
                               lon = parser.getDoubleValue();
                       }

                }
            }

            // update coordinates if we get back
            if (lat != null){
                a.Location__Latitude__s = lat;
                a.Location__Longitude__s = lon;
                update a;
            }

        } catch (Exception e) {
        }
    }
}

The problem is, I am going above the 10 max limit of future calls in Apex...

can someone please explain how I would convert my apex class intoa batch apex class so it runs request one at a time? See this threaD:

https://developer.salesforce.com/forums/ForumsMain?id=906F000000091NoIAI
I am working on a Trailhead Challenge and receive this error when I execute.

User-added image

Create an Apex class that returns contacts based on incoming parameters.

For this challenge, you will need to create a class that has a method accepting two strings. The method searches for contacts that have a last name matching the first string and a mailing postal code (API name: MailingPostalCode) matching the second. It gets the ID and Name of those contacts and returns them.The Apex class must be called 'ContactSearch' and be in the public scope.
The Apex class must have a public static method called 'searchForContacts'.
The 'searchForContacts' method must accept two incoming strings as parameters, find any contact that has a last name matching the first, and mailing postal code matching the second string. The method should return a list of Contact records with at least the ID and Name fields.
The return type for 'searchForContacts' must be 'List<Contact>'.

Here's my code:

User-added image

Can someone assist me? Please.

Thank you,
Darren

Can any one help me on this? I have a Visualforce page created on Opportunity object which is in PDF format. I have a few RollUp summary fields created on opportunity object. There is a Wrapper class written on Opportunity Product. Now I would like to call these RollUp summary fields in the wrapper class based on a Condition. How do I wrap the RollUp summary field in a class? Any help very much appreciated.

Subtotal__c and Non_Pick_Total__c are Roll up summary fields on Opportunity Object. They give the "Sum" of Opportunity Product aggregates on Extension Field.

Extension(Extension=qty*1) is a Formula field data type as Currency on Opportunity Product.

The issue I'm having is that the "Extension" field value is getting calculated based on the formula field but it should get calculated as per the changes made in the VisualForce page and display (Extension = Qty*0.01) on the subtotal.
 
for (integer i=0; i < OPplineitem.size(); i++) {
    tempObj = new wrapperClass();
    tempObj.productname= OPplineitem[i].PricebookEntry.Product2.Name;
    tempObj.BinItemCode=OPplineitem[i].Bin_Item_Code__c;
    tempObj.quantity=OPplineitem[i].Quantity;
    tempObj.totalamount=OPplineitem[i].Sys_total_Amount__c;
    // tempObj.Subtotal =OPplineitem[i].Opportunity.Subtotal__c;
    //   tempObj.NonPickTotal=OPplineitem[i].Opportunity.Non_Pick_Total__c;
    //Add a conditional statement here
    if (OPplineitem[i].PricebookEntry.Product2.Product_Line__c=='DIE') {
        tempObj.unitprice=0.01;
        tempobj.extension=OPplineitem[i].Quantity * tempObj.unitprice;
        tempObj.productname=OPplineitem[i].Bin_Item_Code__c;

        if (i==0) {
            tempObj2.Subtotal=tempobj.extension;
            system.debug('@@@@@@@@'+tempObj2.Subtotal);
        } else {
            tempObj2.Subtotal=tempObj2.Subtotal+tempObj.extension;
        }
    } else {
        tempObj.unitprice=1;
        //tempObj.unitprice=OPplineitem[i].ListPrice;
        tempobj.extension=OPplineitem[i].Extension__c ;
    }
}

When i check in the Debug logs the value gets calculated but it does not get changed in the visual force page.Any help very much appreciated.
  • March 26, 2015
  • Like
  • 0
Trying to show map on my lead object field page and got this error
Greetings to All,
I am trying simple map implementation in the visualforce page with standard controller object and got this error . Please propose a solution for this.

Thanks in advance
 
Hi,
I have a scenario like,i would like clone a record of standard object but i dont want all the fields to be come in through cloning, i want to choose specific fields from the record and clone,how could i achieve this,

your answers and suggestions will be highly appreciated,