• Flint Lockwood
  • NEWBIE
  • 135 Points
  • Member since 2013

  • Chatter
    Feed
  • 3
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 34
    Replies
Hi, 

I have created a controller that would query some information from a custom child object so I can use it from its parent object. These two objects have a master-detail relationship.  

Parent/master object: Media_Plan__c
Child/detailed object: Media_Deliverable__c

I need to have a visualforce page that renders as PDF in Media_Plan__c layout. This page would get triggered with a button on the layout, this pdf page would get some information from Media_Plan__c and from its child object Media_Deliverable__c. I need some help with this page, how can I apply my controller to achieve this? I was thinking of using apex:repeat, but not sure how to apply this.   

The following is my controller -
 
public with sharing class Abc {
    public List<Media_Deliverable__c > childLs{get;set;}
    
    public Abc(ApexPages.StandardController controller) {
        
      	childLs= new List<Media_Deliverable__c >();
        id parId = ApexPages.currentPage().getParameters().get('id');

      	childLs = [select id, Deliverable_Name__c, Product__c, Product_copy__c, 
		Quantity__c, Rate__c, True_Total_Value__c, Value__c, Value_Add__c,
		Value_add_price__c from Media_Deliverable__c where Media_Plan__c = :parId ];
    }
}
  • December 20, 2016
  • Like
  • 0

 

this query returns the sum of all the tasks on Sales_Resources__c object...but i want to get the sum of closed tasks of particular record...

if object has 5 records and record 1 contain 2 closed tasks..then i want to get the sum of only those two tasks...

\but this query returning the sum of all the tasks of this object's records...

can sm1 help...

 

aggregateResult[] results  = [Select SUM(Minutes_on_tasks__c)summ From Task WHERE status = 'Completed' AND Minutes_on_tasks__c != null AND whatid IN (SELECT Id FROM Sales_Resources__c)];

Does anyone know if you can pass a list variable between components using the navigatetoComponent function? I tried passing a list of strings, but was unable to do so.
I am using Lightning:Datatable to display a list of records. I specified "maxRowSelection=1", so the table is display radio buttons instead of checkboxes. I am also using the sort function detailed in the documentation. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_datatable.htm.

If I select a record then sort, the radio buttons are greyed out and I cannot change my selection.
If I sort before I select a record, everything works.

Any idea whats going on here?
Anyone have a good way to query the UserServicePresence object? This object creates multiple records per agent per day. I only need to query the most recent record. 
I created a wrapper class that implements the Comparable interface. However, when I sort the list of wrapper, the list is still sorting by the name
 
public with sharing class SampleSort implements Comparable{
	
	private Goal__c goalRecord;

	public CaseSLAWrapperClass(Goals__c s) {
              goalRecord = s;
	}

	public Integer compareTo(Object compareTo)
	{
		SampleSort compareToGoal = (SampleSort)compareTo;

		if(goalRecord.Display_Order__c < compareToGoal.goalRecord.Display_Order__c)
			return 1;
		else if (goalRecord.Display_Order__c < compareToGoal.goalRecord.Display_Order__c)
			return -1;
		else
			return 0;
	}
}

 
On my Visualforce page (which is displayed in Service Console), I created a JS function using the Service Cloud toolkit. This function opens a primary tab with a list view. I added "isdtp=nv" as part of the URL. However, when the tab loads, the URL is changed to "isdtp=vw". This affects the way that the list view looks. Any idea what's causing this? Thank you!
Is it possible to update the Case Owner to a queue using the Process Builder? I keep getting the following error:
User-added image
I don't see the following options for some of my users. Does anyone know where I can enable the following settings?

