• Merry S
  • NEWBIE
  • 60 Points
  • Member since 2011
  • Salesforce Admin
  • MasterControl

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 44
    Questions
  • 38
    Replies
I have a visualforce page that is used as a checklist for an opportunity. The check boxes are not related to any fields. When the form is submitted the info is passed to another vf page that is use to email and render a pdf. I cannot get the boolean value to pass to the second page.

This is the variable in my controller (same controller for both pages)
public boolean checkbox1 {get;set;}

This is what I have for the field on the initial page:
<div class="slds-checkbox">
                                          <input type="checkbox" name="options" id="checkbox-1" value="{!checkbox1}" />
                                          <label class="slds-checkbox__label" for="checkbox-1">
                                            <span class="slds-checkbox_faux"></span>
                                            <span class="slds-form-element__label">Updated the Salesforce opportunity to include pertinent information including win data?</span>
And this is on the 2nd page:
<apex:outputText >Updated the Salesforce opportunity to include pertinent information including win data? - {!checkbox1}</apex:outputText>
And this is the pageref:
PageReference pdf =  Page.Order_Submission_chklst_PDF;
        pdf.getParameters().put('id', oppid);
          // Take the PDF content
        Blob b = pdf.getContentAsPDF();
        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setContentType('application/pdf');
        efa.setFileName('attachment.pdf');
        efa.setInline(false);
        efa.setBody(b);
        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {email};
        mail.setToAddresses(toAddresses);
        mail.setSubject('Order Submission'); 
        
        mail.plainTextBody = 'Updated the Salesforce opportunity to include pertinent information including win data? : '+checkbox1;
        
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        Messaging.SendEmail(new Messaging.SingleEmailMessage[] {mail});
            return null;
How do I pass the T/F to the other page?
I have looked at a few posts, but more are related to showing how to do it with a checkbox field and not just stand alone checkbox.


 
I have done a lot of searching on this and I think the answer might be No. But is it possible to use a global action button in a visualforce page?
My requirement is to take any pricebook entry made in the standard pricebook and replicate/update it in a second price book. With the code below I keep getting  the error below. I have read everything I could find, but I cannot figure out what I need to change.
FIELD_INTEGRITY_EXCEPTION, This price definition already exists in this price book: []
Also, I need the logic to look and see if the pricebookentry (product2Id) already exists and if so, just update the unitprice. But anytime I add that logic I get too many SOQL queries. (I was adding a query to look up the pricebookentries in the second price book, with an if statement to see if the product2id already existed. I had it in the for loop of the code below. - so 2 for loops and an if statement. It was the only way I could figure out how to get the logic, and obviously it was not correct.) Any help would be much appreciated.
global class pricebookEntryCopybatch implements Database.Batchable<sObject>{
        public final string query;
        Set<Id> pbeIds = new Set<Id>();
        Pricebook2 stdPrice = [Select id, isActive from Pricebook2 where isStandard=true limit 1];
        Pricebook2 fdaPrice = [Select id, isActive  from Pricebook2 where Name='FDA Pricebook' limit 1];    
    global pricebookEntryCopybatch(){
      query = 'Select Id, Pricebook2Id, isActive, SystemModStamp from PriceBookEntry ';
  }
        global Database.querylocator start(Database.BatchableContext BC){
                return Database.getQueryLocator(query);
        }


    global void execute(Database.BatchableContext BC, List<sObject> scope){
        for(sObject s : scope){
        for(PricebookEntry pbe : (List<PricebookEntry>)scope){
            if(pbe.Pricebook2Id == stdPrice.Id && pbe.IsActive == true && pbe.SystemModStamp > Datetime.now().addMinutes(-15)){
               pbeIds.add(pbe.id); 
            }
        }
      
      List<PricebookEntry> pbeforinsert = new List<PricebookEntry>();
            system.debug('***************************************stdPrice ' +stdPrice);
            system.debug('***************************************fdaPrice ' +fdaPrice);
      List<PricebookEntry> stdPBE = [SELECT Pricebook2Id, IsActive, UnitPrice, Id, Product2Id, CurrencyIsoCode FROM PricebookEntry Where Id in: pbeIds];
        for(PricebookEntry pbecopy : stdPBE){
            PricebookEntry pbesToAdd = new PricebookEntry();{
                pbesToAdd.Pricebook2Id = fdaPrice.Id;
                pbesToAdd.IsActive = pbecopy.IsActive;
                pbesToAdd.Product2Id = pbecopy.Product2Id;
                pbesToAdd.UnitPrice = pbecopy.UnitPrice;
                pbesToAdd.CurrencyIsoCode = pbecopy.CurrencyIsoCode;
                pbeforinsert.add(pbesToAdd);
                
            }
        }
          insert pbeforinsert;  
        }
    }
        
        
      
            global void finish(Database.BatchableContext BC){
   }   


}


 
I am trying to look at all tasks for a specific time frame, then create a note and set the LinkedEntityId to the whatid or whoid. This code creates the content note, 1 for each task. But then created a contentdocumentlink for each whatid or whoid for every note.
For instance, the query returns 8 tasks, 8 contentnotes are created and then each note is associated to each whatid(opps). So every opp has 8 notes. I have reworked this a million times and I am just not sure how to get it to know that I just want each contentnote associated to the task it "copied".
At this point I think I am over complicating it and the answer is so easy that I am not seeing it. How can I get this to create one note per task, and then associate it to the opp that the task is related? (whatid)
 
global class archiveTasksBatch implements Database.Batchable<SObject>, Schedulable{

public final string query;
date mydate = date.today().addDays(-369);

public archiveTasksBatch() {
    query = 'Select WhoId, WhatId, Subject, Status, OwnerId, Id, Description, CreatedDate, ActivityDate From Task where ActivityDate = :mydate' ;
}
public void execute(SchedulableContext sc){
    Database.executeBatch(this, 100);
}
public Database.QueryLocator start(Database.BatchableContext bc){
    return Database.getQueryLocator(query);
}

public void execute(Database.BatchableContext bc, List<sObject> scope){

    list<ContentNote > newObjects = new list<ContentNote >();
    list<ContentDocumentLink  > newCDL = new list<ContentDocumentLink  >();
    Map<ID, String> taskIdMap = new Map<ID, String>();





    for(Sobject s : scope){
        Task obj = (Task) s;
        String myString = obj.Description + obj.ActivityDate;
        Blob myBlob = Blob.valueof(myString.escapeHtml4());
        newObjects.add(new ContentNote (
        Title = obj.Subject,
        Content = myBlob
        ));

   }

        system.debug('*********************************newObjects' +newObjects.size());
        system.debug('*********************************scope' +scope.size());

        if(!newObjects.isEmpty()){
            Database.SaveResult[] srList = Database.insert(newObjects, false);
            for (Database.SaveResult sr : srList) {
                        for (Sobject sc : scope){
                        Task t = (Task) sc;
                        string tid = t.WhatId;
                        if(tid == null) {
                            tid = t.WhoId;}
                        taskIdMap.put(sr.Id, tid);
                if(sr.isSuccess()) {
                    ContentDocumentLink cdl = new ContentDocumentLink();
                    cdl.ContentDocumentId = sr.getId();
                    cdl.LinkedEntityId = taskIdMap.get(sr.id);
                    cdl.Visibility = 'AllUsers';
                    cdl.ShareType = 'I';
                    newCDL.add(cdl);
        system.debug('*********************************srList' +srList.size());
        system.debug('*********************************newCDL' +newCDL.size());
        system.debug('*********************************LinkedEntityId' +cdl.LinkedEntityId);
        system.debug('*********************************ContentDocumentId' +cdl.ContentDocumentId);

                }
            }
        }
     }
    insert newCDL;
}


public void finish(Database.BatchableContext bc){
    system.debug('JOB IS FINISHED');
}

 
We are attempting to integrate Salesforce and ServceNow using Azuqua. We first set up Azuqua to listen for changes to the account and when we got the error QUERY_TOO_COMPLICATED we switched to using an outbound message - which results in the same error.

After doing some research we found that Formula fields can become complicated at run time if there is a heavy calculation or if there are many formulas running at the same time. We reduced the fields down to only one formula field, same error. The we reduced it down to just querying Name and Id, same error.

The Azuqua support team is trying to help us but they have never run into this situation. I contacted Salesforce support who told me that since this is a deveopler question they could not help me but sited this article https://help.salesforce.com/articleView?id=QUERY-TOO-COMPLICATED&language=en_US&type=1, which gave me the same information I had already found.

Does anyone know how to resolve this? Below is the complete error message. Thanks in advance.
{ "message": "Bad Request", "headers": { "date": "Mon, 27 Mar 2017 22:29:32 GMT", "x-content-type-options": "nosniff", "x-xss-protection": "1; mode=block", "content-security-policy": "reflected-xss block;report-uri /_/ContentDomainCSPNoAuth?type=xss, referrer origin-when-cross-origin", "set-cookie": [ "BrowserId=558zXbe4QKmo7dJNR0LXLQ;Path=/;Domain=.salesforce.com;Expires=Fri, 26-May-2017 22:29:32 GMT" ], "expires": "Thu, 01 Jan 1970 00:00:00 GMT", "sforce-limit-info": "api-usage=15169/186000", "content-type": "application/json;charset=UTF-8", "transfer-encoding": "chunked", "connection": "close" }, "statusCode": 400, "body": [ { "message": "Query is either selecting too many fields or the filter conditions are too complicated.", "errorCode": "QUERY_TOO_COMPLICATED" } ], "_error": true, "method": "H15N5Zwng", "flo": 26495, "execution": "8fa3cc22-d298-4252-a141-4f701eac6e0d", "code": 400 }

 
Whenever I try to add a visualforce page to Lightning I get this error. Even if I try to update other that are already on the layout. I have only tried this in the sandbox, which is on Winter'17. Anyone else experiencing this?

Component 'Visualforce' has an invalid value for property 'Height (in pixels)'.
  • September 29, 2016
  • Like
  • 0
This test class is only getting 33% coverage, and I know it must have something to do with this line in the controller, but I am not sure how to get this covered.
list_of_accountmanagement = new List<string>{'Key (WIG)','Active Project','Active Opportunity > $50K','Partner-Managed','TAM-Managed','TSE-Managed (Tech Support)','Inactive'};

The bolded/underlined parts of the extension are what are not covered.
 
public final Account accounts;

    Public MAP<String,LIST<Account>> accsBucketedByType{get;set;} 
    public List<string> list_of_accountmanagement{get;set;}
    public ColumnControllerExt(ApexPages.StandardController stdController) {
    list_of_accountmanagement = new List<string>{'Key (WIG)','Active Project','Active Opportunity > $50K','Partner-Managed','TAM-Managed','TSE-Managed (Tech Support)','Inactive'};
    accsBucketedByType = new Map<String, List<Account>>();
    }
    public map<string,List<account>> getmap_values(){
        accsBucketedByType .put('Key (WIG)' ,[Select 

Id,name,Opportunity_Order_Status__c,NPS_Status__c,Case_Status_Stoplight__c,MSA_Status__c,Version_Status__c,Risk_Status__c,Team_Management_Status__c,Overall_Status__c,Total_RR_Converted_to_USD__c,Account_Management_Type__c,x3re__c from Account where 

Account_Management_Type__c =: 'Key (WIG)'order by Name]);

Here is the test class:
@isTest
private class TEST_ColumnController {
	
	static testMethod void ColumnController_test1() {

 Profile p = [SELECT Id FROM Profile WHERE Id='xx'];

//create dummy User
  User u = new User(Alias = 'testcc', Email='PopulateCountry@testorg.com', EmailEncodingKey='UTF-8', 
  LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', Department = 'Some Department',
  ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='PopulateCountry@testorg.com');       
  insert u;
  System.assert(u.Id != null);

//Create dummy accounts
    Account acc = new Account(Name = '1',Type = 'Customer',OwnerId = u.Id);
     
    insert acc; 

    Test.startTest();
    Test.setCurrentPage(Page.MyPage);

// create a new Account standard controller by passing it the account record
    ApexPages.StandardController controller = new ApexPages.StandardController(acc);

    // now pass it to the extension
    ColumnControllerExt stdController = new ColumnControllerExt(controller);

    system.assert(stdController != null); // controller has successfully been created

    
    Test.stopTest();
  }
}
Thanks for any help.
 
I am wondering if there is a better way to accomplish what this trigger does... or a cleaner way to write the code. Or am I missing an easier way to get the result?

Thanks!
 
trigger CurrencyUpdates on Account (before update) {


List<Account> acclist = new List<Account>();

    for(Account acc: Trigger.new){
        If(Trigger.oldMap.get(acc.id).Currency_Type__c != acc.Currency_Type__c){
            system.debug('Old= ' +Trigger.oldMap.get(acc.id).Currency_Type__c);
            system.debug('New= ' +acc.Currency_Type__c);            
        if (acc.Currency_Type__c == 'YEN'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0100;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0100;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0100;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0100;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0100;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0100;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0100;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0100;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0100;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0100;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0100;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0100;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0100;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0100;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0100;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0100;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0100;            
        } else if (acc.Currency_Type__c == 'CHF') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9478;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9478;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9478;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9478;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9478;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9478;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9478;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9478;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9478;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9478;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9478;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9478;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9478;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9478;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9478;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9478;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9478;            
        }else if (acc.Currency_Type__c == 'EUR') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.3008;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.3008;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.3008;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.3008;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.3008;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.3008;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.3008;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.3008;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.3008;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.3008;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.3008;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.3008;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.3008;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.3008;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.3008; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.3008;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.3008;
        }else if (acc.Currency_Type__c == 'CAD'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9502;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9502;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9502;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9502;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9502;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9502;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9502;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9502;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9502;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9502;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9502;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9502;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9502;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9502;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9502; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9502;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9502;            
        }else if (acc.Currency_Type__c == 'GBP'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.5279;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.5279;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.5279;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.5279;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.5279;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.5279;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.5279;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.5279;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.5279;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.5279;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.5279;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.5279;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.5279;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.5279;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.5279;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.5279;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.5279;            
        }else if (acc.Currency_Type__c == 'KRW') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0009;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0009;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0009;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0009;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0009;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0009;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0009;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0009;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0009;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0009;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0009;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0009;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0009;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0009;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0009;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0009;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0009;            
        }else if (acc.Currency_Type__c == 'USD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.0;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.0;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.0;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.0;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.0;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.0;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.0;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.0;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.0;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.0;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.0;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.0;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.0;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.0;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.0;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.0;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.0;            
        }else if (acc.Currency_Type__c == 'AUD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.88309;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.88309;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.88309;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.88309;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.88309;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.88309;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.88309;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.88309;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.88309;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.88309;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.88309;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.88309;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.88309;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.88309;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.88309;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.88309;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.88309;            
        }else if (acc.Currency_Type__c == 'SGD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.78499;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.78499;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.78499;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.78499;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.78499;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.78499;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.78499;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.78499;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.78499;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.78499;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.78499;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.78499;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.78499;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.78499;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.78499;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.78499;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.78499;            
        }else if (acc.Currency_Type__c == 'HKD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.12891;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.12891;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.12891;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.12891;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.12891;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.12891;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.12891;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.12891;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.12891;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.12891;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.12891;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.12891;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.12891;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.12891;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.12891;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.12891;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.12891;            
        }else if (acc.Currency_Type__c == 'NZD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.79067;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.79067;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.79067;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.79067;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.79067;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.79067;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.79067;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.79067;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.79067;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.79067;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.79067;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.79067;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.79067;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.79067;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.79067;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.79067;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.79067;            
        }else if (acc.Currency_Type__c == 'THB') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.03078;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.03078;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.03078;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.03078;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.03078;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.03078;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.03078;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.03078;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.03078;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.03078;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.03078;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.03078;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.03078;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.03078;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.03078;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.03078;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.03078;            
        }else (acc.Total_RR_Converted_to_USD__c = null);
                  
        }
    }
