• AngrySloth
  • NEWBIE
  • 80 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 19
    Replies
I am writing a nested query in apex code but throwing error as Didn't understand relationship

Select Id,Name,MedConnect__Account_Name__c,(select Unity_Product_Code__c from Impacted_Products__r limit 1 ) from MedConnect__Product_Complaint__c limit 10  
                         
ParentObject- MedConnect__Product_Complaint__c
Child Object-   MedConnect__Impacted_Product__c
                     
Child Relationship Name     - Impacted_Products

could any one please tell me, if the query is wrong
Would someone please help me pass that ID from the current object to a controller's @RemoteAction using a detail list button?
I have tried System.currentPageReference().getparameters().get() but that doesn't work within @RemoteAction

The following is my controller, where I need my SELECT statement to filter by the objectID from which the custom detail button is pressed :
global with sharing class googlegantchartscope {  

public String oppList { get; set; }
    
@RemoteAction
global static Cluster__c[] loadrecords() {
    /*String testID = {!$currentpage.parameters.marketID}; 'a0Sc0000003GHNC'; System.currentPageReference().getparameters().get('marketID');*/
    
    return [select Name, Gantt_Chart_Name__c, Design_Completed__c, Estimated_Permit_Approval_Completion__c, Duration__c, Percent_Complete__c, Dependencies__c from Cluster__c where Design_Completed__c!=Null AND Market__c = :needCustomObjectIDFromDetailButtonHere];}
}

Visualforce Page:
<apex:page controller="googlegantchartscope">
<apex:includeScript id="a" value="https://www.google.com/jsapi" />
<apex:sectionHeader title="Google Charts + Javascript Remoting" subtitle="Demo of Cluster Scheduling" />
<div id="chart_div" />
    

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
 <script type="text/javascript">
 <!--loads the visualization in gant chart view-->
 google.charts.load('current', { 'packages': ['gantt']});
 google.charts.setOnLoadCallback(InitCharts);
  
 function InitCharts() {
 <!-- calls the function called 'loadrecords' in googlegantchart controller-->
 googlegantchartscope.loadrecords( 
     
 <!-- following the usual remoting syntax-->
 function(result, event) {
 
 var visualization = new google.visualization.Gantt(document.getElementById('chart_div'));
 <!--adding data to Chart-->
 var data = new google.visualization.DataTable();<!-- variable declaration-->
  
 data.addColumn('string', 'Cluster');
 data.addColumn('string','Cluster and Priority');
 data.addColumn('date', 'Design Completed');
 data.addColumn('date', 'Est Permit Approval Completion');
 data.addColumn('number', 'Duration');
 data.addColumn('number', 'Percent Complete');
 data.addColumn('string', 'Dependencies'); 
 
 for (var i = 0; i < result.length; i++) {
 var r = result[i];
     /*data.addRow([r.Task_Id__c, r.Task_Name__c, new Date(r.Start_Date__c), new Date(r.End_Date__c), r.Duration__c,r.Percent_Complete__c,r.Dependencies__c]);*/
     data.addRow([r.Name, r.Gantt_Chart_Name__c, new Date(r.Design_Completed__c), new Date(r.Estimated_Permit_Approval_Completion__c), r.Duration__c, r.Percent_Complete__c, r.Dependencies__c]);
 }
 var options = {
 height: i*50,
 gantt: {
 criticalPathEnabled:true
 }
 };
 visualization.draw(data, options);<!-- draws a table that contains the result of data-->
 },{escape:true});
 }
 </script>
 
</apex:page>


 
HI All,

I am very confused and stuck at the moment. I have the following Apex code being fired in a trigger:
 