User-added image
Is there a way to redirect to a Lighting Component from a Visualforce Page and pass in attribute values?
I have an iframe embedded within a Lightning page. Whenever the page loads, instead of loading the iframe, the page is redirected to the iframe URL instead. Does anyone know what's happening here?
I have a Lightning page that displays a list of Opportunity by stage for a given Account. Users can select an Opportunity on the page. However, the radio button that gets selected never sticks (i.e. the selected Opportunity once the user navigates to another tab). Not sure why this is happening. 
<aura:iteration items="{!v.stagename}" var="stage">
<lightning:tabset>
<lightning:tab label="{!stage}">
<aura:iteration items="{!opportunityList}" var="oppty">
<ui:inputRadio name="selectOppty"/>
<ui:outputText value="{!oppty.Name}"/>
</aura:iteration>
</lighting:tab>
</lightning:tabset>
</aura:iteration>
Please note that the above code is abbreviated. 


 
Aside from the "Today" page, where else can I access global actions?
Is there a way for one component to reference the functions in another without embedding?

If I have to embed the component, how do I reference there parent function from a  child component and vice versa?
I am passing the return value from one function in another function in Lightning (sample below). However, the return value from the first function is always undefined. 
 
myfunction1: function(component)
{
      //call an Apex method
     //return result of apex method
}

myfunction2: function(component)
{
     var result = this.myfunction1(component);
     console.log(result) //RESULT IS ALWAYS UNDEFINED
}

 
I am using the spinner from Salesforce Lightning Design System. The spinner displays on inital page load. However, the spinner never disappears. I am using the aura:waiting and aura:doneWaiting event to call the following controllor logic respectively.
showSpinner : function (component, event, helper) {
       var spinner = component.find('spinner');        
       $A.util.toggleClass(spinner, "toggle") ;  
    },
    
    hideSpinner : function (component, event, helper) {
       var spinner = component.find('spinner');
        $A.util.toggleClass(spinner, "toggle")   
    },
Please let me know what I am doing wrong. 
 