update acclist;
}

 
I am trying to update the Contact with State & time zone on insert and update. I have an object that holds a list of all areacodes and each record includes time zone and state. What I want to happen is that when a contact is inserted the trigger will match the area code (custom formula field on the contact) to my custom object and then populate the state and timezone. (If the state is null - which is not part of the trigger I will be showing). Also, on update I want the trigger to look check if the state is being updated, and if so, update the time zone to match the new state. (Sometimes contacts have cell numbers which do not correlate to the state in which they reside.) I have tried many iterations of this tirgger and below is what I have ended up with that "works" to varying degrees.
I have tested each section (the insert and the update) and they "work" - but not how I would like.

This part of the trigger works as long as I do not have the If(Trigger.IsInsert), once I add that it no longer fires.
trigger Contact_PopulateAreaCode on Contact (before update, before insert) {
    // first iteration to get the area codes    
    Set<String> contactAC = new Set<String>();
    Set<String> contactST = new Set<String>();


    If(Trigger.isInsert){
     
     for(Contact newContact:Trigger.new){
     if(newContact.LeadSource != 'New Customer Contact')
       contactAC.add(newContact.Area_code__c);
          System.debug('*****************************************contactAC has ' + contactAC.size());
     }
    
     // populate the map
     List <AreaCodeTimeZoneMap__c> IMaps = [SELECT Id, Area_Code__c, State_Province__c, Std_Time_Zone__c FROM AreaCodeTimeZoneMap__c WHERE Area_Code__c IN :contactAC];
    System.debug('*****************************************Maps has ' + imaps.size());
     Map<String, AreaCodeTimeZoneMap__c> ACTZMap = new  Map<String, AreaCodeTimeZoneMap__c>();
    for(AreaCodeTimeZoneMap__c a : IMaps){
        ACTZMap.put(a.Area_code__c,a);
    }

	     // final iteration to set state & timezone based on Area Code
 
     for(Contact newContact:Trigger.new){
         if(newContact.LeadSource != 'Customer Website User' && (newContact.MailingCountry=='United States'||newContact.MailingCountry=='Canada' )){
             AreaCodeTimeZoneMap__c mp = ACTZMap.get(newContact.Area_Code__c);
             if(mp != null){
             newContact.MailingState = mp.State_Province__c;
             newContact.Time_Zone__c = mp.Std_Time_Zone__c;
             }
          }
     } 

}
In the second part of the trigger I have a few issues. 1 - the code used to find the new value of the state and the old value return only the old value. I assume that has something to do with it being a before trigger, but I have read that it is possible to get the trigger.oldMap in a before trigger. I have it all commented out (One note, and I swear this worked before - the part that has Contact oldContact = Trigger.old; come back with an error of "Illegal assignment from List<Contact> to Contact".
With all of that commented out the trigger will fire, but it updates the time zone to the based on the old state. I was thinking the commented code would fix this, but even when it did work the old and new values were always the same - and always the old value.
if(Trigger.isUpdate){
     for(Contact newContact:Trigger.new){
        //Contact oldContact = Trigger.old;
    		//String oldState = oldContact.MailingState;
   			//String newState = newContact.MailingState;	
        // System.debug('*****************************************Old State ' + oldState);
        // System.debug('*****************************************New State ' + newState); 
        // if(newState != oldState){
     if(newContact.LeadSource != 'New Customer Contact')
       contactST.add(newContact.MailingState);
          System.debug('*****************************************contactST has ' + contactST.size());
     }

     // populate the map
     List <AreaCodeTimeZoneMap__c> UMaps = [SELECT Id, Area_Code__c, State_Province__c, Std_Time_Zone__c FROM AreaCodeTimeZoneMap__c WHERE State_Province__c IN :contactST];
    System.debug('*****************************************Maps has ' + umaps.size());
     Map<String, AreaCodeTimeZoneMap__c> ACTZMap1 = new  Map<String, AreaCodeTimeZoneMap__c>();
    for(AreaCodeTimeZoneMap__c a : UMaps){
        ACTZMap1.put(a.State_Province__c,a);
    }
	     // final iteration to set timezone based on State
 
     for(Contact newContact:Trigger.new){
              AreaCodeTimeZoneMap__c mp = ACTZMap1.get(newContact.MailingState);
             newContact.Time_Zone__c = mp.Std_Time_Zone__c;
     }
        
}
}

I also know that my updates are happening in the for loop. I have tried a couple of things to get them out of the loop (assigning a list) but I cannot seem to figure that out. I am not asking you to rewrite the code for me to include everything I need - I just need some direction as I have spent hours combing through discussion forums and trying new things - but I cannot seem to get my head around it enough to make it happen.

Thanks in advance.
 
I have two flows, one that converts a lead and a second that creates an oportunity (a wizard that walks through making sure the account & contact have all the needed info, then creating an opportunity, a closed task for the user and an open task for the sales person, and then sending an email to the sales person withh the option to cc the user.)

There is one controller for these two flows. It was brought to my attention yesterday that when clicking on the custom button to create the opportunity the user gets this error:
java.lang.reflect.InvocationTargetException
Error is in expression '{!interviewDisplay}' in component <apex:page> in component interview.apexc


When I try the custom button in the sandbox I get this:
Invalid Page Redirection
The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance. For more information, see Insufficient Privileges Errors. 
Click here to return to the previous page.


I have searched for the answer - found an old article for a known issue in Summer '14 - https://success.salesforce.com/issues_view?id=a1p30000000T4RaAAK that was marked as Fixed, but nothing that really helped. 

Here is the VF I use for the custom button:
<apex:page standardcontroller="Contact" extensions="FlowController">
<flow:interview name="Opportunity_Creation_New" interview="{!myflow}" finishLocation="{!FlowID}" >
            <apex:param name="var_UserId" value="{!$User.Id}"/> 
            <apex:param name="var_UserDept" value="{!$User.Department}"/> 
            <apex:param name="var_ContactID" value="{!ContactID}"/> 

                                            
        </flow:interview>
</apex:page>

And here is the controller: see *****Opportunity Wizard Section***** 
public class FlowController{
		// *****Convert lead for Partner Opp Registration Section*****
 public FlowController(ApexPages.StandardController stdController) {}
		    public String LeadId { 
		    	get{
		    		String lid = ApexPages.currentPage().getParameters().get('id');
		    		return lid;
		    	}
		       set { LeadId = value; }
		}
		
		
		// Instanciate the Flow for use by the Controller - linked by VF interview attribute
		public Flow.Interview.Partner_Registration_Lead_Conversion_and_Opp_Creation flowInstance {get;set;}
		
		
		
		// Set the page reference accessor methods
		public PageReference finishLocation {
		get {
		PageReference pageRef = new PageReference('/' + newRecordId);
		pageRef.setRedirect(true);
		
		return pageRef;
		}
		set { finishLocation = value; }
		}
		
		// Set the accessor methods for the flow output variable
		public String newRecordId {
		get {
		String strTemp = '';
		
		if(flowInstance != null) {
		strTemp = string.valueOf(flowInstance.getVariableValue('vOpportunityId'));
		}
		return strTemp;
		}
		
		set { newRecordId = value; }
		}
		
		// *****Opportunity Wizard Section*****
		
		    public String ContactID { 
		    	get{
		    		String cid = ApexPages.currentPage().getParameters().get('id');
		    		return cid;
		    	}
		       set { ContactID = value; }
		}
		

		// Instanciate the Flow for use by the Controller - linked by VF interview attribute
		public Flow.Interview.Opportunity_Creation_New myFlow { get; set; }
		
		private String getmyID() {
		if (myFlow==null) return '';
		else if (myFlow.vOppId == null) return myflow.var_AcctId;
		else return myFlow.vOppId;
		}
		
		public PageReference getFlowID(){
		PageReference p = new PageReference('/' + getmyID() );
		p.setRedirect(true);
		return p;
		}
		}


I am also putting in a ticket with SF, but since I don't have permium support I am not sure how much they can help. 
I have modified an extention controller that was originally set up to add products from a pricebook to opportunities. I changed it so that it would add our product (mc product) to an account. mc product is related to both the account and the product. 

Here is what the page looks like:
User-added image

When I click "Select" I get this error - invalid ID field: null
Error is in expression '{!addToShoppingCart}' in component <apex:commandButton> in page accountproductentry: Class.accountProductEntryExtension.updateAvailableList: line 53, column 1
Class.accountProductEntryExtension.addToShoppingCart: line 79, column 1


Here are the snippets of code:
public void updateAvailableList() {
    
        // We dynamically build a query string and exclude items already in the shopping cart
        String qString = 'Select MC_Product_Record_Type__c, Name, License_Key__c, IsActive, Includes_Other_Products__c, Id, Family, Description From Product2 where IsActive=true';
        // note that we are looking for the search string entered by the user in the name OR description
        // modify this to search other fields if desired
        if(searchString!=null){
            qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.Description like \'%' + searchString + '%\')';
        }
        
        Set<Id> selectedEntries = new Set<Id>();
        for(MC_Products__c d:shoppingCart){
            selectedEntries.add(d.Product__r.Id);
        }
        
        if(selectedEntries.size()>0){
            String tempFilter = ' and Id not in (';
            for(Id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';
            
            qString+= extraFilter;
        }
        
        qString+= ' order by Product2.Name';
        qString+= ' limit 101';
        
        system.debug('qString:' +qString);        
        AvailableProducts = database.query(qString); LINE 53
        
        // We only display up to 100 results... if there are more than we let the user know (see vf page)
        if(AvailableProducts.size()==101){
            AvailableProducts.remove(100);
            overLimit = true;
        }
        else{
            overLimit=false;
        }
    }
    
    public void addToShoppingCart(){
    
        // This function runs when a user hits "select" button next to a product
    
        for(Product2 d : AvailableProducts){
        String mcpName = d.name;
            if((String)d.Id==toSelect && d.MC_Product_Record_Type__c.equals('MC Product - Solution Package')){
                shoppingCart.add(new MC_Products__c(Account__c=theAcc.Id, Product__c=d.Id, Name=mcpName,Product_Status__c = 'Purchased', RecordTypeId = '01230000000rTGX'));
                break;
  
  
            }
        }

        updateAvailableList();   LINE 79
    }
So - here are my thoughts on what is happening. When I select a product, it tried to add the MC Product to the "shoppingcart' and since it has not been saved and there is no product id, the update of the available list fails. I can see in the debug log that it returns a null id.
 
23:18:26.078 (78141130)|USER_DEBUG|[51]|DEBUG|qString:Select MC_Product_Record_Type__c, Name, License_Key__c, IsActive, Includes_Other_Products__c, Id, Family, Description From Product2 where IsActive=true and (Product2.Name like '%acc%' or Product2.Description like '%acc%') and Id not in ('01ta0000005cZQNAA2','01t30000001uWzWAAU','01t30000001uWzUAAU','01t30000001uWyaAAE','01t30000001uWybAAE','01t30000001uWy7AAE','01t30000001uWzXAAU','01t30000001uWy6AAE','01t30000001uWy5AAE','null') order by Product2.Name limit 101
23:18:26.078 (78710544)|EXCEPTION_THROWN|[52]|System.QueryException: invalid ID field: null

My question is what can I do to fix this. I tried inserting the record first, which never worked and not really how I want it to work. I have the id populating the right field for the product, but it appears that it does not work, or since the reocrd have not been saved it cannot refernce it.

You will see in my code I am being really only set up to click one type of product, I wanted to get that working before adding more. There is also some code that I don't need, but I have not been worried about that just yet. 

Extension:
public with sharing class accountProductEntryExtension {

    public Account theAcc {get;set;}
    public String searchString {get;set;}
    public list<MC_Products__c> shoppingCart {get;set;}
    public list<MC_Products__c> mcpToAdd {get;set;}
    public list<Product2> AvailableProducts { get; set; }
    public MC_Products__c theProd {get;set;}   
    
    public String toSelect {get; set;}
    public String toUnselect {get; set;}
    public Decimal Total {get;set;}
    public Boolean overLimit {get;set;}
    
    private MC_Products__c[] forDeletion = new MC_Products__c[]{};

    public accountProductEntryExtension(ApexPages.StandardController controller) {
    	   theAcc = [select Id from Account where Id = :controller.getRecord().Id limit 1];

       shoppingCart = [Select Product__r.Name, Account__r.Name, Product__r.Id, Name, Account__c, View_Only_Licenses__c, Product__c, RecordTypeId, Product_Status__c, MC_Product_Notes__c, License_Key__c, Integration__c, Full_Licenses__c From MC_Products__c where Account__c=:theAcc.Id];
    }

    public void updateAvailableList() {
    
        // We dynamically build a query string and exclude items already in the shopping cart
        String qString = 'Select MC_Product_Record_Type__c, Name, License_Key__c, IsActive, Includes_Other_Products__c, Id, Family, Description From Product2 where IsActive=true';
        // note that we are looking for the search string entered by the user in the name OR description
        // modify this to search other fields if desired
        if(searchString!=null){
            qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.Description like \'%' + searchString + '%\')';
        }
        
        Set<Id> selectedEntries = new Set<Id>();
        for(MC_Products__c d:shoppingCart){
            selectedEntries.add(d.Product__r.Id);
        }
        
        if(selectedEntries.size()>0){
            String tempFilter = ' and Id not in (';
            for(Id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';
            
            qString+= extraFilter;
        }
        
        qString+= ' order by Product2.Name';
        qString+= ' limit 101';
        
        system.debug('qString:' +qString);        
        AvailableProducts = database.query(qString);
        
        // We only display up to 100 results... if there are more than we let the user know (see vf page)
        if(AvailableProducts.size()==101){
            AvailableProducts.remove(100);
            overLimit = true;
        }
        else{
            overLimit=false;
        }
    }
    
    public void addToShoppingCart(){
    
        // This function runs when a user hits "select" button next to a product
    
        for(Product2 d : AvailableProducts){
        String mcpName = d.name;
            if((String)d.Id==toSelect && d.MC_Product_Record_Type__c.equals('MC Product - Solution Package')){
                shoppingCart.add(new MC_Products__c(Account__c=theAcc.Id, Product__c=d.Id, Name=mcpName,Product_Status__c = 'Purchased', RecordTypeId = '01230000000rTGX'));
                break;
  
  
            }
        }

        updateAvailableList();  
    }
    

    public PageReference removeFromShoppingCart(){
    
        // This function runs when a user hits "remove" on an item in the "Selected Products" section
    
        Integer count = 0;
    
        for(MC_Products__c d : shoppingCart){
            if((String)d.Account__c==toUnselect){
            
                if(d.Id!=null)
                    forDeletion.add(d);
            
                shoppingCart.remove(count);
                break;
            }
            count++;
        }
        
        updateAvailableList();
        
        return null;
    }
    
    public PageReference onSave(){
    
        // If previously selected products are now removed, we need to delete them
        if(forDeletion.size()>0)
            delete(forDeletion);
    
        // Previously selected products may have new quantities and amounts, and we may have new products listed, so we use upsert here
        try{
            if(shoppingCart.size()>0)
                upsert(shoppingCart);
        }
        catch(Exception e){
            ApexPages.addMessages(e);
            return null;
        }  
           
        // After save return the user to the Opportunity
        return new PageReference('/' + ApexPages.currentPage().getParameters().get('Id'));
    }
    
    public PageReference onCancel(){
 
        // If user hits cancel we commit no changes and return them to the Opportunity   
        return new PageReference('/' + ApexPages.currentPage().getParameters().get('Id'));
    }


}

VF Page
<apex:page standardController="Account" extensions="accountProductEntryExtension" >

    <apex:sectionHeader Title="Manage {!$ObjectType.Product2.LabelPlural}" subtitle="{!account.Name}"/>
    <apex:messages style="color:red"/>

    <style>
        .search{
            font-size:14pt;
            margin-right: 20px;    
        }
        .fyi{
            color:red;
            font-style:italic;
        }
        .label{
            margin-right:10px;
            font-weight:bold;
        }
    </style>
    
    <script type='text/javascript'>
    
        // This script assists the search bar functionality
        // It will execute a search only after the user has stopped typing for more than 1 second
        // To raise the time between when the user stops typing and the search, edit the following variable:
        
        var waitTime = 1;
        
    
        var countDown = waitTime+1;
        var started = false;
        
        function resetTimer(){
        
            countDown=waitTime+1;
            
            if(started==false){
                started=true;
                runCountDown();
            }
        }
        
        function runCountDown(){
        
            countDown--;
            
            if(countDown<=0){
                fetchResults();
                started=false;
            }
            else{
                window.setTimeout(runCountDown,1000);
            }
        }
    
    </script>
   
  
    <apex:form >

            <br/>
            
<!-- this is the upper table... a.k.a. the "Shopping Cart"-->

            <!-- notice we use a lot of $ObjectType merge fields... I did that because if you have changed the labels of fields or objects it will reflect your own lingo -->
            <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="selected">
                       
                <apex:pageblockTable value="{!shoppingCart}" var="s">
                

                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.Account__c.Label}" value="{!s.Account__r.Name}"/>
                    
                    <apex:column headerValue="{!$ObjectType.MC_Products__c.LabelPlural}" value="{!s.Name}"/>

                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.Product__c.Label}" value="{!s.Product__r.Name}"/>

                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.Product_Status__c.Label}">
                        <apex:inputField value="{!s.Product_Status__c}" style="width:70px" required="true"/>
                    </apex:column>

                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.License_Key__c.Label}">
                        <apex:inputField value="{!s.License_Key__c}" style="width:70px"/>
                    </apex:column>

                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.Integration__c.Label}">
                        <apex:inputField value="{!s.Integration__c}" style="width:70px" required="false"/>
                    </apex:column>

                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.View_Only_Licenses__c.Label}">
                        <apex:inputField value="{!s.View_Only_Licenses__c}" style="width:70px" required="false"/>
                    </apex:column>

                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.Full_Licenses__c.Label}">
                        <apex:inputField value="{!s.Full_Licenses__c}" style="width:70px" required="false"/>
                    </apex:column>
                                                           
                    <apex:column headerValue="{!$ObjectType.MC_Products__c.Fields.MC_Product_Notes__c.Label}">
                        <apex:inputField value="{!s.MC_Product_Notes__c}" required="false"/>
                    </apex:column>
                    
                </apex:pageblockTable>
            
            
                <apex:pageBlockButtons >
                    <apex:commandButton action="{!onSave}" value="Save"/>
                    <apex:commandButton action="{!onCancel}" value="Cancel" immediate="true"/>
                </apex:pageBlockButtons>
            
            </apex:pageBlock>
    