private static void sendMercuryMotorOrderEmail( Set<Id> dealerOrderIds )
  {
    String[] ccAddrs = new List<String>{
      'dealercare@legendboats.com'
    };
    //email template we want to use
    String templateId = Legend_Settings__c.getOrgDefaults().Mercury_Order_Email_Template_Id__c;
    //Static contact we want to email
    Id contactId = Legend_Settings__c.getOrgDefaults().Mercury_Contact_Id__c;
    List<Messaging.SingleEmailMessage> msgList= new List<Messaging.SingleEmailMessage>();
    for( Id doId : dealerOrderIds )
    {
      Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
      mail.setTargetObjectId(contactId);
      mail.setWhatId( doId );
      mail.setTemplateId( templateId );
      mail.setCcAddresses( ccAddrs );
      mail.setSaveAsActivity(true);
      msgList.add(mail);
    }
    Messaging.sendEmail(msgList);
  }

In my sandbox environment ( which was refreshed from production very recently and none of this code has changed ) the email is sent as expected and the Email shows up in the Activity History on the record details page in Lightning.  In production the email is sent correctly but the nothing ever shows in the Activity History.  Furthor more ( probably the reason for no Activity History ) in Production no record in the Email Message table is being created, but in Sandbox there is.

I have check all permissions and settings in Production I can think of ( yes Track Activities is enabled on the object ).  Is there anything I am possibly missing?  My users really want this to show on the activity timeline and I am just completely confused.

Thanks a alot for any assistance.
I am experience an odd error since Summer 17 with a Path we where using on a Custom Object from a managed package.  We are using AccountingSeed financial package and I created a Path in Lightning Experience on the AcctSeed__Project__c object.  As you would expect this object is namespaced by 'AcctSeed'.  We have added our own custome field called Stage, which since we added it outside the package, contains no namespace leaving the API field name "Stage__c".  This all worked in Spring 17, but with the update to Summer 17, the path now throws and error stating "AcctSeed__Stage__c is not a valid field", which ofcourse it is not. Has anyone ran into this issue, where the package namespace is being appended to a field when it should not be?
Thanks for the help.
User-added image
I am looking for a way to run some apex code when a recod ( in this case an Opportunity ) which is locked by an approval process becomes unlocked. Basically I would like to post some chatter messages when someone presses the unlock button on the record.  I have tried to catch this in an Opportunity trigger, but this button appears to not modify the opportunity record, thus the trigger does not fire.  I need to let the original approver know that the record was unlocked thus what was approved may now change.  Any help would be greatly appreciated.  Thanks
We are trying to move to Lightning Experience and I have ran into an odd situation.  I have added a custom visualforce action and set the height to 500px.  The action was added to the page layout and is showing up correctly in lightning experience.  The problem is when the user clicks the button the modal box is displayed and the conent area in side the box is 500px high, but the actual content is only 186px height as seen here:

User-added image

If I change the height value declared in the custom action, the height of the model box changes, but the height of the displayed content does not.
Looking into the chrome dev tools inspector there are the following elements that are involved.
 
<div class="modal-body scrollable" style="height: 500px; max-height: 500px;">
This is apparently where the height gets set based on the height setting in custom action definition.
Then we have the following markup:
 
<div class="forceChatterBasePublisher--default forceChatterBasePublisher forceChatterAlohaPagePost">

    <div class="forceChatterPublisherPresentationPanel">
        
        <div class="container activeState">

            <div class="cuf-content">

               ....................
    
            </div>

        </div>

    </div>

</div>

If i manually add "height: 100%;" to these 4 elements in the inspector the content is displayed properly.

If anyone has any idea how to fix this, it would be greatly appreciated.  Thanks
 
I have some code which has been working for almost a year which has suddenly stoped working. It involves creating a Map<String, Wrapper> called selectedItems in the apex controller, using apex:repeat to iterate over the object in visualforce. There is a check box which when check or unchecked fires actionFunction to to the apex controller to either remove or add the item to the selectedItems Map and then rerenders the apex:outputPanel where the selectedItems is displayed.  The following is something i threw together to duplicate the problem as the actual code is much more involved and this is the problem I am facing.