What is the correct syntax for the AND operator using the <aura:renderIf> tag? I tried <aura:renderIf isTrue="{!AND(condition1, condition2)}", but got a compile error. I also tried "AND(condition1, condition2)". No compile error, but it didn't function correctly. 
How do I highlight a input field whose value was changed in Lightning (note: I am using the <aura:iteration> tag). Using the sample code below, I want to highlight the field using CSS style (box-shadow: 0 0 10px #ff6600;) whenever the Opportunity name is updated.
<aura:iteration items="{!v.opportunityList}" var="oppty">
            <ui:inputText value="{!oppty.Name}"/>
</aura:iteration>

 
I added two buttons "Enable Partner User" and "View Partner User" on the Contact page layout. However, these buttons are not showing on the Contact page in Lightning. Are these button not supported in Salefsorce Lightning?

User-added image
Hi, 

I am trying to do something to what we are able to to in Visualforce. In Visualforce, can use this syntax Map[key] to retrieve values from a map. However, I am unable to get the syntax correct in Salesforce Lightning. Anyone know the correct syntax for getting values from a map?
Hi, 

Has anyone use the QuickAction.DescribeLayoutSection class? If so, how do I use this class? I understand what the class represents. However, I do not know how to call it. I have try QuickAction.DescribeLayoutSection and QuickAction.CreateAccount.DescribeLayoutSection where "CreateAccount" is the name of my quick action. Both gave the an error: "Invalid quick action:describelayoutsection"

Thanks!

 

Hi, 

 

I am trying to update an Account's name using the StandardController save method. For some reason the update is not happening. Here is my code: 

 

public with sharing class UpdateAccountClass{

	public ApexPages.StandardController s;
	public Account a {get; Set;}
	
	public UpdateAccountClass(ApexPages.StandardController stdCon){
		s = stdCon;
		a = (Account)stdCon.getRecord();
		a = [select id, Name from Account where Id =: a.Id];
	}
	
	public PageReference SaveRecord(){
		a.Name = 'Testing Testing';
		PageReference p = null;
		try{	
			p = s.save();
		}catch(Exception e){
			system.debug(e.getMessage());
		}
		return p;
	}
}

 

Thank you in advance. 

Is there a way for one component to reference the functions in another without embedding?

If I have to embed the component, how do I reference there parent function from a  child component and vice versa?
I am using the spinner from Salesforce Lightning Design System. The spinner displays on inital page load. However, the spinner never disappears. I am using the aura:waiting and aura:doneWaiting event to call the following controllor logic respectively.
showSpinner : function (component, event, helper) {
       var spinner = component.find('spinner');        
       $A.util.toggleClass(spinner, "toggle") ;  
    },
    
    hideSpinner : function (component, event, helper) {
       var spinner = component.find('spinner');
        $A.util.toggleClass(spinner, "toggle")   
    },
Please let me know what I am doing wrong. 
 
Hi Everyone

how we can redirect to edit page  after double click on field in page. 

Thanks in advance
Anyone have a good way to query the UserServicePresence object? This object creates multiple records per agent per day. I only need to query the most recent record. 
I have several Related Lists which are on the Page Layout for Account.  I would like to programatically add an additional Related List to the Page Layout for Account through Apex alone.  Is that possible?
 
I don't see the following options for some of my users. Does anyone know where I can enable the following settings?

User-added image
I have an iframe embedded within a Lightning page. Whenever the page loads, instead of loading the iframe, the page is redirected to the iframe URL instead. Does anyone know what's happening here?

Hello Everyone,

I have this VF page that can add new rows of fields and delete a row of fields
User-added image

My problem is when I delete the first record or the top most record and then delete the second record it deletes the last row of records. After I deleted the first record it deletes the wrong rows of fields and then when I delete the first record then click the 'Add Skill' button it displays the wrong information in the row. Please Help me out. Thank you very much. My code is down below.

My VF page:

<apex:page standardController="Employee_Skills__c" extensions="AddContacts1" sidebar="false">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <apex:form >
    <apex:pageBlock title="Skill" id="pb">
      <apex:pageMessages />      
      <apex:variable var="rowNumber" value="{!0}"/>
        <apex:pageBlockTable id="thetable" title="Employee_Skills__c" var="empski" value="{!empskilist}">
          <apex:column headerValue="No." style="width:20px; text-align:center;" headerClass="centertext">
            <apex:outputText value="{0}" style="text-align:center;">
              <apex:param value="{!rowNumber+1}" />
            </apex:outputText>
          </apex:column>
          <apex:column headerValue="Skill Name" >
            <apex:inputField value="{!empski.Skill_ID__c}"/>
          </apex:column>
          <apex:column headerValue="Proficiency" >
            <apex:inputField value="{!empski.Proficiency__c}"/>
          </apex:column>
          <apex:column headerValue="Skill Type" >
            <apex:inputField value="{!empski.Skill_Type__c}"/>
          </apex:column>
          <apex:column headerValue="Years of Expirience" >
            <apex:inputField value="{!empski.Year_of_Experience__c }"/>
          </apex:column>
          <apex:column headerValue="Action" >
            <apex:commandButton value="Delete" action="{!deleteRow}" reRender="pb" immediate="true">
              <apex:param name="rowIndex" value="{!rowNumber}"/>
            </apex:commandButton>
            <apex:variable var="rowNumber" value="{!rowNumber+1}"/>
          </apex:column>
        </apex:pageBlockTable>
           <div align="center" style="margin-top:10px;">  
              <apex:commandButton action="{!addRow}" value="Add Skill" reRender="pb" immediate="true" />   
           </div>
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}" />
        <apex:commandButton value="Cancel" action="{!cancel}"/>
      </apex:pageBlockButtons>           
    </apex:pageBlock>
  </apex:form>
</apex:page>


My Controller:

 