<!-- this is the lower table: search bar and search results -->
    
            <apex:pageBlock >
            
                <apex:outputPanel styleClass="search">
                    Search for {!$ObjectType.Product2.LabelPlural}:
                </apex:outputPanel>

                <apex:actionRegion renderRegionOnly="false" immediate="true">
                
                    <apex:actionFunction name="fetchResults" action="{!updateAvailableList}" reRender="searchResults" status="searchStatus"/>
                    
                    <!-- here we invoke the scripting to get out fancy 'no button' search bar to work -->
                    <apex:inputText value="{!searchString}" onkeydown="if(event.keyCode==13){this.blur();}else{resetTimer();}" style="width:300px"/>
                    &nbsp;&nbsp;
                    <i>
                        <!-- actionStatus component makes it easy to let the user know when a search is underway -->
                        <apex:actionStatus id="searchStatus" startText="searching..." stopText=" "/>
                    </i>
                    
                </apex:actionRegion>
            
                <br/>
                <br/>
            
                <apex:outputPanel id="searchResults">
                
                    <apex:pageBlockTable value="{!AvailableProducts}" var="a">
                    
                        <apex:column headerValue="{!$ObjectType.Product2.Fields.Name.Label}" value="{!a.Name}" />
                        
                        <apex:column headerValue="{!$ObjectType.Product2.Fields.Family.Label}" value="{!a.Family}"/>
                        
                        <apex:column headerValue="{!$ObjectType.Product2.Fields.Description.Label}" value="{!a.Description}"/>
                        
                        <apex:column >
                            <!-- command button in a column... neato -->
                            <apex:commandButton value="Select" action="{!addToShoppingCart}" reRender="selected,searchResults" immediate="true">
                                <!-- again we use apex:param to be able to tell the controller which row we are working with -->
                                <apex:param value="{!a.Id}" assignTo="{!toSelect}" name="toSelect"/>
                            </apex:commandButton>
                        </apex:column>
                        
                    </apex:pageBlockTable>
                    
                    <!-- We put up a warning if results exceed 100 rows -->
                    <apex:outputPanel styleClass="fyi" rendered="{!overLimit}">
                        <br/>
                        Your search returned over 100 results, use a more specific search string if you do not see the desired {!$ObjectType.Product2.Label}.
                        <br/>
                    </apex:outputPanel>
                    
                </apex:outputPanel>
            
            </apex:pageBlock>
            


    </apex:form>

</apex:page>



 
I have a trigger that looks at a multi-select picklist on a custom object, and then splits the vaules and creates records on another object. The issue that I have is that it will create multiple new records since there is no logic to see if a record already exists.

On the Account_RoadMap__c object I have a field named Product_Planned_to_Purchase__c, it is multi-select. When this field is updated I want it to create a record for each product created on the object Account_RoadMap_Product__c related to both the Account Roadmap and the Account. However, if there is already a record on the Account Roadmap Product that matches what is in the multi-select picklist, I dont want it to create another record.

I have tried comparing lists - but I am just not sure how to get there. Any help would be much appreciated. 
 
trigger AutoCreateRoadMapProduct on Account_RoadMap__c (after update) {
    List<Account_RoadMap_Product__c> products = new List<Account_RoadMap_Product__c>();

    //For each roadmap processed by the trigger, add a new  

    //product record for the specified product.  

    for (Account_RoadMap__c newRM: Trigger.New) {
        if (newRM.Product_Planned_to_Purchase__c != null) {
            // split out the multi-select picklist using the semicolon delimiter
            for(String product: newRM.Product_Planned_to_Purchase__c.split(';')){
                products.add(new Account_RoadMap_Product__c(
                        Product_Name__c = product,
                        RoadMap__c = newRM.Id,
                        Account_Name__c = newRM.Account_Name__c));
            }
        }
    }
    insert products;
}

 
I have a custom field on a custom object, the field is a multi-picklist of products. What I want is that when someone chooses those products and then saves for it to trigger a flow that creates a new record (on a related custom object) for each product. Is this possible? 

I know I can do this is apex using split(), and I know you can write apex plugins for flows, just wondering if the list that the class would create can be passed back to the flow to create the records? 

I looked at an example of a lead conversion plugin so I have an idea that it might work, but I just cannot wrap my brain around what I am trying to do to understand how to mix the two together - knowing it IS possible will at least get me started. 
 
In the wrapper class (which I am using and not even really sure I HAVE to), I am getting data from Accounts, contacts, and 2 custom objects. In my vf page I have 5 different sections - 1 updates account data, one updates information from both custom objects, one updates info for just one of the custom objects, one updates contacts, and one updates accounts again - but using a wrapper to get the parent accounts.

I have figured out the easiest part (updating the first account section) but cannot for the life of me figure out how to save data (from an inline edit) back to the other objects (I have not tried contacts, just trying to get the custom objects).

Here is my class extension (page uses standard account controller with this extension).
public with sharing class RoadMapAccount {

    private final Account account;
    public list<wrapperclass> accountlist1wrap { get; set; }
    public list<wrapperclass> purchasedwrap{ get; set; }
    public list<wrapperclass> implementedwrap { get; set; }
    public list<wrapperclass> plannedwrap{ get; set; }
    public list<wrapperclass> roadmapwrap { get; set; }
    public list<wrapperclass> contactwrap { get; set; }
         
        
    public RoadMapAccount(ApexPages.StandardController controller) {

        account = [Select Id, Name, Product_Interested__c, Account_Management_Type__c,
        Overall_Status__c, Opportunity_Order_Status__c, NPS_Status__c,Case_Status_Stoplight__c,
        MSA_Status__c, Risk_Status__c, Version_Status__c, Team_Management_Status__c, Escalate_Button__c,
        Wall_of_Success__c, Escalated_Reason__c, Account_Alias__c, parentid, parent_install__c, type,
        Parent.Name,Parent_Install__r.Name,(Select Id, Product_Status__c From MC_Assets__r)
         From Account where Id = :ApexPages.currentPage().getParameters().get('id')];
        
         list<Account> object0 = [
         Select parentid, parent_install__c, Account_Alias__c, Type, Name,
        Parent.Name,Parent_Install__r.Name
         from Account
         WHERE parentid =:account.Id OR parent_install__c =:account.Id];

         list<MC_Products__c> object1 = [
            Select Product_Status__c, Id, Name 
            From MC_Products__c
            WHERE Account__c =:account.Id]; 

        list<IS_RoadMap__c> object2 = [
            Select Id, Depts_using_Training__c, Depts_using_Documents__c, Account_Name__c,
            Product_Planned_to_Purchase__c, Phase_date__c, Depts_using_Risk__c,
            Depts_using_Supplier__c, Depts_using_Audit__c, Depts_using_Process__c, Next_Phase_Implementation_Notes__c,
            Account_Strategy__c, Current_System_concerns__c, Key_Individuals__c 
            From IS_RoadMap__c  
            WHERE Account_Name__c =:account.Id];

        list<Contact> object3 = [
        Select Id, AccountId, LastName, FirstName, Email, Title, Department_Contact__c, Viewed_Harbor_Tour__c
        From Contact
        WHERE AccountId =:account.Id];

        accountlist1wrap = new list<wrapperclass>();
        for(Account obj0: object0){
            accountlist1wrap.add(new wrapperclass(obj0));
        }            

        purchasedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
        	if(obj1.Product_Status__c == 'Purchased')
            purchasedwrap.add(new wrapperclass(obj1));
        }
        implementedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
        	if(obj1.Product_Status__c == 'Implemented')
            implementedwrap.add(new wrapperclass(obj1));        
        }
        plannedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
          if(obj1.Product_Status__c == 'Plan to Implement')
            plannedwrap.add(new wrapperclass(obj1));        
        }
        roadmapwrap = new list<wrapperclass>();
        for(IS_RoadMap__c obj2: object2){
            roadmapwrap.add(new wrapperclass(obj2));
        }
        contactwrap = new list<wrapperclass>();
        for(Contact obj3: object3){
            contactwrap.add(new wrapperclass(obj3));
        }

     }    

    

    public class wrapperclass{
        public Account object_0{get;set;}
        public MC_Products__c object_1{get;set;}
        public IS_RoadMap__c object_2{get;set;}
        public Contact object_3{get;set;}        

        public wrapperclass(Account obj0){
            this.object_0 = (obj0);
        }
         public wrapperclass(MC_Products__c obj1){
            this.object_1 = (obj1);
        }
        public wrapperclass(IS_RoadMap__c obj2) {
            this.object_2 = (obj2);
        }
        public wrapperclass(Contact obj3) {
            this.object_3 = (obj3);
        }  
}
    

	public Account getaccount() {
        return account;    
     } 
    public void saveRM()
    { account.RoadMap__c=True;
        try{   
        update account; 
     
        }
        catch(Exception e)
        {
        }
    }
        public boolean roadmap {
        get {
            return [
                    select Roadmap__c
                    from Account
                    where Id =:account.Id
                    ].Roadmap__c;
        }
    }
    public void saveacc()
    {
        try{   
        update account;
        
     
        }
        catch(Exception e)
        {
        }
    }            
 
}

Visual force page (this will eventually be a "tab" on a custom account page.) (all save buttons, other than the first one, are just there as place holders - I know they are not configured correctly)
<apex:page Standardcontroller="Account" extensions="RoadMapAccount"
            sidebar="false" showheader="false">
            <base target="_parent" />

<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"/>
<script>
    j$ = jQuery.noConflict();
    
    function showLoadingDiv() {
        var newHeight = j$("[id$=lead-edit-section] .pbSubsection").css("height");//Just shade the body, not the header
        j$("[id$=loading-curtain-div]").css("background-color", "black").css("opacity", 0.35).css("height", newHeight).css("width", "80%");
    }
    function hideLoadingDiv() {
        j$("[id$=loading-curtain-div]").css("background-color", "black").css("opacity", "1").css("height", "0px").css("width", "80%");
    }
    
   function pageScroll() {
        window.scrollBy(0,400); // horizontal and vertical scroll increments
        
    }
 </script> 
 <style>
 input.btn { 
     color:#050; 
     font: bold 84% 'trebuchet ms',helvetica,sans-serif; 
     background-color:#fed; 
     border:1px solid; 
     border-color: #696 #363 #363 #696; 
   }
 </style>   
    <apex:form >
 <apex:pageblock title="RoadMap">
                    <apex:pageBlock rendered="{!Not (roadmap)}">
                <apex:pageBlockButtons location="top" >
                     <apex:commandbutton onclick="pageScroll()" value="Create RoadMap" action="{!saveRM}"  id="rmbutton" />
                </apex:pageBlockButtons><br />
                <apex:pageMessage summary="Click 'Create RoadMap' to get started" severity="info" strength="3" />
                   </apex:pageBlock>   

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="account-edit-block">
        <apex:actionStatus id="save-account-status"/>
          <apex:pageBlockSection title="Account Information" columns="2" collapsible="false" id="account-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:outputField value="{!account.name}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
            <apex:outputField value="{!account.Account_Alias__c}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
            <apex:outputField value="{!account.type}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
          </apex:pageBlockSection>
            <center><apex:commandButton action="{!saveacc}" value="Save Account Information" status="save-account-status" rerender="account-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion>  