Apex Controller
public with sharing class TestMapError {

  public Map<Id, Product2> prodMap { get; set; }
  public Map<Id, Product2> selectedMap { get; set; }

	public TestMapError() {
    prodMap = new Map<Id, Product2>([SELECT Id, Name FROM Product2 WHERE isActive = true LIMIT 5]);
    selectedMap = new Map<Id, Product2>();
	}

  public void toggleSelect()
  {
    String pId = Apexpages.currentPage().getParameters().get('pId');
    if( selectedMap.containsKey(pId) )
    {
      selectedMap.remove(pId);
    }
    else
    {
      selectedMap.put(pId, prodMap.get(pId) );
    }
  }

}

Visualforce Page
 
<apex:page showHeader="true" sidebar="true" controller="TestMapError">
  <apex:includeScript value="{!URLFOR($Resource.jQuery)}"/>

  <apex:form>

    <apex:actionFunction name="toggleSelected"
                         action="{!toggleSelect}"
                         rerender="selectedList">
      <apex:param name="pId" value="" />
    </apex:actionFunction>

    <apex:outputPanel id="theList">
      <ul>
        <apex:repeat value="{!prodMap}" var="prodId">
          <li>
            {!prodMap[prodId].Name}
            <input type="checkbox" data-pid="{!prodId}" onChange="toggleCheck(this);"/>
          </li>
        </apex:repeat>
      </ul>
    </apex:outputPanel>

  </apex:form>
  <br />

  <apex:outputPanel id="selectedList">
    <h3>Selected</h3>
     <ul>
      <apex:repeat value="{!selectedMap}" var="sId">
        <li>{!selectedMap[sId].Name}</li>
      </apex:repeat>
    </ul>
  </apex:outputPanel>

  <script type="text/javascript">

  var $j = jQuery.noConflict();


    function toggleCheck(ele)
    {
      console.log( $j(ele).data('pid'));
      toggleSelected( $j(ele).data('pid') );
    }

  </script>

</apex:page>

When the check box is selected, the first Item is not rendered in the selected list, but if you select a second item the first shows up.  If you check the view state, both items are present in the selectedMap.  Then if you uncheck any of the checked boxes you get a visualforce error of Map key not found in Map.

This used to work up until very recently and I did recieve an email from Salesforce stating they are upgrading to JDK 8.  Is it possible this is the underlying problem? Any help on this would be greatly appreciated
Hey All

I have been trying this all day and have searched to the best of my abilities but I can not find an answer or figure it out.  I am trting to create a PDF using getContentasPDF().  The method works fine standalone, but does not work when invoked from the Process Builder.  I know getContentAsPDF() is unavailable for future methods and triggers and was hoping the new Lightning Process Builder would handle it.

Does anyone know if it does? If so do you have any links to help me out?

Thanks to everyone.
This is a bit of breif bit of code:

controller:
<pre>

public List<String> partTypes = new List<String>{'Accessories', 'Electronics', 'Fishing', 'Fun and Entertainment', 'Graphics and Decals', 'Pontoon Covers', 'Safety', 'Seating', 'Trailering and Covers'};

 public Map<String, List<Product2>> availablePartOptions{ get; set;}
.
.
.
List<Product2> boatOptions = [SELECT Id, Name, RecordType.Name, Family,
                                                        (SELECT Id, Name, UnitPrice, Pricebook2Id
                                                          FROM PricebookEntries WHERE Pricebook2Id = :pb2Id),
                                                        (SELECT Id, Standard__c, Maximum__c FROM From_Product_Options__r)
                                                        FROM Product2
                                                        WHERE Id IN :ids];

availablePartOptions = new Map<String,List<Product2>>();
for(String partName : partTypes) {
   availablePartOptions.put( partName, new List<Product2>() );
 }

for(Product2 opt: boatOptions() ) {
  if(opt.RecordType.Name == 'Part'){
    availablePartOptions.get(opt.Family).add(opt);
  }
}

</pre>

Visualforce test:

<pre>