public class AddContacts1 {
        public Employee_Skills__c empskill;
        public Employee_Skills__c del;
        public List < Employee_Skills__c > addEmpSkiList {get;set;}
        public List < Employee_Skills__c > delEmpSkiList {get;set;}
        public List < Employee_Skills__c > empskilist{get;set;}
        public Integer totalCount {get;set;}
        public Integer rowIndex {get;set;}
        public List < Employee_Skills__c > delEmpSki {get;set;}

        public AddContacts1(ApexPages.StandardController controller) {
                empskill= (Employee_Skills__c) controller.getRecord();
                empskilist= [SELECT Id,Skill_ID__r.Name,Employee_ID__c,Name,Proficiency__c,Skill_Type__c,Year_of_Experience__c FROM Employee_Skills__c WHERE Employee_ID__c =: empskill.Employee_ID__c];
                totalCount = empskilist.size();
                delEmpSkiList = new List < Employee_Skills__c > ();
                delEmpSki = new List < Employee_Skills__c > ();
        }

        public void addRow() {
                addEmpSkiList = new List < Employee_Skills__c > ();
                empskilist.add(new Employee_Skills__c (Id = empskill.Id,Employee_ID__c = empskill.Employee_ID__c));
        }

        public PageReference save() {
                upsert empskilist;
                delete delEmpSkiList ;
                
              return null;
        }
        public void deleteRow() {
                rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
                del = empskilist.remove(rowIndex);
                
               // if(del.Id != NULL)
               // {
                    delEmpSkiList.add(del);
              //  }
                  
        }
}

Thank you very much.
public class ZilliantRequestControllerExtn {
    private final Quote__c quot;
    public String worksheetLines {get;set;}
    public String worksheetLine {get;set;}
    public String ln_nbr {get;set;}
    public String bom_nbr {get;set;}
    public String fix_snp_ind {get;set;}
    public Boolean fix_mult{get; set;}
    public Decimal rqstd_ext_snp {get;set;}
    public Decimal qty {get;set;}
    public Decimal tot_var_cost {get; set;}
    public Decimal tot_cost {get; set;}
    public String ext_auth_eqp_snp {get; set;}
    public String ext_estm_mkt_prc {get; set;}
    public Decimal ext_list_prc {get; set;}
    public Decimal ext_norm_net_prc_d {get; set;}
    public String ext_norm_net_prc {get; set;}
    public Decimal ext_prfl_net_prc_d {get; set;}
    public String ext_prfl_net_prc {get; set;}
    public String norm_net_attnmnt {get; set;}
    public Decimal sell_net_mult {get; set;}
    public String catlg_categ_desc {get; set;}
    public String categ_id {get; set;}
    public String categ_desc {get; set;}
    public String co_rev_nbr {get; set;}
    public String deal_id {get; set;}
    public String commit_shp_dt_val {get; set;}
    
    public String orig_norm_net_prc {get; set;}
    public String curr_norm_net_prc {get; set;}
        