<apex:outputpanel id="fullmap">
     <apex:outputpanel rendered="{!roadmap}">

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="product-edit-block">
        <apex:actionStatus id="save-product-status"/>
          <apex:pageBlockSection title="Product Details" id="product-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:panelGrid columns="2" width="1350px">
        <apex:pageblock >
         <apex:pageblocktable value="{!purchasedwrap}" var="pur" id="Pdetails">
          <apex:column headerValue="Purchased">
          <apex:repeat var="a" value="{!pur.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!pur.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
        </apex:pageblocktable>
       </apex:pageblock>

        <apex:pageblock >
         <apex:pageblocktable value="{!implementedwrap}" var="imp" id="Idetails">
          <apex:column headerValue="Implemented">
          <apex:repeat var="a" value="{!imp.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!imp.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          </apex:pageblocktable>
         </apex:pageblock>

        <apex:pageblock mode="inlineEdit" >
         <apex:pageblocktable value="{!plannedwrap}" var="pln" id="PIdetails">
          <apex:column headerValue="Planned to Implement">
          <apex:repeat var="a" value="{!pln.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!pln.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>
         </apex:pageblocktable>
        </apex:pageblock>

        <apex:pageblock >
         <apex:pageblocktable value="{!roadmapwrap}" var="rm" id="PPdetails">
          <apex:column headerValue="Products Planned Purchased">
          <apex:outputfield value="{!rm.object_2.Product_Planned_to_Purchase__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          <apex:column headerValue="Phase Date">
          <apex:outputfield value="{!rm.object_2.Phase_date__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>          
          </apex:column>
          <apex:column >
          <apex:commandbutton value="Remind Me" action="/00T/e?what_id={!account.Id}&tsk12=Not Started&retURL=%2Fa{!account.Id}"/>
          </apex:column>
          </apex:pageblocktable>
         </apex:pageblock>
        </apex:panelGrid>
       </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Product Information" status="save-product-status" rerender="product-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 



    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="dept-edit-block">
        <apex:actionStatus id="save-dept-status"/>
          <apex:pageBlockSection title="Department Information" id="dept-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
                <apex:panelGrid columns="6" width="1350px">

        <apex:pageblock mode="inlineEdit" >
         <apex:pageblocktable value="{!roadmapwrap}" var="rmd" id="depts1">
           <apex:column headerValue="Depts using Documents">
          <apex:outputfield value="{!rmd.object_2.Depts_using_Documents__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmp" id="depts2">
           <apex:column headerValue="Depts using Process">
          <apex:outputfield value="{!rmp.object_2.Depts_using_Process__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmt" id="depts3">
           <apex:column headerValue="Depts using Training">
          <apex:outputfield value="{!rmt.object_2.Depts_using_Training__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rma" id="depts4">
           <apex:column headerValue="Depts using Audit">
          <apex:outputfield value="{!rma.object_2.Depts_using_Audit__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rms" id="depts5">
           <apex:column headerValue="Depts using Supplier">
          <apex:outputfield value="{!rms.object_2.Depts_using_Supplier__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmr" id="depts6">
           <apex:column headerValue="Depts using Risk">
          <apex:outputfield value="{!rmr.object_2.Depts_using_Risk__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>
         </apex:panelGrid> <br />
                <apex:panelGrid columns="1" width="1350px">
         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="n" id="notes">
           <apex:column headerValue="Next Phase Implementation Notes">
          <apex:outputfield value="{!n.object_2.Next_Phase_Implementation_Notes__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>
                                                      
         </apex:panelGrid>
      </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Dept Information" status="save-dept-status" rerender="dept-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="strat-edit-block">
        <apex:actionStatus id="save-strat-status"/>
          <apex:pageBlockSection title="Account Notes and Account Strategy" id="strat-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:panelGrid columns="1" width="1350px">
        <apex:pageblock title="Associated Contacts" mode="inlineEdit">
         <apex:pageblocktable value="{!contactwrap}" var="con" id="contact">
          <apex:column headerValue="Name">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputlink value="{c.id}"><apex:outputField value="{!c.FirstName}"/><apex:outputField value="{!c.LastName}"/></apex:outputlink>
          </apex:repeat>
          </apex:column>  
          <apex:column headerValue="Title">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.title}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          <apex:column headerValue="Department">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.Department_Contact__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          <apex:column headerValue="Email">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.email}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column> 
         <apex:column headerValue="Viewed Harbor Tour" value="{!con.object_3.Viewed_Harbor_Tour__c}" />
          </apex:pageblocktable>
         </apex:pageblock>
         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="k" id="key">
           <apex:column headerValue="Key Individuals (Team details/concerns, Political layout, Newsletter Opt out…)">
          <apex:outputfield value="{!k.object_2.Key_Individuals__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         <apex:pageblocktable value="{!roadmapwrap}" var="c" id="current">
           <apex:column headerValue="Current System concerns or issues (General)">
          <apex:outputfield value="{!c.object_2.Current_System_concerns__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         <apex:pageblocktable value="{!roadmapwrap}" var="s" id="strat">
           <apex:column headerValue="Account Strategy (Ex: Expand usage of Docs by expanding department, then focus on Training. Ex: Key Executive sponsor(s) and Champion who can expand through company)">
          <apex:outputfield value="{!s.object_2.Account_Strategy__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
          </apex:pageblock>
         </apex:panelGrid>
       </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Strategy Information" status="save-strat-status" rerender="strat-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 
 
    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="parent-edit-block">
        <apex:actionStatus id="save-parent-status"/>
          <apex:pageBlockSection title="Associated Accounts - Children and Non-Install" id="parent-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem> 
                <apex:panelGrid columns="1" width="1350px">
        <apex:pageblock mode="inlineEdit" rendered="{!AND(NOT(ISNULL(accountlist1wrap)),accountlist1wrap.size>0)}">
         <apex:pageblocktable value="{!accountlist1wrap}" var="par" id="parent">
          <apex:column headerValue="Account Name">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Name}"/>
           </apex:repeat>
          </apex:column>
          <apex:column headerValue="Account Alias">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Account_Alias__c}"/>
           </apex:repeat>
          </apex:column>
          <apex:column headerValue="Account Type">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.type}"/>
           </apex:repeat>
          </apex:column>          
          <apex:column headerValue="Parent">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.parent.name}"/>
           </apex:repeat>
          </apex:column>  
          <apex:column headerValue="Parent Install">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Parent_Install__r.name}"/>
           </apex:repeat>
          </apex:column>      
          </apex:pageblocktable>
         </apex:pageblock>
        <apex:pageBlock rendered="{!OR(ISNULL(accountlist1wrap),accountlist1wrap.size=0)}">
          <apex:pageMessage summary="This account is not the Parent or Parent Install on any other accounts." severity="info" strength="3" />
         </apex:pageBlock>
         </apex:panelGrid>
        </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Parent Information" status="save-parent-status" rerender="parent-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 
   </apex:outputpanel>             
</apex:outputpanel>   
 </apex:pageblock>        
    </apex:form>
</apex:page>

 
I've created a class to make a callout, the JSON seems to be formatted right, but when trying to deserialize it I get the above error. What am I doing wrong?

Here is the debug log showing how the request is fomatted:
17:54:08.083 (83420512)|USER_DEBUG|[67]|DEBUG|jsonOrders: {
  "entities" : [ {
    "attributes" : {
      "type" : "DatacloudCompany"
    },
    "Name" : "GE Healthcare Institute",
    "Country" : "United States",
    "Phone" : "(262) 951-2047"
  } ],
  "matchoptions" : {
    "fields" : "City, CompanyId, Country, Description, DunsNumber, Name, Website, YearStarted, Zip",
    "matchEngine" : "DunsRightMatchEngine",
    "maxMatchResults" : "6",
    "minMatchConfidence" : "5",
    "rule" : "DunsRightMatchRule",
    "sObjectType" : "DatacloudCompany"
  }
}
This seems to be right based on the dev guide https://developer.salesforce.com/docs/atlas.en-us.datadotcom_api_dev_guide.meta/datadotcom_api_dev_guide/request_understanding_a_request.htm#request_understanding_a_request

However when it gets to this line in my code I get the error:
Entities ddcdata =
              (Entities)JSON.deserialize(res.getBody(),
                Entities.class);
                    System.debug('ddcdata: ' + ddcdata);

Here is the full class:
public class Lead_fromJSON{


	public class Attributes {
		public String Type {get;set;}
	}

	public class Entities {
		public Attributes Attributes;
		public String Name {get;set;}
		public String Country {get;set;}
		public String Phone {get;set;}
	}

	public class Matchoptions {
		public String fields;
		public String matchEngine {get;set;}
		public String maxMatchResults {get;set;}
		public String minMatchConfidence {get;set;}
		public String rule {get;set;}
		public String sObjectType {get;set;}
	}

	public List<Entities> Entities;
	public Matchoptions matchoptions;

     @future (callout=true) // indicates that this is an asynchronous call
    public static void postOrder(List<String> leadIds) {

     List<Lead> ld = [SELECT Id, Company, Country, phone FROM Lead where Company IN :leadIds];
        System.debug('leadinfo: ' + ld);
         for (Lead l : ld)    {
    	        // Create a JSON generator object
        JSONGenerator gen = JSON.createGenerator(true);
        // open the JSON generator

            gen.writeStartObject();
            gen.writeFieldName('entities');
            gen.writeStartArray();
            gen.writeStartObject();            
            gen.writeFieldName('attributes'); 
            gen.writeStartObject();
            gen.writeStringField('type', 'DatacloudCompany');
            gen.writeEndObject();    
            gen.writeStringField('Name', l.Company);
            gen.writeStringField('Country', l.Country);
            gen.writeStringField('Phone', l.phone);
            gen.writeEndObject(); 
            gen.writeEndArray();
            gen.writeFieldName('matchoptions');            
            gen.writeStartObject();
            gen.writeStringField('fields', 'City, CompanyId, Country, Description, DunsNumber, Name, Website, YearStarted, Zip');
            gen.writeStringField('matchEngine', 'DunsRightMatchEngine');
            gen.writeStringField('maxMatchResults', '6');
            gen.writeStringField('minMatchConfidence', '5');
            gen.writeStringField('rule', 'DunsRightMatchRule'); 
            gen.writeStringField('sObjectType', 'DatacloudCompany');           
            gen.writeEndObject(); 
            gen.writeEndObject();

                                 
        // close the JSON generator

        // create a string from the JSON generator
        String jsonOrders = gen.getAsString();
        // debugging call, which you can check in debug logs
        System.debug('jsonOrders: ' + jsonOrders);



        // create an HTTPrequest object    
        HttpRequest req = new HttpRequest();
        // set up the HTTP request with a method, endpoint, header, and body
        req.setMethod('POST');
        req.setEndpoint('https://cs15.salesforce.com/services/data/v32.0/match/DunsRightMatchEngine/DatacloudCompany/DunsRightMatchRule');
        req.setHeader('Content-Type', 'application/json');
        req.setBody(jsonOrders);    
        // create a new HTTP object
        Http http = new Http();
        // create a new HTTP response for receiving the remote response
        // then use it to send the configured HTTPrequest
        HTTPResponse res = http.send(req);




{
            // Retrieve all of the Lead records
            // originally passed into the method call to prep for update.           
            List<Lead> leads =
              [SELECT Id FROM Lead WHERE Id IN :ld];
            // Create a list of entities by deserializing the
            // JSON data returned by the fulfillment service.
            Entities ddcdata =
              (Entities)JSON.deserialize(res.getBody(),
                Entities.class);
                    System.debug('ddcdata: ' + ddcdata);
            // Create a map of Lead IDs from the retrieved
            // invoices list.
            Map<String, Lead> leadMap =
              new Map<String, Lead>(leads);

            {
              Lead lead = leadMap.get(ddcdata.Name);
              if (ddcdata.Name != null)
              lead.Company = String.valueOf(ddcdata.Name);
              lead.phone = String.valueOf(ddcdata.phone);
            }
            // Update all leads in the database with a bulk update
            update leads;
        }
        
         }      
    }
}


 
I have a trigger that has to meet these requirements.
If a new rating (custom object) is submitted and is the type of 'overall', has a score of 9 or 10, and the contact on the rating does not have a reference proflle (custom object) create the reference profile. Rating has the contact as a master, Reference Profle has the Account as a master with a lookup to the contact - both fields are required.

The trigger works. However, I did a test where I mass uploaded a bunch of different ratings (types and scores) and it only created one new reference profile (the first one on the list that matched the criteria). There was no error - debug log shows a success. I have worked hours on this trigger (just took an APEX class last month) and I am just not sure why it would not create the reference profile for all contacts if the criteria is a match. 

Here is the trigger:
trigger CreateReferenceProfilefromNewRating on Rating__c (after insert) {
	
	Set<String> ratIdsSet = new Set<String>(); {
		for (Rating__c r: trigger.new) {
			if (r.rating_type__c == 'overall' &&(r.Rating__c == '9' || r.Rating__c == '10')) 
			ratIdsSet.add(r.Contact__c);
			{
		
	List<Reference_profile__c> reftoInsert = new List<Reference_profile__c>([Select  Contact__c 	From Reference_profile__c
	WHERE Contact__c IN:ratIdsSet]);
	
		Reference_profile__c n = new Reference_profile__c ();
      if(r.contact__c != n.contact__c && r.rating_type__c == 'overall' &&(r.Rating__c == '9' || r.Rating__c == '10')){ 
	String ConName = r.Contact_Name_Text__c;
	String AccName = r.Account_Name_Text__c;

		n.contact__c = r.contact__c;  
		n.account__c = r.account__c;
		n.name = AccName + ' - ' + ConName;
		n.reference_status__c = 'candidate';
		n.created_from_rating__c = true;

		reftoInsert.add(n);
	} else if(r.contact__c == n.contact__c && r.rating_type__c == 'overall' &&(r.Rating__c == '9' || r.Rating__c == '10')){
		
	}
	try {
		insert reftoInsert;	
	} catch (system.Dmlexception e) {
		system.debug (e);
	}
	}
		}
	}
	
}


  • September 17, 2014
  • Like
  • 0
I am trying to get a trigger on the opportunity that will look at the contact roles, check to see if there is a contact role with the "role" that equals "fulfillment" and then return the number of contacts that meet the criteria. Basically I just need to know that the Opp has a contact role added and that it has the "role" of "fulfillment". I thought the counting would work so that I could create a pop-up window that alerts the users that a fulfillment contact needs to be added. And once past a certain stage a validation that will not let you move to a "win" without that contact role defined.