<ul>
    <apex:repeat value="{!availablePartOptions}" var="key">
        <li>
              <apex:outputText value="{!key}" /> -
               <apex:outputText value="{!availablePartOptions[key].size}" />
        </li>
    </apex:repeat>
</ul>

</pre>

This all results in:

Incorrect parameter type for subscript. Expected Number, received Text
Error is in expression '{!availablePartOptions[key].size}' in component <apex:outputText> in page boatbuilder

If I omit the offending line I get a ugly but valid list of keys which is the same as my partTypes List

Accessories -
Electronics -
Fishing -
Fun and Entertainment -
Graphics and Decals -
Pontoon Covers -
Safety -
Seating -
Trailering and Covers -

This is the method every doc I have read said to use when dealing with maps in visualforce.
If anyone has any Ideas it would be a tremendous help


I am writing a nested query in apex code but throwing error as Didn't understand relationship

Select Id,Name,MedConnect__Account_Name__c,(select Unity_Product_Code__c from Impacted_Products__r limit 1 ) from MedConnect__Product_Complaint__c limit 10  
                         
ParentObject- MedConnect__Product_Complaint__c
Child Object-   MedConnect__Impacted_Product__c
                     
Child Relationship Name     - Impacted_Products

could any one please tell me, if the query is wrong

Hi Everyone,

Currently we have a custom email object, that we are trying to migrate away from. I am trying to have the class which contains status updates, and queue re-assignment actions, to only trigger if the case is a certain record type. 

The code used to trigger on (before insert, before update, before delete, after insert, after update, after delete) , however I was running into countless errors with that. 

What I currently have is below, but  it is just not running the class at all. This means it is running my workflow rule actions on every record type, instead of just the one I want on the trigger. 

trigger CompanyEmailMessageTrigger on Company_Email_Message__c (after update, after delete, after undelete)
{
ID rectypeid =
Schema.SObjectType.case.getRecordTypeInfosByName().get('Support_Request_1').getRecordTypeId();


if (rectypeID !='Support_Request_1')

{
    TriggerFactory.createAndExecuteHandler(CompanyEmailMessageTriggerHandler.class);
}
}
Would someone please help me pass that ID from the current object to a controller's @RemoteAction using a detail list button?
I have tried System.currentPageReference().getparameters().get() but that doesn't work within @RemoteAction

The following is my controller, where I need my SELECT statement to filter by the objectID from which the custom detail button is pressed :
global with sharing class googlegantchartscope {  

public String oppList { get; set; }
    
@RemoteAction
global static Cluster__c[] loadrecords() {
    /*String testID = {!$currentpage.parameters.marketID}; 'a0Sc0000003GHNC'; System.currentPageReference().getparameters().get('marketID');*/
    
    return [select Name, Gantt_Chart_Name__c, Design_Completed__c, Estimated_Permit_Approval_Completion__c, Duration__c, Percent_Complete__c, Dependencies__c from Cluster__c where Design_Completed__c!=Null AND Market__c = :needCustomObjectIDFromDetailButtonHere];}
}

Visualforce Page:
<apex:page controller="googlegantchartscope">
<apex:includeScript id="a" value="https://www.google.com/jsapi" />
<apex:sectionHeader title="Google Charts + Javascript Remoting" subtitle="Demo of Cluster Scheduling" />
<div id="chart_div" />
    

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
 <script type="text/javascript">
 <!--loads the visualization in gant chart view-->
 google.charts.load('current', { 'packages': ['gantt']});
 google.charts.setOnLoadCallback(InitCharts);
  
 function InitCharts() {
 <!-- calls the function called 'loadrecords' in googlegantchart controller-->
 googlegantchartscope.loadrecords( 
     
 <!-- following the usual remoting syntax-->
 function(result, event) {
 
 var visualization = new google.visualization.Gantt(document.getElementById('chart_div'));
 <!--adding data to Chart-->
 var data = new google.visualization.DataTable();<!-- variable declaration-->
  
 data.addColumn('string', 'Cluster');
 data.addColumn('string','Cluster and Priority');
 data.addColumn('date', 'Design Completed');
 data.addColumn('date', 'Est Permit Approval Completion');
 data.addColumn('number', 'Duration');
 data.addColumn('number', 'Percent Complete');
 data.addColumn('string', 'Dependencies'); 
 
 for (var i = 0; i < result.length; i++) {
 var r = result[i];
     /*data.addRow([r.Task_Id__c, r.Task_Name__c, new Date(r.Start_Date__c), new Date(r.End_Date__c), r.Duration__c,r.Percent_Complete__c,r.Dependencies__c]);*/
     data.addRow([r.Name, r.Gantt_Chart_Name__c, new Date(r.Design_Completed__c), new Date(r.Estimated_Permit_Approval_Completion__c), r.Duration__c, r.Percent_Complete__c, r.Dependencies__c]);
 }
 var options = {
 height: i*50,
 gantt: {
 criticalPathEnabled:true
 }
 };
 visualization.draw(data, options);<!-- draws a table that contains the result of data-->
 },{escape:true});
 }
 </script>
 