    Decimal orig_norm_net_prc_d = 0.0;    
    /** 
    * Class constructor.
    */
    public ZilliantRequestControllerExtn (ApexPages.StandardController stdController) {
        this.quot = (Quote__c)stdController.getRecord();
        Id quotid = quot.Id; 
        List<Quote_Line_Items__c> ExistingItems = [select id, Recommended_Fix__c, Unit_List_Price__c,Normal_Net_Multiplier__c,Line_Item_Number__c,Requested_Extended_Selling_Net_price__c,Quantity__c,Tot_Var_Cost__c,Total_Cost__c,Extended_list_Price__c,Normal_Net_Extended_Price__c,Ext_Prfl_Net_Prc__c,Authorize_Unit_Selling_Net_Price__c,Product_Code__c,Product_Name__r.Name,Price_Determined_Category_Number__c,Categ_Desc__c, QL_Item_No_Formula__c from Quote_Line_Items__c where Quote_Name__r.id =: quotid];
        worksheetLines = '';
        for(Quote_Line_Items__c existing : ExistingItems){
            
            if(existing.Unit_List_Price__c!=NULL && existing.Normal_Net_Multiplier__c!=null && existing.Quantity__c!=NULL){
                orig_norm_net_prc_d = orig_norm_net_prc_d + (existing.Unit_List_Price__c*existing.Normal_Net_Multiplier__c*existing.Quantity__c);
                ext_norm_net_prc_d = existing.Unit_List_Price__c*existing.Normal_Net_Multiplier__c*existing.Quantity__c;
                ext_prfl_net_prc_d = existing.Unit_List_Price__c*existing.Normal_Net_Multiplier__c*existing.Quantity__c;
            }

            worksheetLine = '';
                
            ln_nbr = existing.QL_Item_No_Formula__c;
            worksheetLine = '\"'+ln_nbr+'\"';
            
            bom_nbr = '0';
            worksheetLine = worksheetLine + ','+'\"'+bom_nbr+'\"';
            
            fix_snp_ind = '';
            worksheetLine = worksheetLine + ','+'\"'+fix_snp_ind+'\"';
            
            fix_mult = existing.Recommended_Fix__c;
            worksheetLine = worksheetLine + ','+'\"'+fix_mult+'\"';
            
            rqstd_ext_snp = existing.Requested_Extended_Selling_Net_price__c;
            worksheetLine = worksheetLine + ','+'\"'+String.valueOf(rqstd_ext_snp)+'\"';
            
            qty = existing.Quantity__c;
            worksheetLine = worksheetLine + ','+'\"'+String.valueOf(qty)+'\"';
            
            tot_var_cost = existing.Tot_Var_Cost__c;
            worksheetLine = worksheetLine + ','+'\"'+String.valueOf(tot_var_cost)+'\"';
            
            tot_cost = existing.Total_Cost__c;
            worksheetLine = worksheetLine + ','+'\"'+String.valueOf(tot_cost)+'\"';
            
            ext_auth_eqp_snp = '';
            worksheetLine = worksheetLine + ','+'\"'+ext_auth_eqp_snp+'\"';
            
            ext_estm_mkt_prc = '';
            worksheetLine = worksheetLine + ','+'\"'+ext_estm_mkt_prc+'\"';
            
            ext_list_prc = existing.Extended_list_Price__c;
            worksheetLine = worksheetLine + ','+'\"'+String.valueOf(ext_list_prc)+'\"';
            
            if(ext_norm_net_prc_d>0.0){
                ext_norm_net_prc_d = ext_norm_net_prc_d.setScale(2);
                ext_norm_net_prc = '\"'+String.valueOf(ext_norm_net_prc_d)+'\"';
            }else{
                ext_norm_net_prc = '\"'+'\"';
            }            
            worksheetLine = worksheetLine + ','+ext_norm_net_prc;
            
            if(ext_prfl_net_prc_d>0.0){
                ext_prfl_net_prc_d = ext_prfl_net_prc_d.setScale(2);
                ext_prfl_net_prc = '\"'+String.valueOf(ext_prfl_net_prc_d)+'\"';
            }else{
                ext_prfl_net_prc = '\"'+'\"';
            }
            worksheetLine = worksheetLine + ','+ext_prfl_net_prc;
            
            norm_net_attnmnt = '';
            worksheetLine = worksheetLine + ','+'\"'+norm_net_attnmnt+'\"';
            
            sell_net_mult = 0;
/*
            sell_net_mult = existing.Authorize_Unit_Selling_Net_Price__c;
            if(sell_net_mult>0.0){
                sell_net_mult = sell_net_mult.setScale(2);
           }            
*/
            worksheetLine = worksheetLine + ','+'\"'+String.valueOf(sell_net_mult)+'\"';
            
            catlg_categ_desc = existing.Product_Name__r.Name;
            worksheetLine = worksheetLine + ','+'\"'+catlg_categ_desc+'\"';
            
            categ_id = existing.Price_Determined_Category_Number__c;
            worksheetLine = worksheetLine + ','+'\"'+categ_id+'\"';
            
            categ_desc = existing.Categ_Desc__c;
            worksheetLine = worksheetLine + ','+'\"'+categ_desc+'\"';
            
            co_rev_nbr = '0';
            worksheetLine = worksheetLine + ','+'\"'+co_rev_nbr+'\"';
            
            deal_id = '';
            worksheetLine = worksheetLine + ','+'\"'+deal_id+'\"';
            
            commit_shp_dt_val = '1';
            worksheetLine = worksheetLine + ','+'\"'+commit_shp_dt_val+'\"';
            
            worksheetLine = '['+worksheetLine+']';
            worksheetLines = worksheetLines + ','+ worksheetLine;
        } 
        if(orig_norm_net_prc_d>0.0){
            orig_norm_net_prc_d = orig_norm_net_prc_d.setScale(2);
            orig_norm_net_prc = '\"'+String.valueOf(orig_norm_net_prc_d)+'\"';
            curr_norm_net_prc = orig_norm_net_prc;
        }else{
            orig_norm_net_prc = '\"'+'\"';
            curr_norm_net_prc = '\"'+'\"';
        }
        worksheetLines = worksheetLines.substring(1,worksheetLines.length());
        worksheetLines = worksheetLines.replace('null',''); 
    }
}
Aside from the "Today" page, where else can I access global actions?
Hi, 