I got some help on the stackexchange - but I am running into an issue... I am getting this error: Invalid field OpportunityId for SObject AggregateResult on this line: Opportunity opps = oppsToCheckMap.get(aggCount.OpportunityId);

Here is the trigger..

trigger fulfillmentcontactcreatedopp on Opportunity (before insert, before update) {

    // Only need to enforce rule if going into the "Win" stage

    Map<Id, Opportunity> oppsToCheckMap = new Map<Id, Opportunity>();

    for(Opportunity opp : trigger.new) {
        // Add the opp Id to a Map(Id to Opp) if it is an insert trigger with a won stage
        // or if it is an update changing into a won stage (use trigger.oldMap to find the value before the change.
        if(opp.Stage == 'Closed Won') { // <== Your "Won" stage name here.
            if(trigger.isInsert ||
               trigger.isUpdate && trigger.oldMap.get(opp.Id).Stage != opp.Stage)
                oppsToCheckMap.put(opp.Id, opp);
            }
        }           

    }

    // For each Opportunity in the map keyset get the count of the
    // OpportunityContactRole with role = fulfillment.
    List<AggregateResult> result = [
             select OpportunityId, count(Id)
             from OpportunityContactRole
             where (Role = 'Fulfillment') and
                    OpportuntiyId in :oppsToCheckMap.keySet() group by OpportunityId];

    // If the count is zero use addError to prevent the insert/update from committing.
    for(AggregateResult aggCount : result) {
        // Here expr0 should be the count(Id) result.
        // I.e. How many Fulfillment Contact Roles each Opportunity has.
        if(aggCount.expr0 == 0) {
            Opportunity opp = oppsToCheckMap.get(aggCount.OpportunityId);
            opp.Stage.addError('Requires Fulfillment Contact Role to be Won');
        }

        // If you don't want to use addError you can also update the count field here
        // The problem is that this won't update the count when the
        // OpportunityContactRole records change.
        opp.Number_of_Fulfillment_Contacts__c = aggCount.expr0;
    }
}

User-added image

This is an example of a dashboard type page I have created using visualforce. What I was wondering... is it possible to draw those circles (they are just images now), based on data in a query. For instance, could I draw a circle to be smaller or larger based on revenue. I have looked at canvas and understand how to get the circle.. just not sure where I would look (research) to figure out if what I am trying to do is even possible.

I would need the circles to all be the same size initially and when an end user clicks "show size" the circles would change based on revenue. And they would have to still show the r/y/g.

Any direction is helpful. In the meantime - back to my research!

I am using a pretty basic line chart and I need to get the dates, currency and color of the lines formatted. I have researched this on here and stackexchange and I can find plenty of information about how to do it using outputtext, but nothing that has actually worked. I dont know CSS very well, and I have tried using the information on the google playground on how to format, but that has not worked for me either. I am sure it is something simple, but I thought I would ask.

 

The date comes out formatted like this:

2013-12-25 00:00:00

The currency numbers are just numbers (have not really tried much with this since I could not get the date to work)

And I just have no clue where to change the color of the line.

Any help would be much appreciated - articles, KB, anything.

 

Here is the controller -

public with sharing class Groupfor3RE4 {
// Data class

    public class Data {

        public Integer tre { get; set; }
        public String time1 { get; set; }
 



 

                        
        public Data( Integer tre, String time1) {

            this.tre = tre;
            this.time1 = time1;



        }
    }
    public List<Data> getChartData1(){
    List<AggregateResult> arList = [SELECT  AVG(X3RE__c) cThreeRE ,

                                    Date__c Day
                              
                                    from X3RE_Snapshot_Data__c
                                    
                                    group by   Date__c];
      
    List<Data> dataList = new List<Data>();
    for (AggregateResult ar : arList){       
     
        Integer cThree_RE = Integer.valueOf(ar.get('cThreeRE'));        
        String Day = String.valueOf(ar.get('Day'));


        
        dataList.add(new Data( cThree_RE, Day ));
}

 

return dataList;

}

    public class DataRR {


        public String time1 { get; set; }
        public Integer rr { get; set; }




 

                        
        public DataRR( String time1, Integer rr) {


            this.time1 = time1;
            this.rr = rr;



        }
    }
    public List<DataRR> getChartData2(){
    List<AggregateResult> arList = [SELECT  
                                    AVG(Total_RR_Converted_to_USD__c) cRR ,
                                    
                                    Date__c Day
                              
                                    from X3RE_Snapshot_Data__c
                                    
                                    group by   Date__c];
      
    List<DataRR> dataList1 = new List<DataRR>();
    for (AggregateResult ar : arList){       
     
       
        String Day = String.valueOf(ar.get('Day'));
        Integer cRR = Integer.valueOf(ar.get('cRR')); 


        
        dataList1.add(new DataRR( Day, cRR ));
}

 

return dataList1;

}
    public class DataRRR {


        public String time1 { get; set; }
        public Integer rrr { get; set; }




 

                        
        public DataRRR( String time1, Integer rrr) {


            this.time1 = time1;
            this.rrr = rrr;



        }
    }
    public List<DataRRR> getChartData3(){
    List<AggregateResult> arList = [SELECT  
                                    AVG(Referenceable_Recurring_Revenue_R_RR__c) cRRR ,
                                    
                                    Date__c Day
                              
                                    from X3RE_Snapshot_Data__c
                                    
                                    group by   Date__c];
      
    List<DataRRR> dataList2 = new List<DataRRR>();
    for (AggregateResult ar : arList){       
     
       
        String Day = String.valueOf(ar.get('Day'));
        Integer cRRR = Integer.valueOf(ar.get('cRRR')); 


        
        dataList2.add(new DataRRR( Day, cRRR ));
}

 

return dataList2;

}
  
    }

 And the VF Page

 

<apex:page controller="Groupfor3RE4" sidebar="false" showheader="false">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>
      3RE Dashboard
    </title>
    <script type="text/javascript" src="//www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Create and populate the data table.
        var data = google.visualization.arrayToDataTable([
          ['Date', '3RE'],
           <apex:repeat value="{!ChartData1}" var="c">
               ['{!c.time1}',{!c.tre} ],
           </apex:repeat>
        ]);

      
        // Create and draw the visualization.
        new google.visualization.LineChart(document.getElementById('visualization')).
            draw(data, {curveType: "function",
                        width: 600, height: 400,
                        vAxis: {maxValue: 10}}
                );
                
                
        var data1 = google.visualization.arrayToDataTable([
          ['Date', 'RR'],
           <apex:repeat value="{!ChartData2}" var="c">
               ['{!c.time1}',{!c.rr} ],
           </apex:repeat>
        ]);

      
        // Create and draw the visualization.
        new google.visualization.LineChart(document.getElementById('visualization2')).
            draw(data1, {curveType: "function",
                        width: 400, height: 400,
                        vAxis: {maxValue: 10}}
                );

       var data2 = google.visualization.arrayToDataTable([
          ['Date', 'RRR'],
           <apex:repeat value="{!ChartData3}" var="c">
               ['{!c.time1}',{!c.rrr} ],
           </apex:repeat>
        ]);

      
        // Create and draw the visualization.
        new google.visualization.LineChart(document.getElementById('visualization3')).
            draw(data2, {curveType: "function",
                        width: 400, height: 400,
                        vAxis: {maxValue: 10}}
                );




      }
 



      google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">
  
  <table>
  <tr>
    <td><div id="visualization" style="width: 400px; height: 400px;"></div></td>
     <td><div id="visualization2" style="width: 400px; height: 400px;"></div></td>
     <td><div id="visualization3" style="width: 400px; height: 400px;"></div></td>
    </tr>
    <tr>
   
    </tr>
</table>
    
  </body>
</apex:page>

 

I have created this controller with an aggregate query to use for the goolge motion chart. I keep getting the "error" when the chart tries to load that the first and second columns must be entity and time. I am not sure what to do from here. I have tried everything, except maybe putting the date in another format (javascript format), but I am not sure how to go about doing that, or even if that is the case.

 

This data comes from a customer object that is set up for a snapshot of data each week. Another issue I was getting was that there were too many rows, I have changed the VF page to

readonly="true"

 

, will that effect the chart?

 

Here is the controller - excuse the way it looks, I have been deleting and adding things all day and have not cleaned it up for this post.

 

public class Groupfor3RE{
// Data class

    public class Data {
        public String entity { get; set; } 
        public Date time1 { get; set; }       
        public Integer data2 { get; set; }
        public Integer data3 { get; set; }
        public Integer data4 { get; set; }
        public Integer data5 { get; set; }
        public String name6 { get; set; }

        public String name7 { get; set; }

        public String name8 { get; set; }

        public String name9 { get; set; }

        public String name10 { get; set; }


                        
        public Data(String entity,  Date time1, Integer data2, Integer data3,
                    Integer data4, Integer data5, String name6, 
                     String name7,  String name8,  String name9, 
                    String name10) {
            this.entity = entity;
            this.time1 = time1;
            this.data2 = data2;
            this.data3 = data3;
            this.data4 = data4;
            this.data5 = data5;
            this.name6 = name6;            

            this.name7 = name7;            

            this.name8 = name8;

            this.name9 = name9;

            this.name10 = name10;


        }
    }
    public List<Data> getChartData1(){
    List<AggregateResult> arList = [SELECT  Account_Management_Type__c Type, 
                                    Date_Conversion__c Day,
                                    AVG(X3RE__c) cThreeRE , 
                                    AVG(Referenceable_Recurring_Revenue_R_RR__c) cRRR, 
                                    AVG(Total_RR_Converted_to_USD__c)cRR,
                                    MAX(FTE__c) cFTE,
                                    Territory_Vertical__c Vertical,
                                    Territory_from_account__c Territory, 
                                    Target_Industry_from_account__c Target,  
                                    Sales_Channel__c Channel, 
                                    Tier__c Tier
                                    
                              
                                    from X3RE_Snapshot_Data__c
                                   
                                    group by  Account_Management_Type__c, Date_Conversion__c,  Territory_Vertical__c, 
                                    Territory_from_account__c  , Target_Industry_from_account__c ,  Sales_Channel__c, Tier__c];
      
    List<Data> dataList = new List<Data>();
    for (AggregateResult ar : arList){       
        String Type = String.valueOf(ar.get('Type'));
        Date Day = Date.valueOf(ar.get('day'));
      
        Integer cThree_RE = Integer.valueOf(ar.get('cThreeRE'));
        Integer cRRR = Integer.valueOf(ar.get('cRRR'));   
        Integer cRR = Integer.valueOf(ar.get('cRR')); 
        Integer cFTE = Integer.valueOf(ar.get('cFTE'));
        String Vertical = String.valueOf(ar.get('Vertical'));
 
        String Territory = String.valueOf(ar.get('Territory'));

        String Target = String.valueOf(ar.get('Target'));

        String Channel = String.valueOf(ar.get('Channel'));

        String Tier = String.valueOf(ar.get('Tier'));        

     
        dataList.add(new Data( Type, day, cThree_RE, cRRR, cRR, cFTE, Vertical,  
                               Territory,  Target,  Channel,  Tier));
}

 

return dataList;

}
    
    }

 And the page:

 

<apex:page controller="Groupfor3RE" sidebar="false" showheader="false" readonly="true">




  <title>Google Visualization API Sample</title>
  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
    google.load('visualization', '1', {packages: ['motionchart']});

    function drawVisualization() {
var data = new google.visualization.arrayToDataTable([
          ['Type', 'Date', '3RE','RRR','RR','FTE','Vertical','Territory','Industry','Channel','Tier'],
            <apex:repeat value="{!ChartData1}" var="c">
               ['{!c.entity}','{!c.time1}','{!c.data2}','{!c.data3}','{!c.data4}','{!c.data5}','{!c.name6}','{!c.name7}','{!c.name8}','{!c.name9}','{!c.name10}'],
           </apex:repeat>
        ]);
      

    
       var motionchart = new google.visualization.MotionChart(
          document.getElementById('chart_div'));
      motionchart.draw(data, {'width': 800, 'height': 400});
    }
    

    google.setOnLoadCallback(drawVisualization);
  </script>

<body style="font-family: Arial;border: 0 none;">
<div id="chart_div" ></div>
</body>

</apex:page>

 If you can just point me the right direction, that would be awesome.

User-added image

This is an example of a dashboard type page I have created using visualforce. What I was wondering... is it possible to draw those circles (they are just images now), based on data in a query. For instance, could I draw a circle to be smaller or larger based on revenue. I have looked at canvas and understand how to get the circle.. just not sure where I would look (research) to figure out if what I am trying to do is even possible.

I would need the circles to all be the same size initially and when an end user clicks "show size" the circles would change based on revenue. And they would have to still show the r/y/g.

Any direction is helpful. In the meantime - back to my research!
My requirement is to take any pricebook entry made in the standard pricebook and replicate/update it in a second price book. With the code below I keep getting  the error below. I have read everything I could find, but I cannot figure out what I need to change.
FIELD_INTEGRITY_EXCEPTION, This price definition already exists in this price book: []
Also, I need the logic to look and see if the pricebookentry (product2Id) already exists and if so, just update the unitprice. But anytime I add that logic I get too many SOQL queries. (I was adding a query to look up the pricebookentries in the second price book, with an if statement to see if the product2id already existed. I had it in the for loop of the code below. - so 2 for loops and an if statement. It was the only way I could figure out how to get the logic, and obviously it was not correct.) Any help would be much appreciated.
global class pricebookEntryCopybatch implements Database.Batchable<sObject>{
        public final string query;
        Set<Id> pbeIds = new Set<Id>();
        Pricebook2 stdPrice = [Select id, isActive from Pricebook2 where isStandard=true limit 1];
        Pricebook2 fdaPrice = [Select id, isActive  from Pricebook2 where Name='FDA Pricebook' limit 1];    
    global pricebookEntryCopybatch(){
      query = 'Select Id, Pricebook2Id, isActive, SystemModStamp from PriceBookEntry ';
  }
        global Database.querylocator start(Database.BatchableContext BC){
                return Database.getQueryLocator(query);
        }


    global void execute(Database.BatchableContext BC, List<sObject> scope){
        for(sObject s : scope){
        for(PricebookEntry pbe : (List<PricebookEntry>)scope){
            if(pbe.Pricebook2Id == stdPrice.Id && pbe.IsActive == true && pbe.SystemModStamp > Datetime.now().addMinutes(-15)){
               pbeIds.add(pbe.id); 
            }
        }
      
      List<PricebookEntry> pbeforinsert = new List<PricebookEntry>();
            system.debug('***************************************stdPrice ' +stdPrice);
            system.debug('***************************************fdaPrice ' +fdaPrice);
      List<PricebookEntry> stdPBE = [SELECT Pricebook2Id, IsActive, UnitPrice, Id, Product2Id, CurrencyIsoCode FROM PricebookEntry Where Id in: pbeIds];
        for(PricebookEntry pbecopy : stdPBE){
            PricebookEntry pbesToAdd = new PricebookEntry();{
                pbesToAdd.Pricebook2Id = fdaPrice.Id;
                pbesToAdd.IsActive = pbecopy.IsActive;
                pbesToAdd.Product2Id = pbecopy.Product2Id;
                pbesToAdd.UnitPrice = pbecopy.UnitPrice;
                pbesToAdd.CurrencyIsoCode = pbecopy.CurrencyIsoCode;
                pbeforinsert.add(pbesToAdd);
                
            }
        }
          insert pbeforinsert;  
        }
    }
        
        
      
            global void finish(Database.BatchableContext BC){
   }   


}


 
I am trying to look at all tasks for a specific time frame, then create a note and set the LinkedEntityId to the whatid or whoid. This code creates the content note, 1 for each task. But then created a contentdocumentlink for each whatid or whoid for every note.
For instance, the query returns 8 tasks, 8 contentnotes are created and then each note is associated to each whatid(opps). So every opp has 8 notes. I have reworked this a million times and I am just not sure how to get it to know that I just want each contentnote associated to the task it "copied".
At this point I think I am over complicating it and the answer is so easy that I am not seeing it. How can I get this to create one note per task, and then associate it to the opp that the task is related? (whatid)
 