</apex:page>


 
HI All,

I am very confused and stuck at the moment. I have the following Apex code being fired in a trigger:
 
private static void sendMercuryMotorOrderEmail( Set<Id> dealerOrderIds )
  {
    String[] ccAddrs = new List<String>{
      'dealercare@legendboats.com'
    };
    //email template we want to use
    String templateId = Legend_Settings__c.getOrgDefaults().Mercury_Order_Email_Template_Id__c;
    //Static contact we want to email
    Id contactId = Legend_Settings__c.getOrgDefaults().Mercury_Contact_Id__c;
    List<Messaging.SingleEmailMessage> msgList= new List<Messaging.SingleEmailMessage>();
    for( Id doId : dealerOrderIds )
    {
      Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
      mail.setTargetObjectId(contactId);
      mail.setWhatId( doId );
      mail.setTemplateId( templateId );
      mail.setCcAddresses( ccAddrs );
      mail.setSaveAsActivity(true);
      msgList.add(mail);
    }
    Messaging.sendEmail(msgList);
  }

In my sandbox environment ( which was refreshed from production very recently and none of this code has changed ) the email is sent as expected and the Email shows up in the Activity History on the record details page in Lightning.  In production the email is sent correctly but the nothing ever shows in the Activity History.  Furthor more ( probably the reason for no Activity History ) in Production no record in the Email Message table is being created, but in Sandbox there is.

I have check all permissions and settings in Production I can think of ( yes Track Activities is enabled on the object ).  Is there anything I am possibly missing?  My users really want this to show on the activity timeline and I am just completely confused.

Thanks a alot for any assistance.
I am using e.force:createRecord to create Task. When the Task window opens I do nothing - just close it using X on the top right corner of the modal. But still it creates a Task. Any way to rectrict that

lightning:button class="form-control" aura:id="btnTask" label="Create Task" onclick="{!c.createTask}"/>
createTask : function (component, event, helper) {   
    var task= $A.get("e.force:createRecord");
    task.setParams({
        "entityApiName": "Task",
        "defaultFieldValues": {
            'Subject' :' Test Task' 
       }
            });
           createRecordEvent.fire();
}
trigger Opportunity_task on Opportunity (after update) {
    list<task> tasks=new list<task>();
     for(Opportunity o:trigger.new){
         if(o.name!=null && o.name!=trigger.newmap.get(o.Id).name){
             task t=new task();  
             t.Subject='call';
             t.Priority='high';  
            // t.What='opportunity';
            tasks.add(t);             
         }
            }
    insert tasks;
}
Hi guys,

Is there a way to pass an unknown number of parameters (variable "args" below) to JavaScript Remoting like:
 
function remoting(target, ...args) {
    Visualforce.remoting.Manager.invokeAction(
        configSettings.remoteActions[target],
        args,
        function (result, event) {
            if (event.status)
                console.log(result);
        },
        { escape: false }
    );
}

Thanks!
 