I have created a controller that would query some information from a custom child object so I can use it from its parent object. These two objects have a master-detail relationship.  

Parent/master object: Media_Plan__c
Child/detailed object: Media_Deliverable__c

I need to have a visualforce page that renders as PDF in Media_Plan__c layout. This page would get triggered with a button on the layout, this pdf page would get some information from Media_Plan__c and from its child object Media_Deliverable__c. I need some help with this page, how can I apply my controller to achieve this? I was thinking of using apex:repeat, but not sure how to apply this.   

The following is my controller -
 
public with sharing class Abc {
    public List<Media_Deliverable__c > childLs{get;set;}
    
    public Abc(ApexPages.StandardController controller) {
        
      	childLs= new List<Media_Deliverable__c >();
        id parId = ApexPages.currentPage().getParameters().get('id');

      	childLs = [select id, Deliverable_Name__c, Product__c, Product_copy__c, 
		Quantity__c, Rate__c, True_Total_Value__c, Value__c, Value_Add__c,
		Value_add_price__c from Media_Deliverable__c where Media_Plan__c = :parId ];
    }
}
  • December 20, 2016
  • Like
  • 0
Is there a way for one component to reference the functions in another without embedding?

If I have to embed the component, how do I reference there parent function from a  child component and vice versa?
I am passing the return value from one function in another function in Lightning (sample below). However, the return value from the first function is always undefined. 
 
myfunction1: function(component)
{
      //call an Apex method
     //return result of apex method
}

myfunction2: function(component)
{
     var result = this.myfunction1(component);
     console.log(result) //RESULT IS ALWAYS UNDEFINED
}

 
I am using the spinner from Salesforce Lightning Design System. The spinner displays on inital page load. However, the spinner never disappears. I am using the aura:waiting and aura:doneWaiting event to call the following controllor logic respectively.
showSpinner : function (component, event, helper) {
       var spinner = component.find('spinner');        
       $A.util.toggleClass(spinner, "toggle") ;  
    },
    
    hideSpinner : function (component, event, helper) {
       var spinner = component.find('spinner');
        $A.util.toggleClass(spinner, "toggle")   
    },
Please let me know what I am doing wrong. 
 
How do I highlight a input field whose value was changed in Lightning (note: I am using the <aura:iteration> tag). Using the sample code below, I want to highlight the field using CSS style (box-shadow: 0 0 10px #ff6600;) whenever the Opportunity name is updated.
<aura:iteration items="{!v.opportunityList}" var="oppty">
            <ui:inputText value="{!oppty.Name}"/>
</aura:iteration>