global class archiveTasksBatch implements Database.Batchable<SObject>, Schedulable{

public final string query;
date mydate = date.today().addDays(-369);

public archiveTasksBatch() {
    query = 'Select WhoId, WhatId, Subject, Status, OwnerId, Id, Description, CreatedDate, ActivityDate From Task where ActivityDate = :mydate' ;
}
public void execute(SchedulableContext sc){
    Database.executeBatch(this, 100);
}
public Database.QueryLocator start(Database.BatchableContext bc){
    return Database.getQueryLocator(query);
}

public void execute(Database.BatchableContext bc, List<sObject> scope){

    list<ContentNote > newObjects = new list<ContentNote >();
    list<ContentDocumentLink  > newCDL = new list<ContentDocumentLink  >();
    Map<ID, String> taskIdMap = new Map<ID, String>();





    for(Sobject s : scope){
        Task obj = (Task) s;
        String myString = obj.Description + obj.ActivityDate;
        Blob myBlob = Blob.valueof(myString.escapeHtml4());
        newObjects.add(new ContentNote (
        Title = obj.Subject,
        Content = myBlob
        ));

   }

        system.debug('*********************************newObjects' +newObjects.size());
        system.debug('*********************************scope' +scope.size());

        if(!newObjects.isEmpty()){
            Database.SaveResult[] srList = Database.insert(newObjects, false);
            for (Database.SaveResult sr : srList) {
                        for (Sobject sc : scope){
                        Task t = (Task) sc;
                        string tid = t.WhatId;
                        if(tid == null) {
                            tid = t.WhoId;}
                        taskIdMap.put(sr.Id, tid);
                if(sr.isSuccess()) {
                    ContentDocumentLink cdl = new ContentDocumentLink();
                    cdl.ContentDocumentId = sr.getId();
                    cdl.LinkedEntityId = taskIdMap.get(sr.id);
                    cdl.Visibility = 'AllUsers';
                    cdl.ShareType = 'I';
                    newCDL.add(cdl);
        system.debug('*********************************srList' +srList.size());
        system.debug('*********************************newCDL' +newCDL.size());
        system.debug('*********************************LinkedEntityId' +cdl.LinkedEntityId);
        system.debug('*********************************ContentDocumentId' +cdl.ContentDocumentId);

                }
            }
        }
     }
    insert newCDL;
}


public void finish(Database.BatchableContext bc){
    system.debug('JOB IS FINISHED');
}

 
We are attempting to integrate Salesforce and ServceNow using Azuqua. We first set up Azuqua to listen for changes to the account and when we got the error QUERY_TOO_COMPLICATED we switched to using an outbound message - which results in the same error.

After doing some research we found that Formula fields can become complicated at run time if there is a heavy calculation or if there are many formulas running at the same time. We reduced the fields down to only one formula field, same error. The we reduced it down to just querying Name and Id, same error.

The Azuqua support team is trying to help us but they have never run into this situation. I contacted Salesforce support who told me that since this is a deveopler question they could not help me but sited this article https://help.salesforce.com/articleView?id=QUERY-TOO-COMPLICATED&language=en_US&type=1, which gave me the same information I had already found.

Does anyone know how to resolve this? Below is the complete error message. Thanks in advance.
{ "message": "Bad Request", "headers": { "date": "Mon, 27 Mar 2017 22:29:32 GMT", "x-content-type-options": "nosniff", "x-xss-protection": "1; mode=block", "content-security-policy": "reflected-xss block;report-uri /_/ContentDomainCSPNoAuth?type=xss, referrer origin-when-cross-origin", "set-cookie": [ "BrowserId=558zXbe4QKmo7dJNR0LXLQ;Path=/;Domain=.salesforce.com;Expires=Fri, 26-May-2017 22:29:32 GMT" ], "expires": "Thu, 01 Jan 1970 00:00:00 GMT", "sforce-limit-info": "api-usage=15169/186000", "content-type": "application/json;charset=UTF-8", "transfer-encoding": "chunked", "connection": "close" }, "statusCode": 400, "body": [ { "message": "Query is either selecting too many fields or the filter conditions are too complicated.", "errorCode": "QUERY_TOO_COMPLICATED" } ], "_error": true, "method": "H15N5Zwng", "flo": 26495, "execution": "8fa3cc22-d298-4252-a141-4f701eac6e0d", "code": 400 }

 
This test class is only getting 33% coverage, and I know it must have something to do with this line in the controller, but I am not sure how to get this covered.
list_of_accountmanagement = new List<string>{'Key (WIG)','Active Project','Active Opportunity > $50K','Partner-Managed','TAM-Managed','TSE-Managed (Tech Support)','Inactive'};

The bolded/underlined parts of the extension are what are not covered.
 
public final Account accounts;

    Public MAP<String,LIST<Account>> accsBucketedByType{get;set;} 
    public List<string> list_of_accountmanagement{get;set;}
    public ColumnControllerExt(ApexPages.StandardController stdController) {
    list_of_accountmanagement = new List<string>{'Key (WIG)','Active Project','Active Opportunity > $50K','Partner-Managed','TAM-Managed','TSE-Managed (Tech Support)','Inactive'};
    accsBucketedByType = new Map<String, List<Account>>();
    }
    public map<string,List<account>> getmap_values(){
        accsBucketedByType .put('Key (WIG)' ,[Select 

Id,name,Opportunity_Order_Status__c,NPS_Status__c,Case_Status_Stoplight__c,MSA_Status__c,Version_Status__c,Risk_Status__c,Team_Management_Status__c,Overall_Status__c,Total_RR_Converted_to_USD__c,Account_Management_Type__c,x3re__c from Account where 

Account_Management_Type__c =: 'Key (WIG)'order by Name]);

Here is the test class:
@isTest
private class TEST_ColumnController {
	
	static testMethod void ColumnController_test1() {

 Profile p = [SELECT Id FROM Profile WHERE Id='xx'];

//create dummy User
  User u = new User(Alias = 'testcc', Email='PopulateCountry@testorg.com', EmailEncodingKey='UTF-8', 
  LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', Department = 'Some Department',
  ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='PopulateCountry@testorg.com');       
  insert u;
  System.assert(u.Id != null);

//Create dummy accounts
    Account acc = new Account(Name = '1',Type = 'Customer',OwnerId = u.Id);
     
    insert acc; 

    Test.startTest();
    Test.setCurrentPage(Page.MyPage);

// create a new Account standard controller by passing it the account record
    ApexPages.StandardController controller = new ApexPages.StandardController(acc);

    // now pass it to the extension
    ColumnControllerExt stdController = new ColumnControllerExt(controller);

    system.assert(stdController != null); // controller has successfully been created

    
    Test.stopTest();
  }
}
Thanks for any help.
 
I am wondering if there is a better way to accomplish what this trigger does... or a cleaner way to write the code. Or am I missing an easier way to get the result?

Thanks!
 
trigger CurrencyUpdates on Account (before update) {


List<Account> acclist = new List<Account>();

    for(Account acc: Trigger.new){
        If(Trigger.oldMap.get(acc.id).Currency_Type__c != acc.Currency_Type__c){
            system.debug('Old= ' +Trigger.oldMap.get(acc.id).Currency_Type__c);
            system.debug('New= ' +acc.Currency_Type__c);            
        if (acc.Currency_Type__c == 'YEN'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0100;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0100;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0100;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0100;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0100;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0100;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0100;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0100;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0100;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0100;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0100;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0100;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0100;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0100;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0100;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0100;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0100;            
        } else if (acc.Currency_Type__c == 'CHF') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9478;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9478;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9478;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9478;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9478;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9478;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9478;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9478;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9478;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9478;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9478;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9478;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9478;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9478;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9478;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9478;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9478;            
        }else if (acc.Currency_Type__c == 'EUR') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.3008;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.3008;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.3008;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.3008;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.3008;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.3008;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.3008;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.3008;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.3008;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.3008;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.3008;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.3008;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.3008;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.3008;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.3008; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.3008;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.3008;
        }else if (acc.Currency_Type__c == 'CAD'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.9502;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.9502;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.9502;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.9502;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.9502;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.9502;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.9502;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.9502;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.9502;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.9502;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.9502;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.9502;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.9502;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.9502;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.9502; 
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.9502;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.9502;            
        }else if (acc.Currency_Type__c == 'GBP'){
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.5279;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.5279;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.5279;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.5279;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.5279;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.5279;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.5279;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.5279;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.5279;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.5279;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.5279;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.5279;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.5279;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.5279;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.5279;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.5279;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.5279;            
        }else if (acc.Currency_Type__c == 'KRW') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.0009;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.0009;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.0009;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.0009;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.0009;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.0009;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.0009;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.0009;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.0009;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.0009;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.0009;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.0009;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.0009;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.0009;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.0009;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.0009;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.0009;            
        }else if (acc.Currency_Type__c == 'USD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 1.0;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 1.0;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 1.0;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 1.0;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 1.0;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 1.0;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 1.0;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 1.0;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 1.0;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 1.0;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 1.0;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 1.0;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 1.0;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *1.0;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 1.0;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 1.0;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 1.0;            
        }else if (acc.Currency_Type__c == 'AUD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.88309;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.88309;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.88309;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.88309;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.88309;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.88309;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.88309;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.88309;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.88309;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.88309;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.88309;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.88309;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.88309;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.88309;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.88309;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.88309;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.88309;            
        }else if (acc.Currency_Type__c == 'SGD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.78499;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.78499;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.78499;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.78499;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.78499;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.78499;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.78499;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.78499;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.78499;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.78499;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.78499;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.78499;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.78499;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.78499;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.78499;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.78499;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.78499;            
        }else if (acc.Currency_Type__c == 'HKD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.12891;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.12891;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.12891;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.12891;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.12891;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.12891;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.12891;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.12891;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.12891;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.12891;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.12891;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.12891;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.12891;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c * 0.12891;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.12891;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.12891;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.12891;            
        }else if (acc.Currency_Type__c == 'NZD') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.79067;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.79067;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.79067;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.79067;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.79067;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.79067;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.79067;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.79067;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.79067;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.79067;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.79067;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.79067;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.79067;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.79067;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.79067;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.79067;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.79067;            
        }else if (acc.Currency_Type__c == 'THB') {
            acc.Total_RR_Converted_to_USD__c = acc.Total_RR_Trigger__c * 0.03078;
            acc.X3RECalc_Hosting_USD__c = acc.X3RECalc_Hosting__c * 0.03078;
            acc.X3RECalc_Hybrid_USD__c = acc.X3RECalc_Hybrid__c * 0.03078;
            acc.X3RECalc_MSA_USD__c = acc.X3RECalc_MSA__c * 0.03078;
            acc.X3RECalc_Sub_Asp_USD__c = acc.X3RECalc_Sub_Asp__c * 0.03078;
            acc.X3RECalcMCUniv_USD__c = acc.X3RECalcMCUniv__c * 0.03078;
            acc.X3RECalc_SPARK_USD__c = acc.X3RECalc_SPARK__c * 0.03078;
            acc.X3RECalc_TAM_USD__c = acc.X3RECalc_TAM__c * 0.03078;
            acc.X3RECalc_SVR515_USD__c = acc.X3RECalc_SVR515__c * 0.03078;
            acc.Calc_Total_Sub_Asp_USD__c = acc.Calc_Total_Sub_Asp__c * 0.03078;
            acc.Calc_Total_MSA_USD__c = acc.Calc_Total_MSA__c * 0.03078;
            acc.Calc_Total_MCUniv_USD__c = acc.Calc_Total_MCUniv__c * 0.03078;
            acc.Calc_Total_Hybrid_USD__c = acc.Calc_Total_Hybrid__c * 0.03078;
            acc.Calc_Total_Hosting_USD__c = acc.Calc_Total_Hosting__c *0.03078;
            acc.Calc_Total_SPARK_USD__c = acc.Calc_Total_SPARK__c * 0.03078;
            acc.Calc_Total_TAM_USD__c = acc.Calc_Total_TAM__c * 0.03078;        
            acc.Calc_Total_SVR515_USD__c = acc.Calc_Total_SVR515__c * 0.03078;            
        }else (acc.Total_RR_Converted_to_USD__c = null);
                  
        }
    }
update acclist;
}

 
I am trying to update the Contact with State & time zone on insert and update. I have an object that holds a list of all areacodes and each record includes time zone and state. What I want to happen is that when a contact is inserted the trigger will match the area code (custom formula field on the contact) to my custom object and then populate the state and timezone. (If the state is null - which is not part of the trigger I will be showing). Also, on update I want the trigger to look check if the state is being updated, and if so, update the time zone to match the new state. (Sometimes contacts have cell numbers which do not correlate to the state in which they reside.) I have tried many iterations of this tirgger and below is what I have ended up with that "works" to varying degrees.
I have tested each section (the insert and the update) and they "work" - but not how I would like.