I am experience an odd error since Summer 17 with a Path we where using on a Custom Object from a managed package.  We are using AccountingSeed financial package and I created a Path in Lightning Experience on the AcctSeed__Project__c object.  As you would expect this object is namespaced by 'AcctSeed'.  We have added our own custome field called Stage, which since we added it outside the package, contains no namespace leaving the API field name "Stage__c".  This all worked in Spring 17, but with the update to Summer 17, the path now throws and error stating "AcctSeed__Stage__c is not a valid field", which ofcourse it is not. Has anyone ran into this issue, where the package namespace is being appended to a field when it should not be?
Thanks for the help.
User-added image
We are trying to move to Lightning Experience and I have ran into an odd situation.  I have added a custom visualforce action and set the height to 500px.  The action was added to the page layout and is showing up correctly in lightning experience.  The problem is when the user clicks the button the modal box is displayed and the conent area in side the box is 500px high, but the actual content is only 186px height as seen here:

User-added image

If I change the height value declared in the custom action, the height of the model box changes, but the height of the displayed content does not.
Looking into the chrome dev tools inspector there are the following elements that are involved.
 
<div class="modal-body scrollable" style="height: 500px; max-height: 500px;">
This is apparently where the height gets set based on the height setting in custom action definition.
Then we have the following markup:
 
<div class="forceChatterBasePublisher--default forceChatterBasePublisher forceChatterAlohaPagePost">

    <div class="forceChatterPublisherPresentationPanel">
        
        <div class="container activeState">

            <div class="cuf-content">

               ....................
    
            </div>

        </div>

    </div>

</div>

If i manually add "height: 100%;" to these 4 elements in the inspector the content is displayed properly.

If anyone has any idea how to fix this, it would be greatly appreciated.  Thanks
 
User-added image
Hi I am new to salesforce platform. I am trying to do some new things in Lightning express. I have solved few of the trailheads. I know how to add custom tabs to salesforce1 navigation menu. I just want to know can I add more tabs next to Related and Details tab as shown in the figure. New tab I have highlighted using Red Circle.
Hi,