This part of the trigger works as long as I do not have the If(Trigger.IsInsert), once I add that it no longer fires.
trigger Contact_PopulateAreaCode on Contact (before update, before insert) {
    // first iteration to get the area codes    
    Set<String> contactAC = new Set<String>();
    Set<String> contactST = new Set<String>();


    If(Trigger.isInsert){
     
     for(Contact newContact:Trigger.new){
     if(newContact.LeadSource != 'New Customer Contact')
       contactAC.add(newContact.Area_code__c);
          System.debug('*****************************************contactAC has ' + contactAC.size());
     }
    
     // populate the map
     List <AreaCodeTimeZoneMap__c> IMaps = [SELECT Id, Area_Code__c, State_Province__c, Std_Time_Zone__c FROM AreaCodeTimeZoneMap__c WHERE Area_Code__c IN :contactAC];
    System.debug('*****************************************Maps has ' + imaps.size());
     Map<String, AreaCodeTimeZoneMap__c> ACTZMap = new  Map<String, AreaCodeTimeZoneMap__c>();
    for(AreaCodeTimeZoneMap__c a : IMaps){
        ACTZMap.put(a.Area_code__c,a);
    }

	     // final iteration to set state & timezone based on Area Code
 
     for(Contact newContact:Trigger.new){
         if(newContact.LeadSource != 'Customer Website User' && (newContact.MailingCountry=='United States'||newContact.MailingCountry=='Canada' )){
             AreaCodeTimeZoneMap__c mp = ACTZMap.get(newContact.Area_Code__c);
             if(mp != null){
             newContact.MailingState = mp.State_Province__c;
             newContact.Time_Zone__c = mp.Std_Time_Zone__c;
             }
          }
     } 

}
In the second part of the trigger I have a few issues. 1 - the code used to find the new value of the state and the old value return only the old value. I assume that has something to do with it being a before trigger, but I have read that it is possible to get the trigger.oldMap in a before trigger. I have it all commented out (One note, and I swear this worked before - the part that has Contact oldContact = Trigger.old; come back with an error of "Illegal assignment from List<Contact> to Contact".
With all of that commented out the trigger will fire, but it updates the time zone to the based on the old state. I was thinking the commented code would fix this, but even when it did work the old and new values were always the same - and always the old value.
if(Trigger.isUpdate){
     for(Contact newContact:Trigger.new){
        //Contact oldContact = Trigger.old;
    		//String oldState = oldContact.MailingState;
   			//String newState = newContact.MailingState;	
        // System.debug('*****************************************Old State ' + oldState);
        // System.debug('*****************************************New State ' + newState); 
        // if(newState != oldState){
     if(newContact.LeadSource != 'New Customer Contact')
       contactST.add(newContact.MailingState);
          System.debug('*****************************************contactST has ' + contactST.size());
     }

     // populate the map
     List <AreaCodeTimeZoneMap__c> UMaps = [SELECT Id, Area_Code__c, State_Province__c, Std_Time_Zone__c FROM AreaCodeTimeZoneMap__c WHERE State_Province__c IN :contactST];
    System.debug('*****************************************Maps has ' + umaps.size());
     Map<String, AreaCodeTimeZoneMap__c> ACTZMap1 = new  Map<String, AreaCodeTimeZoneMap__c>();
    for(AreaCodeTimeZoneMap__c a : UMaps){
        ACTZMap1.put(a.State_Province__c,a);
    }
	     // final iteration to set timezone based on State
 
     for(Contact newContact:Trigger.new){
              AreaCodeTimeZoneMap__c mp = ACTZMap1.get(newContact.MailingState);
             newContact.Time_Zone__c = mp.Std_Time_Zone__c;
     }
        
}
}

I also know that my updates are happening in the for loop. I have tried a couple of things to get them out of the loop (assigning a list) but I cannot seem to figure that out. I am not asking you to rewrite the code for me to include everything I need - I just need some direction as I have spent hours combing through discussion forums and trying new things - but I cannot seem to get my head around it enough to make it happen.

Thanks in advance.
 
I have a trigger that looks at a multi-select picklist on a custom object, and then splits the vaules and creates records on another object. The issue that I have is that it will create multiple new records since there is no logic to see if a record already exists.

On the Account_RoadMap__c object I have a field named Product_Planned_to_Purchase__c, it is multi-select. When this field is updated I want it to create a record for each product created on the object Account_RoadMap_Product__c related to both the Account Roadmap and the Account. However, if there is already a record on the Account Roadmap Product that matches what is in the multi-select picklist, I dont want it to create another record.

I have tried comparing lists - but I am just not sure how to get there. Any help would be much appreciated. 
 
trigger AutoCreateRoadMapProduct on Account_RoadMap__c (after update) {
    List<Account_RoadMap_Product__c> products = new List<Account_RoadMap_Product__c>();

    //For each roadmap processed by the trigger, add a new  

    //product record for the specified product.  

    for (Account_RoadMap__c newRM: Trigger.New) {
        if (newRM.Product_Planned_to_Purchase__c != null) {
            // split out the multi-select picklist using the semicolon delimiter
            for(String product: newRM.Product_Planned_to_Purchase__c.split(';')){
                products.add(new Account_RoadMap_Product__c(
                        Product_Name__c = product,
                        RoadMap__c = newRM.Id,
                        Account_Name__c = newRM.Account_Name__c));
            }
        }
    }
    insert products;
}

 
I have a custom field on a custom object, the field is a multi-picklist of products. What I want is that when someone chooses those products and then saves for it to trigger a flow that creates a new record (on a related custom object) for each product. Is this possible? 

I know I can do this is apex using split(), and I know you can write apex plugins for flows, just wondering if the list that the class would create can be passed back to the flow to create the records? 

I looked at an example of a lead conversion plugin so I have an idea that it might work, but I just cannot wrap my brain around what I am trying to do to understand how to mix the two together - knowing it IS possible will at least get me started. 
 
In the wrapper class (which I am using and not even really sure I HAVE to), I am getting data from Accounts, contacts, and 2 custom objects. In my vf page I have 5 different sections - 1 updates account data, one updates information from both custom objects, one updates info for just one of the custom objects, one updates contacts, and one updates accounts again - but using a wrapper to get the parent accounts.

I have figured out the easiest part (updating the first account section) but cannot for the life of me figure out how to save data (from an inline edit) back to the other objects (I have not tried contacts, just trying to get the custom objects).

Here is my class extension (page uses standard account controller with this extension).
public with sharing class RoadMapAccount {

    private final Account account;
    public list<wrapperclass> accountlist1wrap { get; set; }
    public list<wrapperclass> purchasedwrap{ get; set; }
    public list<wrapperclass> implementedwrap { get; set; }
    public list<wrapperclass> plannedwrap{ get; set; }
    public list<wrapperclass> roadmapwrap { get; set; }
    public list<wrapperclass> contactwrap { get; set; }
         
        
    public RoadMapAccount(ApexPages.StandardController controller) {

        account = [Select Id, Name, Product_Interested__c, Account_Management_Type__c,
        Overall_Status__c, Opportunity_Order_Status__c, NPS_Status__c,Case_Status_Stoplight__c,
        MSA_Status__c, Risk_Status__c, Version_Status__c, Team_Management_Status__c, Escalate_Button__c,
        Wall_of_Success__c, Escalated_Reason__c, Account_Alias__c, parentid, parent_install__c, type,
        Parent.Name,Parent_Install__r.Name,(Select Id, Product_Status__c From MC_Assets__r)
         From Account where Id = :ApexPages.currentPage().getParameters().get('id')];
        
         list<Account> object0 = [
         Select parentid, parent_install__c, Account_Alias__c, Type, Name,
        Parent.Name,Parent_Install__r.Name
         from Account
         WHERE parentid =:account.Id OR parent_install__c =:account.Id];

         list<MC_Products__c> object1 = [
            Select Product_Status__c, Id, Name 
            From MC_Products__c
            WHERE Account__c =:account.Id]; 

        list<IS_RoadMap__c> object2 = [
            Select Id, Depts_using_Training__c, Depts_using_Documents__c, Account_Name__c,
            Product_Planned_to_Purchase__c, Phase_date__c, Depts_using_Risk__c,
            Depts_using_Supplier__c, Depts_using_Audit__c, Depts_using_Process__c, Next_Phase_Implementation_Notes__c,
            Account_Strategy__c, Current_System_concerns__c, Key_Individuals__c 
            From IS_RoadMap__c  
            WHERE Account_Name__c =:account.Id];

        list<Contact> object3 = [
        Select Id, AccountId, LastName, FirstName, Email, Title, Department_Contact__c, Viewed_Harbor_Tour__c
        From Contact
        WHERE AccountId =:account.Id];

        accountlist1wrap = new list<wrapperclass>();
        for(Account obj0: object0){
            accountlist1wrap.add(new wrapperclass(obj0));
        }            

        purchasedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
        	if(obj1.Product_Status__c == 'Purchased')
            purchasedwrap.add(new wrapperclass(obj1));
        }
        implementedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
        	if(obj1.Product_Status__c == 'Implemented')
            implementedwrap.add(new wrapperclass(obj1));        
        }
        plannedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
          if(obj1.Product_Status__c == 'Plan to Implement')
            plannedwrap.add(new wrapperclass(obj1));        
        }
        roadmapwrap = new list<wrapperclass>();
        for(IS_RoadMap__c obj2: object2){
            roadmapwrap.add(new wrapperclass(obj2));
        }
        contactwrap = new list<wrapperclass>();
        for(Contact obj3: object3){
            contactwrap.add(new wrapperclass(obj3));
        }

     }    

    

    public class wrapperclass{
        public Account object_0{get;set;}
        public MC_Products__c object_1{get;set;}
        public IS_RoadMap__c object_2{get;set;}
        public Contact object_3{get;set;}        

        public wrapperclass(Account obj0){
            this.object_0 = (obj0);
        }
         public wrapperclass(MC_Products__c obj1){
            this.object_1 = (obj1);
        }
        public wrapperclass(IS_RoadMap__c obj2) {
            this.object_2 = (obj2);
        }
        public wrapperclass(Contact obj3) {
            this.object_3 = (obj3);
        }  
}
    

	public Account getaccount() {
        return account;    
     } 
    public void saveRM()
    { account.RoadMap__c=True;
        try{   
        update account; 
     
        }
        catch(Exception e)
        {
        }
    }
        public boolean roadmap {
        get {
            return [
                    select Roadmap__c
                    from Account
                    where Id =:account.Id
                    ].Roadmap__c;
        }
    }
    public void saveacc()
    {
        try{   
        update account;
        
     
        }
        catch(Exception e)
        {
        }
    }            
 
}

Visual force page (this will eventually be a "tab" on a custom account page.) (all save buttons, other than the first one, are just there as place holders - I know they are not configured correctly)
<apex:page Standardcontroller="Account" extensions="RoadMapAccount"
            sidebar="false" showheader="false">
            <base target="_parent" />

<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"/>
<script>
    j$ = jQuery.noConflict();
    
    function showLoadingDiv() {
        var newHeight = j$("[id$=lead-edit-section] .pbSubsection").css("height");//Just shade the body, not the header
        j$("[id$=loading-curtain-div]").css("background-color", "black").css("opacity", 0.35).css("height", newHeight).css("width", "80%");
    }
    function hideLoadingDiv() {
        j$("[id$=loading-curtain-div]").css("background-color", "black").css("opacity", "1").css("height", "0px").css("width", "80%");
    }
    
   function pageScroll() {
        window.scrollBy(0,400); // horizontal and vertical scroll increments
        
    }
 </script> 
 <style>
 input.btn { 
     color:#050; 
     font: bold 84% 'trebuchet ms',helvetica,sans-serif; 
     background-color:#fed; 
     border:1px solid; 
     border-color: #696 #363 #363 #696; 
   }
 </style>   
    <apex:form >
 <apex:pageblock title="RoadMap">
                    <apex:pageBlock rendered="{!Not (roadmap)}">
                <apex:pageBlockButtons location="top" >
                     <apex:commandbutton onclick="pageScroll()" value="Create RoadMap" action="{!saveRM}"  id="rmbutton" />
                </apex:pageBlockButtons><br />
                <apex:pageMessage summary="Click 'Create RoadMap' to get started" severity="info" strength="3" />
                   </apex:pageBlock>   

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="account-edit-block">
        <apex:actionStatus id="save-account-status"/>
          <apex:pageBlockSection title="Account Information" columns="2" collapsible="false" id="account-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:outputField value="{!account.name}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
            <apex:outputField value="{!account.Account_Alias__c}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
            <apex:outputField value="{!account.type}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
          </apex:pageBlockSection>
            <center><apex:commandButton action="{!saveacc}" value="Save Account Information" status="save-account-status" rerender="account-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion>  

<apex:outputpanel id="fullmap">
     <apex:outputpanel rendered="{!roadmap}">

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="product-edit-block">
        <apex:actionStatus id="save-product-status"/>
          <apex:pageBlockSection title="Product Details" id="product-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:panelGrid columns="2" width="1350px">
        <apex:pageblock >
         <apex:pageblocktable value="{!purchasedwrap}" var="pur" id="Pdetails">
          <apex:column headerValue="Purchased">
          <apex:repeat var="a" value="{!pur.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!pur.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
        </apex:pageblocktable>
       </apex:pageblock>

        <apex:pageblock >
         <apex:pageblocktable value="{!implementedwrap}" var="imp" id="Idetails">
          <apex:column headerValue="Implemented">
          <apex:repeat var="a" value="{!imp.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!imp.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          </apex:pageblocktable>
         </apex:pageblock>

        <apex:pageblock mode="inlineEdit" >
         <apex:pageblocktable value="{!plannedwrap}" var="pln" id="PIdetails">
          <apex:column headerValue="Planned to Implement">
          <apex:repeat var="a" value="{!pln.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!pln.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>
         </apex:pageblocktable>
        </apex:pageblock>

        <apex:pageblock >
         <apex:pageblocktable value="{!roadmapwrap}" var="rm" id="PPdetails">
          <apex:column headerValue="Products Planned Purchased">
          <apex:outputfield value="{!rm.object_2.Product_Planned_to_Purchase__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          <apex:column headerValue="Phase Date">
          <apex:outputfield value="{!rm.object_2.Phase_date__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>          
          </apex:column>
          <apex:column >
          <apex:commandbutton value="Remind Me" action="/00T/e?what_id={!account.Id}&tsk12=Not Started&retURL=%2Fa{!account.Id}"/>
          </apex:column>
          </apex:pageblocktable>
         </apex:pageblock>
        </apex:panelGrid>
       </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Product Information" status="save-product-status" rerender="product-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 



    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="dept-edit-block">
        <apex:actionStatus id="save-dept-status"/>
          <apex:pageBlockSection title="Department Information" id="dept-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
                <apex:panelGrid columns="6" width="1350px">

        <apex:pageblock mode="inlineEdit" >
         <apex:pageblocktable value="{!roadmapwrap}" var="rmd" id="depts1">
           <apex:column headerValue="Depts using Documents">
          <apex:outputfield value="{!rmd.object_2.Depts_using_Documents__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmp" id="depts2">
           <apex:column headerValue="Depts using Process">
          <apex:outputfield value="{!rmp.object_2.Depts_using_Process__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmt" id="depts3">
           <apex:column headerValue="Depts using Training">
          <apex:outputfield value="{!rmt.object_2.Depts_using_Training__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rma" id="depts4">
           <apex:column headerValue="Depts using Audit">
          <apex:outputfield value="{!rma.object_2.Depts_using_Audit__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rms" id="depts5">
           <apex:column headerValue="Depts using Supplier">
          <apex:outputfield value="{!rms.object_2.Depts_using_Supplier__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmr" id="depts6">
           <apex:column headerValue="Depts using Risk">
          <apex:outputfield value="{!rmr.object_2.Depts_using_Risk__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>
         </apex:panelGrid> <br />
                <apex:panelGrid columns="1" width="1350px">
         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="n" id="notes">
           <apex:column headerValue="Next Phase Implementation Notes">
          <apex:outputfield value="{!n.object_2.Next_Phase_Implementation_Notes__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>
                                                      
         </apex:panelGrid>
      </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Dept Information" status="save-dept-status" rerender="dept-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="strat-edit-block">
        <apex:actionStatus id="save-strat-status"/>
          <apex:pageBlockSection title="Account Notes and Account Strategy" id="strat-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:panelGrid columns="1" width="1350px">
        <apex:pageblock title="Associated Contacts" mode="inlineEdit">
         <apex:pageblocktable value="{!contactwrap}" var="con" id="contact">
          <apex:column headerValue="Name">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputlink value="{c.id}"><apex:outputField value="{!c.FirstName}"/><apex:outputField value="{!c.LastName}"/></apex:outputlink>
          </apex:repeat>
          </apex:column>  
          <apex:column headerValue="Title">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.title}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          <apex:column headerValue="Department">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.Department_Contact__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          <apex:column headerValue="Email">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.email}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column> 
         <apex:column headerValue="Viewed Harbor Tour" value="{!con.object_3.Viewed_Harbor_Tour__c}" />
          </apex:pageblocktable>
         </apex:pageblock>
         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="k" id="key">
           <apex:column headerValue="Key Individuals (Team details/concerns, Political layout, Newsletter Opt out…)">
          <apex:outputfield value="{!k.object_2.Key_Individuals__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         <apex:pageblocktable value="{!roadmapwrap}" var="c" id="current">
           <apex:column headerValue="Current System concerns or issues (General)">
          <apex:outputfield value="{!c.object_2.Current_System_concerns__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         <apex:pageblocktable value="{!roadmapwrap}" var="s" id="strat">
           <apex:column headerValue="Account Strategy (Ex: Expand usage of Docs by expanding department, then focus on Training. Ex: Key Executive sponsor(s) and Champion who can expand through company)">
          <apex:outputfield value="{!s.object_2.Account_Strategy__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
          </apex:pageblock>
         </apex:panelGrid>
       </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Strategy Information" status="save-strat-status" rerender="strat-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 
 
    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="parent-edit-block">
        <apex:actionStatus id="save-parent-status"/>
          <apex:pageBlockSection title="Associated Accounts - Children and Non-Install" id="parent-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem> 
                <apex:panelGrid columns="1" width="1350px">
        <apex:pageblock mode="inlineEdit" rendered="{!AND(NOT(ISNULL(accountlist1wrap)),accountlist1wrap.size>0)}">
         <apex:pageblocktable value="{!accountlist1wrap}" var="par" id="parent">
          <apex:column headerValue="Account Name">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Name}"/>
           </apex:repeat>
          </apex:column>
          <apex:column headerValue="Account Alias">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Account_Alias__c}"/>
           </apex:repeat>
          </apex:column>
          <apex:column headerValue="Account Type">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.type}"/>
           </apex:repeat>
          </apex:column>          
          <apex:column headerValue="Parent">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.parent.name}"/>
           </apex:repeat>
          </apex:column>  
          <apex:column headerValue="Parent Install">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Parent_Install__r.name}"/>
           </apex:repeat>
          </apex:column>      
          </apex:pageblocktable>
         </apex:pageblock>
        <apex:pageBlock rendered="{!OR(ISNULL(accountlist1wrap),accountlist1wrap.size=0)}">
          <apex:pageMessage summary="This account is not the Parent or Parent Install on any other accounts." severity="info" strength="3" />
         </apex:pageBlock>
         </apex:panelGrid>
        </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Parent Information" status="save-parent-status" rerender="parent-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 
   </apex:outputpanel>             