Lightening Experience (Spring 16' release) will release the feature to customize the left hand menu with custom objects.
In my package i've created a Visualforce tab and I would like to include the tab automatically on the new lightning experienxe left hand nav menu on package installation.

Do you know if there is a way to do it or each user has to manually include the tab in his own left hand nav?
I have some code which has been working for almost a year which has suddenly stoped working. It involves creating a Map<String, Wrapper> called selectedItems in the apex controller, using apex:repeat to iterate over the object in visualforce. There is a check box which when check or unchecked fires actionFunction to to the apex controller to either remove or add the item to the selectedItems Map and then rerenders the apex:outputPanel where the selectedItems is displayed.  The following is something i threw together to duplicate the problem as the actual code is much more involved and this is the problem I am facing.

Apex Controller
public with sharing class TestMapError {

  public Map<Id, Product2> prodMap { get; set; }
  public Map<Id, Product2> selectedMap { get; set; }

	public TestMapError() {
    prodMap = new Map<Id, Product2>([SELECT Id, Name FROM Product2 WHERE isActive = true LIMIT 5]);
    selectedMap = new Map<Id, Product2>();
	}

  public void toggleSelect()
  {
    String pId = Apexpages.currentPage().getParameters().get('pId');
    if( selectedMap.containsKey(pId) )
    {
      selectedMap.remove(pId);
    }
    else
    {
      selectedMap.put(pId, prodMap.get(pId) );
    }
  }

}

Visualforce Page
 
<apex:page showHeader="true" sidebar="true" controller="TestMapError">
  <apex:includeScript value="{!URLFOR($Resource.jQuery)}"/>

  <apex:form>

    <apex:actionFunction name="toggleSelected"
                         action="{!toggleSelect}"
                         rerender="selectedList">
      <apex:param name="pId" value="" />
    </apex:actionFunction>

    <apex:outputPanel id="theList">
      <ul>
        <apex:repeat value="{!prodMap}" var="prodId">
          <li>
            {!prodMap[prodId].Name}
            <input type="checkbox" data-pid="{!prodId}" onChange="toggleCheck(this);"/>
          </li>
        </apex:repeat>
      </ul>
    </apex:outputPanel>

  </apex:form>
  <br />

  <apex:outputPanel id="selectedList">
    <h3>Selected</h3>
     <ul>
      <apex:repeat value="{!selectedMap}" var="sId">
        <li>{!selectedMap[sId].Name}</li>
      </apex:repeat>
    </ul>
  </apex:outputPanel>

  <script type="text/javascript">

  var $j = jQuery.noConflict();


    function toggleCheck(ele)
    {
      console.log( $j(ele).data('pid'));
      toggleSelected( $j(ele).data('pid') );
    }

  </script>

</apex:page>

When the check box is selected, the first Item is not rendered in the selected list, but if you select a second item the first shows up.  If you check the view state, both items are present in the selectedMap.  Then if you uncheck any of the checked boxes you get a visualforce error of Map key not found in Map.

This used to work up until very recently and I did recieve an email from Salesforce stating they are upgrading to JDK 8.  Is it possible this is the underlying problem? Any help on this would be greatly appreciated
Hey All

I have been trying this all day and have searched to the best of my abilities but I can not find an answer or figure it out.  I am trting to create a PDF using getContentasPDF().  The method works fine standalone, but does not work when invoked from the Process Builder.  I know getContentAsPDF() is unavailable for future methods and triggers and was hoping the new Lightning Process Builder would handle it.

Does anyone know if it does? If so do you have any links to help me out?

Thanks to everyone.
This is a bit of breif bit of code:

controller:
<pre>

public List<String> partTypes = new List<String>{'Accessories', 'Electronics', 'Fishing', 'Fun and Entertainment', 'Graphics and Decals', 'Pontoon Covers', 'Safety', 'Seating', 'Trailering and Covers'};

 public Map<String, List<Product2>> availablePartOptions{ get; set;}
.
.
.
List<Product2> boatOptions = [SELECT Id, Name, RecordType.Name, Family,
                                                        (SELECT Id, Name, UnitPrice, Pricebook2Id
                                                          FROM PricebookEntries WHERE Pricebook2Id = :pb2Id),
                                                        (SELECT Id, Standard__c, Maximum__c FROM From_Product_Options__r)
                                                        FROM Product2
                                                        WHERE Id IN :ids];

availablePartOptions = new Map<String,List<Product2>>();
for(String partName : partTypes) {
   availablePartOptions.put( partName, new List<Product2>() );
 }

for(Product2 opt: boatOptions() ) {
  if(opt.RecordType.Name == 'Part'){
    availablePartOptions.get(opt.Family).add(opt);
  }
}

</pre>

Visualforce test:

<pre>

<ul>
    <apex:repeat value="{!availablePartOptions}" var="key">
        <li>
              <apex:outputText value="{!key}" /> -
               <apex:outputText value="{!availablePartOptions[key].size}" />
        </li>
    </apex:repeat>
</ul>

</pre>

This all results in:

Incorrect parameter type for subscript. Expected Number, received Text
Error is in expression '{!availablePartOptions[key].size}' in component <apex:outputText> in page boatbuilder

If I omit the offending line I get a ugly but valid list of keys which is the same as my partTypes List

Accessories -
Electronics -
Fishing -
Fun and Entertainment -
Graphics and Decals -
Pontoon Covers -
Safety -
Seating -
Trailering and Covers -

This is the method every doc I have read said to use when dealing with maps in visualforce.
If anyone has any Ideas it would be a tremendous help


I am currently trying to have a PDF created based on a field update.

The issue is that it seems that getContent() and getContentAsPDF() don't work when called within a trigger. 

 

Does anyone know a work around for this or is this something that I won't be able to accomplish.\

 

Thanks

  • August 10, 2012
  • Like
  • 0