</apex:outputpanel>   
 </apex:pageblock>        
    </apex:form>
</apex:page>

 
I have a trigger that has to meet these requirements.
If a new rating (custom object) is submitted and is the type of 'overall', has a score of 9 or 10, and the contact on the rating does not have a reference proflle (custom object) create the reference profile. Rating has the contact as a master, Reference Profle has the Account as a master with a lookup to the contact - both fields are required.

The trigger works. However, I did a test where I mass uploaded a bunch of different ratings (types and scores) and it only created one new reference profile (the first one on the list that matched the criteria). There was no error - debug log shows a success. I have worked hours on this trigger (just took an APEX class last month) and I am just not sure why it would not create the reference profile for all contacts if the criteria is a match. 

Here is the trigger:
trigger CreateReferenceProfilefromNewRating on Rating__c (after insert) {
	
	Set<String> ratIdsSet = new Set<String>(); {
		for (Rating__c r: trigger.new) {
			if (r.rating_type__c == 'overall' &&(r.Rating__c == '9' || r.Rating__c == '10')) 
			ratIdsSet.add(r.Contact__c);
			{
		
	List<Reference_profile__c> reftoInsert = new List<Reference_profile__c>([Select  Contact__c 	From Reference_profile__c
	WHERE Contact__c IN:ratIdsSet]);
	
		Reference_profile__c n = new Reference_profile__c ();
      if(r.contact__c != n.contact__c && r.rating_type__c == 'overall' &&(r.Rating__c == '9' || r.Rating__c == '10')){ 
	String ConName = r.Contact_Name_Text__c;
	String AccName = r.Account_Name_Text__c;

		n.contact__c = r.contact__c;  
		n.account__c = r.account__c;
		n.name = AccName + ' - ' + ConName;
		n.reference_status__c = 'candidate';
		n.created_from_rating__c = true;

		reftoInsert.add(n);
	} else if(r.contact__c == n.contact__c && r.rating_type__c == 'overall' &&(r.Rating__c == '9' || r.Rating__c == '10')){
		
	}
	try {
		insert reftoInsert;	
	} catch (system.Dmlexception e) {
		system.debug (e);
	}
	}
		}
	}
	
}


  • September 17, 2014
  • Like
  • 0

I have created a site that I will use for internal employees who do not have salesforce. I have set this up but for whatever reason I cannot access any account info.

 

http://mastercontrol.force.com/anycethome/anyCustomerEmployeeTimeDetail?id=0013000000GfdxRAAR - this page throws the authentication error

http://mastercontrol.force.com/anycethome/anyCustomerEmployeeTimeDetail - this loads fine but with no data

 

I have set the permission for all of the objects. I feel like I have checked everything I know to check.. what am I doing wrong?!!

 

Let me know if you need more details.

 

I have a table that shows icons of account statuses - when I set the VFpage to showheader=false it changes how that table is displayed (this also happens when viewing on the force.com sites even with showheader=true) - see stackexchange question since I cannot post pics here - can someone help me understand why?

 

<apex:page StandardController="Account" extensions="ColumnControllerExt" tabstyle="account">
<head>
    <script type="text/javascript">
// Popup window code
function newPopup(url) {
    popupWindow = window.open(
        url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>

<style type="text/css">
#rowInfo,#rows{
        padding:5px;
    text-align:center;
    background-color:#f8f8f8;
    border:solid 2px #236fbd;
}
#rowInfo { 
    width:50px;
    display:bold; 
}
table
{
border-collapse:collapse;
table-layout: fixed;
}	
 </style>
    <style type="text/css">
    <!--
    body {
      color:#000000;
      background-color:#FFFFFF;
	    }
    a  { color:#0000FF; }
    a:visited { color:#800080; }
    a:hover { color:#008000; }
    a:active { color:#FF0000; }
    -->
	div#wrapperHeader div#header {
 width:1000px;
 height:200px;
 margin:0 auto;
}

div#wrapperHeader div#header img {
 width:; /* the width of the logo image */
 height:; /* the height of the logo image */
 margin:0 auto;
}
    </style>
	<div id="wrapperHeader">
 <div id="header">
  <img src="https://c.na13.content.force.com/servlet/servlet.ImageServer?id=015a0000002WenZ&oid=00D3000000003Hx&lastMod=1375828250000" alt="logo" />
 
    <center><font size="3"><a href="/apex/anyCustomerEmployeeTimeList">List View</a></font></center>
        </div> 
</div>
</head>
<body>

<table width="100%">
<tr>
<td width="80%" valign="top">
        <apex:outputPanel >
            <apex:form >
                <apex:actionFunction action="{!setHoveredAccount}" name="setDetailId" reRender="accountDetail" status="detailStatus">
                    <apex:param name="detailId" value="" assignTo="{!hoveredAccount}"/>
                </apex:actionFunction>
                <table>
                     <tr align="center">
                         <td><a href="JavaScript&colon;newPopup ('http://mc-www.mainman.dcs/dcs/main/index.cfm?event=showFile&ID=1D833C4A02E0D046BE&static=false');" ><img src="/img/icon/documents24.png" title="Key (WIG) RASCI"/></a></td>
                              
                 <td><a href="#"><img src="/img/icon/documents24.png" title="Acitve Project RASCI"/></a></td>  
                     <td><a href="#"><img src="/img/icon/documents24.png" title="Active Opportunity > $50K RASCI"/></a></td>  
                         <td><a href="#"><img src="/img/icon/documents24.png" title="Partner-Managed RASCI"/></a></td>  
                             <td><a href="#"><img src="/img/icon/documents24.png" title="TAM-Managed RASCI"/></a></td> 
                                 <td><a href="#"><img src="/img/icon/documents24.png" title="TSE-Managed RASCI"/></a></td>  
                                     <td><a href="#"><img src="/img/icon/documents24.png" title="Inactive RASCI"/></a></td>  
                 
                 
                 
                 </tr>
             
                  <tr>
                      <apex:repeat value="{!list_of_accountmanagement}" var="col_head">
                          <th id="rows">{!col_head}</th>
                      </apex:repeat></tr>
                  <tr>
                     
                              <apex:repeat value="{!list_of_accountmanagement}" var="col_head">
                          <td id="rowInfo" border="0"> 
                              
                              <apex:repeat value="{!map_values[col_head]}" var="col_val">
                                  <apex:outputLink value="/apex/anycustomeremployeetimedetail?id={!col_val.id}"
                                  onfocus="setDetailId('{!col_val.id}');" 
                                  onmouseover="setDetailId('{!col_val.id}');"
                                  onblur="setDetailId('');" 
                                  onmouseout="setDetailId('');">
                                      <apex:outputText value="{!col_val.overall_status__c}" escape="false"/>
                                  </apex:outputLink>             
                              
                              </apex:repeat>
                          </td>
                      </apex:repeat>
                      </tr>
                  </table>
            </apex:form>
        </apex:outputPanel>
</td>
<td width="20%">
    <apex:actionStatus id="detailStatus">
        <apex:facet name="start">
            <div style="text-align:center;">
                <img src="/img/loading.gif" alt="Loading graphic" />&nbsp;<strong>Loading...</strong>
            </div>
        </apex:facet>
        <apex:facet name="stop">
            <apex:outputPanel id="accountDetail">
                <br/>
                <br/>
       <apex:form >
   
           
<apex:pageblock rendered="{!hoverAccount!=null}" > 
    <apex:pageblocksection columns="1" id="name">
        <apex:outputfield value="{!hoverAccount.name}"/> 
        <apex:outputfield value="{!hoverAccount.type}"/> 
        </apex:pageblocksection>
    <apex:pageblocksection columns="1" id="ka"> 
    <apex:repeat value="{!$ObjectType.Account.FieldSets.Overview}" var="ov"> 
    <apex:outputfield value="{!hoverAccount[ov]}"/> 
    </apex:repeat> </apex:pageblocksection> </apex:pageblock> 
              </apex:form> 
            </apex:outputPanel>
        </apex:facet>
    </apex:actionStatus>
    
</td>
</tr>
</table>
</body>
</apex:page>

 

I have a visualforce page that includes an iframe. In the parent window i have a list of Icons that relate to accounts (account id) and I need to be able to hover over those icons and certain details on the account show in the iframe. Is this possible? This could also be a popout type thing, too, but preferably the details should show in the iframe.

 

I tried using the standard popout (minipagelayout) but it is not available on sites.com for non-salesforce users and eventually these pages need to be made accessible to everyone in my company.

 

I hope that made sense.

 

Thanks!

 

Here is the code I currently have using the minipage layout.

 

<apex:page StandardController="Account" extensions="ColumnControllerExt" >
<head>
    <script type="text/javascript">
// Popup window code
function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>

<style type="text/css"> 
#rowInfo,#rows{
        padding:5px;
    text-align:center;
    background-color:#FFFFFF;
    border:solid 1px #c3c3c3;
}
#rowInfo { 
    width:50px;
    display:bold; 
}
 </style>

</head>
<body>
 <apex:image value="/servlet/servlet.FileDownload?file=015e00000001X8a"/>
    <right><h1><font size="25">Any Customer, Any Employee, Any Time!</font></h1></right><br/>
    <center><font size="3"><a href="/apex/anyCustomerEmployeeTimeList">List View</a></font></center>
<table width="100%">
<tr valign="top">
<td width="70%">
        <apex:outputPanel style="width:300px" layout="block">
    <apex:variable value="{!0}" var="rowNumber" />
  <table>
 
              <tr align="center">
          <td><a href="JavaScript&colon;newPopup ('http://mc-www.mainman.dcs/dcs/main/index.cfm?event=showFile&ID=1D833C4A02E0D046BE&static=false');" >Key (WIG) RASCI</a></td>
                  
     <td><a href="#">Acitve Project RASCI</a></td>  
         <td><a href="#">Active Opportunity > $50K RASCI</a></td>  
             <td><a href="#">Partner-Managed RASCI</a></td>  
                 <td><a href="#">TAM-Managed RASCI</a></td> 
                     <td><a href="#">TSE-Managed RASCI</a></td>  
                         <td><a href="#">Inactive RASCI</a></td>  
     
     
     
     </tr>
 
      <tr>
          <apex:repeat value="{!list_of_accountmanagement}" var="col_head">
              <th id="rows">{!col_head}</th>
          </apex:repeat></tr>
      <tr>
         
                  <apex:repeat value="{!list_of_accountmanagement}" var="col_head">
              <td id="rowInfo" border="0"> 
                  
                  <apex:repeat value="{!map_values[col_head]}" var="col_val"> 
                      <a href="/{!col_val.id}" id="hover{!rowNumber}" 
                                        position="relative"
                                        onblur="LookupHoverDetail.getHover('hover{!rowNumber}').hide();" 
                                        onfocus="LookupHoverDetail.getHover('hover{!rowNumber}', '/{!col_val.id}/m?retURL=%2F{!col_val.id}&isAjaxRequest=1').show();" 
                                        onmouseout="LookupHoverDetail.getHover('hover{!rowNumber}').hide();" 
                                        onmouseover="LookupHoverDetail.getHover('hover{!rowNumber}', '/{!col_val.id}/m?retURL=%2F{!col_val.id}&isAjaxRequest=1').show();">
                      <apex:outputtext value="{!col_val.overall_status__c}" escape="false"/>
                          
                      </a>
              <!-- Increasing the value of the variable -->
            <apex:variable var="rowNumber" value="{!rowNumber + 1}" />                 
                  
                  </apex:repeat>
              </td>
          </apex:repeat>
      </tr>
  </table>
                    </apex:outputPanel>
</td>
    <td width="30%"><apex:iframe src="https://na13.salesforce.com/01Za00000016efu?isdtp=vw"/>
</td>
</tr>
</table>
</body>
</apex:page>

 

I am trying to display the 18 character key for campaigns in the campaign layout using a formula field for easy access to the full key, but using "Id" in the formula field only returns the 15 character key.

Can someone help me here?

Thank you in advance.