• Alain Cabon
  • ALL STAR
  • 8427 Points
  • Member since 2016

  • Chatter
    Feed
  • 275
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1699
    Replies
Hello. This is a really newbie question but I haven't done coding in a while and got stuck. The Visualforce Basics trailhead says to Open your browser’s JavaScript console and enter the following code for format your Visualforce page with Lightning.

$A.get("e.force:navigateToURL").setParams(
    {"url": "/apex/pageName"}).fire();

I know how to get to the Chrome DevTools, but how do you run Javascript inside it?
Hey experts, 

hopefully, somebody will unterstand what i want to do. I am looking for way to divide the business day in different time slots.  For each task record, i want to cluster the created date timestamp in one category.  

For example: 
hh:mm:ss to
08:00:00 to 08:15:00 = part 1
08:15:01 to 08:30:00 = part 2
08:30:01 to 08:45:00 = part 2
08:45:01 to 09:00:00 = part 4
...
17:45:01 to 18:00:00 = part 40

Why ?  iI just want to see the productivity development of each sales agent in 15 min ( or 30 min) steps and compare each other. Then, i want to create a real time dashboard which is moving forward over the day.

My first thought was,  to create three fields:

The first one, catches the time of the createdDate field:
The second one, transform the value of the first field to a number. ( 08:30:00 == 83000)
The third one, is an if statment to check, in which timeslot the number field falls. 

Firstly, this solution is not really nice and secondly it doesn't work, because the if statment exceed the character limit.  Of course i can split the if statment in many fields but this would be the worst solution  ^^  Any suggestion for this ? 

Thanks for your effort guys. 
 
Greetings Marry
 

Hello: The posted solution does not seem to be calculating correctly for me.

Below is my field formula to try to get the # of days overdue less the weekends. As you can see by the results, I have 3 issues
(1) only calculating 1 day for the weekend (ex: ex: Due Date = 9/19/18 and Date Sent = 9/27; one wekend involved and should be 6 days overdue but showing 7 days)
(2) adding an additional day when no weekend is involved (ex: Due Date = 9/19/18 and Date Sent = 9/21; this is no weekend involved and should be 2 days overdue but showing 3)
(3) miscaluclating when not overdue (Ex: Due Date = 9/18/18 and Date Sent = 9/17/18); no weekend involved and should be -1

Calculation ResultsUser-added image

Any advice would be greatly appreciated.

Thanks,

Tracey
 

Hi all! 

I am trying to replicate the excel Days360 function which returns the number of days between 2 dates, based on a 360-day year (12 x 30 months).

Does anyone know how to accomplish this?
Hey guys,

i am not familar with javascript, but i really like how the chart.js libary looks. To get started i want to create some cool Salesforce Dashboards with chart.js. I have already create a visualforce Page to show a simple bar chart. Now, i am looking for a way to get the controller variable to the javascript function : 
http://www.chartjs.org/docs/latest/

This is the javascript Code: 
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
    type: 'bar',
    data: {
        labels: ["M1", "M2", "M3", "M4", "M5", "M6"],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3],   
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)',
                'rgba(153, 102, 255, 0.2)',
                'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [
                'rgba(255,99,132,1)',
                'rgba(54, 162, 235, 1)',
                'rgba(255, 206, 86, 1)',
                'rgba(75, 192, 192, 1)',
                'rgba(153, 102, 255, 1)',
                'rgba(255, 159, 64, 1)'
            ],
            borderWidth: 1
        }]
    },
    options: {
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero:true
                }
            }]
        }
    }
});
</script>
How can i change the label and dataset with controller variables ? My idea is to create a simple list and transform the list to string. Does this work ? 

Thanks for help guys. I cant find any help for chart.js and visualforce...

Greetings,

Marry





 
[  
   {  
      "Id":"a0F7F000006lv7OUAQ",
      "Name":"Lightning Arrester(ESE Type (50 m -3 Nos , 65m - 3 Nos , 100 m - 6 Nos , 107 m -",
      "Price__c":2998,
      "Stage__c":"Civil Works",
      "Quantity__c":"43"
   },
   {  
      "Id":"a0F7F000006lv7EUAQ",
      "Name":"Safety Lifelines",
      "Price__c":20,
      "Stage__c":"Civil Works",
      "Quantity__c":"45"
   }
]

i have records of custom object with apiname productRenew__c in json string formate and i want to convert this json to corresponding object so that i can save the records to the db

Please Help
Thanks in advance
  • September 08, 2018
  • Like
  • 0
I keep getting this error message: Error: Compile Error: Expecting ')' but was: 'Red' at line 5 column 16, when I run the following Apex Class: 
public class Test {

Map<String, String> colorCodes = new Map<String, String>();

colorCodes.put('Red', 'FF0000');
colorCodes.put('Blue', '0000A0');

String myColor = colorCodes.remove('Blue');
String code2 = colorCodes.get('Blue');

System.assertEquals(null, code2);

}
What am I missing here?

 
I recently Used this in my Apex Class and I ran into a weird problem.

From my lightning controller I send the following data as a string format using JSON.Stringify
{ 
 item: "4",
 change:  "40",
 limit: "400"
}

On my apex Class controller I used JSON.deserializeUntyped() to map it to an object
Map<String, Object> listJson = (Map<String, Object>) JSON.deserializeUntyped(stringList);

I wasnt working at all Until I wrapped the data coming from the lightning controller in an object so when I did the following then the JSON.deserializeUntyped() worked perfectly. 
 
{
 data:  { 
  item: "4",
  change:  "40",
  limit: "400"
 }
}

Can someone explain why this is necessary. Or is there a solution that better

 
Can anyone recommend videos/articles/best practices for cleaning up old code in an org?

I inherited a messy org - 10 yrs old, 20+ triggers per object, hundreds of workflows/declarative items, and we are constantly hitting governor limits. Our code coverage is also below 75% now preventing us from deploying anything new...

My management team has granted us a 4 month new code/new project freeze to get this fixed and I don't want to waste it. 
Hello, a user clicked the standard related contacts quick link and kept scrolling to see more than the first 50 and then instead of loading, there was the error. One account has 57 contacts and another account has 64 contacts. The error is not happening every time. 

Error is: 
ui.services.connection.api.PartnerConnectionException: INVALID_QUERY_LOCATOR: invalid query locator

I went to Salesforce Support and after I asked some questions (1) What is the contact default batch size? 2) Is the contact default batch value configurable? 3) When referencing the client code, since the client is web-based, does this imply multiple tabs are open or is it storing all data from a single session?) they informed me of the following: "Unfortunately based on the error you receive are only handled by Developer team, and we are not trained on developer part so I would not set any false expectations. I would suggest you to contact your internal developer who will be the best person to answer your questions. I have also provided you some developer forum links where you can post your queries."

I am an Admin and don't know enough about apex to resolve this issue. We don't have an internal developer (it's just me). We don't have any custom code. Any code we have is installed from AppExchange packages.

Any assistance would be helpful. Thank you!
Hi all,

I have the following custom lightning component, but it is coming up with the following error: Unknown controller action 'getOpps'.

component:
<aura:component controller="AcctOppsController" implements="flexipage:availableForRecordHome,force:hasRecordId">
    <aura:attribute name="mydata" type="OpportunityContactRole[]"/>
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="currentRecordId" type="Id" />
    <aura:handler name="init" value="{!this }" action="{! c.doInit }"/>
    <div style="height: 300px">
        <lightning:datatable
                keyField="id"
                data="{! v.mydata }"
                columns="{! v.mycolumns }"
                hideCheckboxColumn="true"/>
    </div>
</aura:component>
controller:
({
    doInit: function (cmp, event, helper) {
        cmp.set('v.mycolumns', [
            {label: 'Opportunity Name', fieldName: 'opportunityId', type: 'text'},
            {label: 'Contact Name', fieldName: 'contact', type: 'text'},
            {label: 'Role', fieldName: 'role', type: 'text'},
            {label: 'Amount', fieldName: 'amount', type: 'currency'}
        ]);
        
        var fetchData = {
            opportunityId: "opportunityId",
            contact : "Contact.Name",
            role : "Role",
            amount : "Opportunity.Amount"
        };

        helper.fetchData(cmp,fetchData);
    }
})
helper:
({
    fetchData : function(cmp) {
        var recordId =  cmp.get("v.recordId");
        var action = cmp.get("c.getOpps");
        action.setParams({ "currentRecordId" : recordId });
        action.setCallback(this, $A.getCallback(function (response) {
            var state = response.getState();
            if (state ==="SUCCESS") {
                cmp.set("v.mydata", response.getReturnValue());
            } else if (state === "ERROR") {
                var errors = response.getError();
                console.error(errors);
            }
        }
                                               ));
        $A.enqueueAction(action);
    }
})
apex controller:
public with sharing class AcctOppsController{
@AuraEnabled
public String currentRecordId {get;set;}

    public AcctOppsController(ApexPages.StandardController controller) {
        currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
    }
    
    @AuraEnabled    
    public List<OpportunityContactRole> getOpps() {
        List<OpportunityContactRole> oppresults = [SELECT Contact.name, Role, OpportunityId, Opportunity.Amount, Opportunity.StageName, Opportunity.Type FROM OpportunityContactRole WHERE contact.accountid=:currentRecordId];
        return oppresults;
        }
}

Any thoughts on what I am missing?


 

Hello,
I have a problem, I want create a formula between saleforces objects but I have an error message.
"Erreur : Le champ Questionnaires__r n'existe pas. Vérifiez l'orthographe"
IF(AND(Respect__c=Questionnaires__r.Respect__c,Respect__c= True),1,0)
My object "Questionnaires__c" is available, can you explain me ?
Thank in advance.
IF(MOD([MPM4_BASE__Milestone1_Project__c].Go_Live_Date__c   - DATE(1900,1,14),7)<5, [MPM4_BASE__Milestone1_Project__c].Go_Live_Date__c  - 80, 

(CASE(MOD( TODAY()- DATE(1900,1,14),7), 
5, TODAY()+ 3, 
6, TODAY()+ 2, 
7, TODAY()+ 1, 
TODAY() ) ))

Then I tried 
CASE(MOD( MPM4_BASE__Project_Lookup__r.Go_Live_Date__c - DATE(1900,1,7),7), 
0,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
1,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
2,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
3,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
4,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
5,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
6,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+1)), 
MPM4_BASE__Project_Lookup__r.Go_Live_Date__c -80)

Please  let me know what I am doing wrong?  I entered 1/1/2019 as the Go Live Date and I still get 10/13/2018 ?

Thank you,
Dorel
I want the ability to create a 9 box type box like the below using the Lightning Builder, is this possible? 

Component
<aura:component implements="lightning:homeTemplate" access="global" >
    <aura:attribute name="center" type="Aura.Component[]" />
    <aura:attribute name="left" type="Aura.Component[]" />
    <aura:attribute name="right" type="Aura.Component[]" />
    
    <div class="slds-grid slds-wrap">
        <div class="slds-col slds-size_1-of-3">
            <span>{!v.left}</span>
        </div>
        <div class="slds-col slds-size_1-of-3">
            <span>{!v.center}</span>
        </div>
        <div class="slds-col slds-size_1-of-3">
            <span>{!v.right}</span>
        </div>        
    </div>
</aura:component>

Design
<design:component label="Three column Page">
    <flexipage:template>
        
        <flexipage:region name="left" defaultWidth="SMALL">
            <flexipage:formfactor type="MEDIUM" width="SMALL"/>
        </flexipage:region>
        
        <flexipage:region name="center" defaultWidth="SMALL">
            <flexipage:formfactor type="MEDIUM" width="SMALL"/>
        </flexipage:region>
               
        <flexipage:region name="right" defaultWidth="SMALL">
            <flexipage:formfactor type="MEDIUM" width="SMALL"/>
        </flexipage:region>
        
    </flexipage:template>
</design:component>


User-added image
  • August 21, 2018
  • Like
  • 0
I've managed to create a lightning homepage component with 1 column using the below component, style, and design elements. If I re-use the {!v.main} in the component page more than once, I receive an error. 

I want to be able to create 3 horizontal sections as shown in the last image below. Is it possible? 

COMPONENT
<aura:component implements="lightning:homeTemplate">
    <aura:attribute name="main" type="Aura.Component[]" /> 
    <div>
        <lightning:layout horizontalAlign="spread">
            {!v.main}
        </lightning:layout>
    </div>
</aura:component>

DESIGN
<flexipage:template >
        <flexipage:region name="main" defaultWidth="Xlarge">
        </flexipage:region>
    </flexipage:template>

SVG
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
		<path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/>
		<path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/>
	</g>
</svg>

This is the error I receive
User-added image

This is the layout I can render but doesn't work if I add components to it
User-added image
  • August 19, 2018
  • Like
  • 0
User-added image
How do I give my Picklist, Lookup and Date Picker Functionality. Is it done with components or can it all be done within Visual Force pages.

How is a component supposed to be called is it somthing like <c:ComponentName>?
Im wondering how I go about using the SLDS components, I cant for the life of me figure it out and non of the online guides are helping me out. For example the combo box and picklist require <aura:component> but I have no clue how to use them or refrence them. 

This is the page:-
User-added image
The Visual Force Code is in the comments:-

Here is what im trying to do:-
https://developer.salesforce.com/docs/component-library/bundle/lightning:combobox/example
https://www.lightningdesignsystem.com/components/combobox/#site-main-content

But it I cant get it working.

Any help or explanation on how its done will be much appreciated thanks.
Dear
I do not know why but the inputfiled can not show the value
and the source as below
does anyone can help me to fix it ?

<aura:component implements="lightning:actionOverride,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global" >
            <lightning:recordEditForm aura:id="edit" recordId="0017F00000MWJ11QAH" recordtypeid="0127F000000SCs7QAG" objectApiName="Account"  >
                <div aura:id="msg">
                    <lightning:messages  />
                </div>
                     <lightning:inputField fieldName="Name" />
                       <lightning:inputField fieldName="Phone" />
                

                <footer class="slds-modal__footer">
                    <lightning:button variant="neutral" label="Cancel" onclick="{!c.cancelBtn}"/>
                    <lightning:button aura:id="submit" label="Save" variant="brand" type="submit"  />
                </footer>
            </lightning:recordEditForm>
    </aura:component>
it only the button can show but the input filed can not show anything

User-added image
Hello.

I am a beginner in development Salesforce, and I have a problem.
I try to show a section (div id:account) in a component but unsuccessfully.

Can you tell me where is my error.

Component
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
...
<button class="slds-button slds-button_outline-brand" onclick="{!c.DisplayAccount}">Add Account</button>
...
  <div aura:id="Account" class="{!if(v.displayedSection == 'Account','slds-show','slds-hide')}">
        <article class="slds-card">
            <div class="slds-card__header slds-grid">
                <header class="slds-media slds-media_center slds-has-flexi-truncate">
                    <div class="slds-media__figure">
                        <span class="slds-icon_container slds-icon-standard-account" title="account">
                            <lightning:icon iconName="standard:account" size="xx-small" alternativeText="-"/>
                            <span class="slds-assistive-text">account</span>
                        </span>
                    </div>
                </header>
            </div>
        </article>
    </div>
</aura:component>

Controller
DisplayAccount : function(component, event, helper) {
        component.set("v.displayedSection","Account");
    }

 
I got a great autocomplete combobox example from here http://sfdcmonkey.com/2017/07/17/re-usable-custom-lookup/ and it works great. The autocomplete combobox composed two components one is the display, and the other is the lookup. When the lookup item is clicked it populates the display.

How do I populate the display combobox when it loads? 

I've added an init function and I get the stored value, and I can populate all the components in the init helper except I can't trigger the event or populate the lookupField with the value that's been stored. When I try to do anything on the doInit controller, nothing is defined, when I try to get to the view from the helper, nothing is defined. I'm bumping against the limits of my knowledge. 

I'll try to strip out the non-related code to keep it brief, but I'll post the full code if necessary.

Display Component
<aura:component controller="lookupController"  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
                access="global">
    <aura:attribute name="selectedRecord" type="sObject" default="{}" description="Use,for store SELECTED sObject Record"/>
    <aura:attribute name="selectedLookupRecord" type="sObject" default="{}" />

    <aura:handler name="oSelectedRecordEvent" event="c:topicSelectEvent" action="{!c.handleComponentEvent}"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
Display box. This is the element I want to populate
<div aura:id="lookupField" class="slds-show">
                    <ui:inputText click="{!c.onfocus}" 
                                  updateOn="keyup" 
                                  keyup="{!c.keyPressController}" 
                                  class="slds-lookup__search-input slds-input leftPaddingClass" 
                                  value="{!v.SearchKeyWord}" 
                                  placeholder="search..."/>
                </div>
The call to the lookup component
<ul style="min-height:40px;margin-top:0px !important" 
            class="slds-listbox slds-listbox_vertical slds-dropdown slds-dropdown_fluid slds-lookup__menu slds" 
            role="listbox">
            
            <center> {!v.Message}</center>
            <aura:iteration items="{!v.listOfSearchRecords}" var="singleRec">
                <c:TopicSelect_result oRecord="{!singleRec}"/>
            </aura:iteration>
        </ul>
Display component controller
doInit : function(component, event, helper){
        helper.getTopicHelper(component,event,helper);
    }
Display component helper 
getTopicHelper : function(component,event) {
        var action = component.get("c.getDefaultTopic");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var responseValue = response.getReturnValue();
                component.set("v.selectedRecord" , responseValue);
                component.set("v.selectedLookupRecord" , responseValue);

            }           
        });
        $A.enqueueAction(action);

    },
Lookup Component
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
		<aura:attribute name="oRecord" type="sObject" />
		<!--Register the component level event-->
		
		<aura:registerEvent name="oSelectedRecordEvent" type="c:ADF_topicSelectEvent"/>
		
		<li role="presentation" class="slds-listbox__item" onclick="{!c.selectRecord}">
			<span id="listbox-option-unique-id-01" 
				  class="slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta" 
				  role="option">
				<span class="slds-media__body">  
					<span class="slds-listbox__option-text slds-listbox__option-text_entity">{!v.oRecord.name}</span>
				</span>
			</span>
		</li>
	</aura:component>
Lookup Controller
({
	   selectRecord : function(component, event, helper){      
		  var getSelectRecord = component.get("v.oRecord");
		  var compEvent = component.getEvent("oSelectedRecordEvent");
			 compEvent.setParams({"recordByEvent" : getSelectRecord });  
			 compEvent.fire();
		},
	})
Event component
<aura:event type="COMPONENT" description="this event will pass the selected topic into parent component" >
		<aura:attribute name="recordByEvent" type="sObject"/>
	</aura:event>
Any help would be appreciated
 
Hello friends,
I inherited a visualforce page with over 4000 lines of code in it. It is hitting the 'Maximum view state size limit (135KB) exceeded' error message. I know that queries in the custom controller need to be obtimized, etc, but there are 56 select statements and I'm not familiar with the data structure at all. Is there a fairly simple, fast way to break the page into components similar to how we break pages into components in Lightning? And should I expect that will help the performance? Tech lead has suggested that I split it into 2 visualforce pages, to quickly get past this problem. The first page would have a single apex:selectlist that the user must select from. The second page would have everything else with data dependent upon the selection from the apex:selectlist on the first page. I'm not convinced this will solve the problem though. We plan to move to Lightning soon, so we don't want to completely rebuild in visualforce. Any advice here is greatly appreciated.

Sample code is posted here. There are a total of 112 output panels on this page and it looks like some of them are rendered or not based on boolean values. Ugh.
<!--Salesforce Licenses-->
             <div class="row">
                <div class="col-sm-12 m40">  
                    <a name="bac"></a>
                    <apex:outputPanel id="SalesforceLicensesRepeat">
                    <table cellpadding="0" cellspacing="0" class="bordered" style="width:1280px;border:1px solid #222;">
                    <tr>
                        <td colspan="9" class="darkgrayback">
                            <div class="tabletop noborder">
                                Salesforce Licenses
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="lightgreenback borderbottom1 thead"></td>
                        <td class="lightgreenback borderbottom1 thead">Value</td>
                        <td class="lightgreenback borderbottom1 thead">Description</td>
                        <td class="lightgreenback borderbottom1 thead">Notes</td>
                        <td class="lightgreenback borderbottom1 thead">Attachment</td>
                        <td class="lightgreenback borderbottom1 thead">Confirmation</td>
                        <td class="lightgreenback borderbottom1 thead">Date</td>
                        <td class="lightgreenback borderbottom1 thead">Fund Code</td>
                        <td class="lightgreenback borderbottom1 thead"></td>
                    </tr>  
                    <apex:repeat value="{!SalesforceLicenses}" var="ba">   
                    <tr>
                        <td class="lightgreenback" style="text-align:center;"><apex:commandLink action="{!EditBudgetItem}" oncomplete="showModal('BItemModal')" rerender="binewpanel">
                                <apex:param name="editid" value="{!ba.Id}" assignTo="{!editid}"/>Edit</apex:commandLink>
                        </td>
                        <td class="lightgreenback"><apex:outputField value="{!ba.Value__c}" /></td>
                        <td class="lightgreenback"><apex:outputField value="{!ba.Description__c}" /></td>
                        <td class="lightgreenback"><apex:outputField value="{!ba.Notes__c}" /></td>
                        <td class="lightgreenback" style="text-align:center;">
                            <apex:repeat value="{!ba.Attachments}" var="att">
                                <a href="/servlet/servlet.FileDownload?file={!att.Id}" target="_blank" style="color:#000;text-decoration:underline;">View/Download Attachment</a><br />
                            </apex:repeat>
                            <apex:outputPanel rendered="{!ba.Attachments.size == 0}">
                                    <a href="#AttachModal" data-toggle="modal" data-target="#AttachModal" onclick="UpRecordId('{!ba.Id}')">+ Add</a>
                            </apex:outputPanel>                            
                        </td>
                        <td class="lightgreenback"><apex:outputField value="{!ba.Confirmation__c}" /></td>
                        <td class="lightgreenback"><apex:outputField value="{!ba.Date__c}" /></td>
                        <td class="lightgreenback"><apex:outputField value="{!ba.Fund_Code__c}" /></td>
                        <td class="lightgreenback" style="text-align:center;">
                            <apex:commandLink action="{!DeleteBudgetItem}" onclick="if(!confirm('Are you sure you want to delete this item?\n\nThis action cannot be undone.')){return false};"  rerender="CMOPanel">
                                <apex:param name="delid" value="{!ba.Id}" assignTo="{!delid}"/>Delete</apex:commandLink>
                        </td>
                    </tr>  
                    </apex:repeat> 
                        
                    <tr>
                        <td class="lightgreenback totborder">Total</td>
                        <td class="lightgreenback totborder">
                            <apex:outputText value="${0, number,###,###,###,###}"> 
                                <apex:param value="{!TotalSalesforceLicenses}"/> 
                            </apex:outputText>
                        </td>
                        <td class="lightgreenback totborder"></td>
                        <td class="lightgreenback totborder"></td>
                        <td class="lightgreenback totborder"></td>
                        <td class="lightgreenback totborder"></td>
                        <td class="lightgreenback totborder"></td>
                        <td class="lightgreenback totborder"></td>
                        <td class="lightgreenback totborder"></td>
                    </tr>  

                        
                    <tr>
                        <td colspan="9" class="noback">                         
                            <div style="text-align:right;">
                                <apex:commandLink action="{!NewBudgetItem}" oncomplete="showModal('BItemModal')" rerender="binewpanel" styleClass="btn btn-primary bimodal">
                                <apex:param name="editid" value="Salesforce Licenses" assignTo="{!editid}"/>+ Add</apex:commandLink>
                            </div>                            
                        </td>
                    </tr>
                    
                    
                    </table>
                    </apex:outputPanel>
                </div>
            </div>

 
VALUE( 
IF( 
LEN(SUBSTITUTE(Account.Software_Version__c, '.', ''))=5, 
SUBSTITUTE(RPAD(Account.Software_Version__c,6,'0'), '.', ''), 
SUBSTITUTE(Account.Software_Version__c, '.', '') 
)) 

>= 

VALUE( 
IF( 
LEN(SUBSTITUTE(Target_Release__c, '.', ''))=5, 
SUBSTITUTE(RPAD(Target_Release__c,6,'0'), '.', ''), 
SUBSTITUTE(Target_Release__c, '.', '') 
))

Hey all!

I'm looking to create a formula field that evaluates 2 Currency fields (Let's call them A & B), selects the lower of the 2 values and pushes it to a 3rd currency field (C).

If either A or B is Null, it will push the only available option to C. How would I go about doing this? Thanks!

Hello All,

I am validating on field as format ,any numeric and alpha numeric(4) then (-) again any numeric and alpha numeric(5)
Eg. AA12-A322R
 
NOT(REGEX(CurrentGenerators__c,"[a-zA-Z0-9]{4}[-][a-zA-Z0-9]{5}"))
Regards,
Dinesh
  • September 19, 2018
  • Like
  • 0
Hello. This is a really newbie question but I haven't done coding in a while and got stuck. The Visualforce Basics trailhead says to Open your browser’s JavaScript console and enter the following code for format your Visualforce page with Lightning.

$A.get("e.force:navigateToURL").setParams(
    {"url": "/apex/pageName"}).fire();

I know how to get to the Chrome DevTools, but how do you run Javascript inside it?
Was wondering if anyone has had success with creating a record using lighting data service that will bring in the picklist values for a field using lightning select and just binding the value to a aura iteration. Or do i still need to Schema.DescribeSObjectResult etc.. to retrieve the values from the server.  
I am a newbie and have what I think is a simple question for the gurus out there.
I have this VF code  using a standard controller to display a list of records.  I'd like to order the list from most recent entries to oldest (currently it lists them in the order they are created). I can also use the field Week_Ending_Date__c to sort if needed.
How would I accomplish this?

Thanks much for putting me on the right track!

<apex:page standardController="Services_Engagement__c">
   <apex:form >
      <c:MultiRecordComponent aParentRecId="{!Services_Engagement__c.Id}" asObjectType="Services_Engagement_Cost__c" aFieldList="Name,Week_Ending_Date__c,Labor_Hours__c,Labor_Rate__c,Labor_Cost__c"
         aRelationField="Services_Engagement__c" aLabelOverrideFieldList=""
         aLabelOverrideTextList="" aDefaultValueFieldList=""
         aDefaultValueTextList="" aBlockTitle="Services Engagement Costs" aAllowAdd="true"
         aAllowEdit="true" aAllowDelete="true" />
   </apex:form>
 
</apex:page>

 
Hi,
I would like to add a select all option to a column(On_Site__c) that is bound to an outputfield on my VF page which is currently using inline editing
This is the page code:

<apex:page standardController="Build_Up_Checklist__c" extensions="BuildUpChecklist" showHeader="false" sidebar="false">
    <style type="text/css">
        .pbTitle {
        white-space: nowrap;
        }
    </style>
    <table width="98%" border="0" cellpadding="0" cellspacing="0">
        <tr><td align ="right"><a href="javascript:window.print();">Print</a></td></tr>
    </table>
    <apex:form>
        <apex:pageBlock title="Product list for: {!Build_Up_Checklist__c.Build_Up_Checklist_Opportunity__r.Name} - ({!Build_Up_Checklist__c.Opportunity_EDU__c})">
            <apex:outputPanel >
                <apex:commandbutton value="Save" action="{!updateOLIs}" id="saveButton" style="display:none"/>
                <apex:commandButton value="Cancel" action="{!cancelUpdateOLIs}" id="cancelButton" style="display:none"/>
            </apex:outputPanel>
            <apex:pageblocktable value="{!OppProducts}" var="oli">
                <apex:column value="{!oli.PriceBookEntry.Name}" />
                <apex:column value="{!oli.Product_Notes__c}" />
                <apex:column value="{!oli.Quantity}"/>
                <apex:column headerValue="On Site"> 
                    <apex:outputField value="{!oli.On_Site__c}">
                        <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" event="ondblclick" />
                    </apex:outputField>
                </apex:column>
                <apex:column value="{!oli.Replacement__c}"/>             
            </apex:pageblocktable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


The editing and saving is working as intended, but it would be nice if the user didn't have to check the 'On_Site__c' checkbox on each row.

Many thanks
 
I have a custom object Students and several fields within it. I now wish to access that data using APEX class and display it in a VP. Here's what I have so far:
public class stdnts {
    List<student__c> enrolledStdnts = [SELECT ID, Name, Year__c, Class__c FROM student__c LIMIT 10];
}
and
<apex:page controller="stdnts">
	<apex:form >
        <apex:pageBlock title="List of enrolled Students">
			<apex:pageBlockTable value="{! enrolledStdnts }" var="ct">
            <apex:column value="{! ct.Year__c }"/>
            <apex:column value="{! ct.Class__c }"/>
			</apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
What am I doing wrong?

 
  • September 16, 2018
  • Like
  • 0
Hey experts, 

hopefully, somebody will unterstand what i want to do. I am looking for way to divide the business day in different time slots.  For each task record, i want to cluster the created date timestamp in one category.  

For example: 
hh:mm:ss to
08:00:00 to 08:15:00 = part 1
08:15:01 to 08:30:00 = part 2
08:30:01 to 08:45:00 = part 2
08:45:01 to 09:00:00 = part 4
...
17:45:01 to 18:00:00 = part 40

Why ?  iI just want to see the productivity development of each sales agent in 15 min ( or 30 min) steps and compare each other. Then, i want to create a real time dashboard which is moving forward over the day.

My first thought was,  to create three fields:

The first one, catches the time of the createdDate field:
The second one, transform the value of the first field to a number. ( 08:30:00 == 83000)
The third one, is an if statment to check, in which timeslot the number field falls. 

Firstly, this solution is not really nice and secondly it doesn't work, because the if statment exceed the character limit.  Of course i can split the if statment in many fields but this would be the worst solution  ^^  Any suggestion for this ? 

Thanks for your effort guys. 
 
Greetings Marry
 

Hello: The posted solution does not seem to be calculating correctly for me.

Below is my field formula to try to get the # of days overdue less the weekends. As you can see by the results, I have 3 issues
(1) only calculating 1 day for the weekend (ex: ex: Due Date = 9/19/18 and Date Sent = 9/27; one wekend involved and should be 6 days overdue but showing 7 days)
(2) adding an additional day when no weekend is involved (ex: Due Date = 9/19/18 and Date Sent = 9/21; this is no weekend involved and should be 2 days overdue but showing 3)
(3) miscaluclating when not overdue (Ex: Due Date = 9/18/18 and Date Sent = 9/17/18); no weekend involved and should be -1

Calculation ResultsUser-added image

Any advice would be greatly appreciated.

Thanks,

Tracey
 

I built a dashboard that our users would like to use as their main homepage. But with the 2 column layout it squishes everything down and makes it hard to see. I followed the steps below in the dev console and created the single column layout. And when i choose that option and put the dashboard it everything looks great in the page editor. However when i save/activate and go to it, it loads into a small column on the left of the screen instead of taking up the whole screen. Any suggestions? Thanks
You need to create the following component HomePageSingleColumnTemplate with the following code

<aura:component implements="lightning:homeTemplate">
    <aura:attribute name="main" type="Aura.Component[]" /> 

    <div>
        <lightning:layout horizontalAlign="spread">
            {!v.main}
        </lightning:layout>
    </div>
</aura:component>

Also you have to specify design for it

<design:component >
    <flexipage:template >
        <flexipage:region name="main" defaultWidth="Xlarge">
        </flexipage:region>
    </flexipage:template>
</design:component>

 
Hi all! 

I am trying to replicate the excel Days360 function which returns the number of days between 2 dates, based on a 360-day year (12 x 30 months).

Does anyone know how to accomplish this?
Hey guys,

i am not familar with javascript, but i really like how the chart.js libary looks. To get started i want to create some cool Salesforce Dashboards with chart.js. I have already create a visualforce Page to show a simple bar chart. Now, i am looking for a way to get the controller variable to the javascript function : 
http://www.chartjs.org/docs/latest/

This is the javascript Code: 
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
    type: 'bar',
    data: {
        labels: ["M1", "M2", "M3", "M4", "M5", "M6"],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3],   
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)',
                'rgba(153, 102, 255, 0.2)',
                'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [
                'rgba(255,99,132,1)',
                'rgba(54, 162, 235, 1)',
                'rgba(255, 206, 86, 1)',
                'rgba(75, 192, 192, 1)',
                'rgba(153, 102, 255, 1)',
                'rgba(255, 159, 64, 1)'
            ],
            borderWidth: 1
        }]
    },
    options: {
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero:true
                }
            }]
        }
    }
});
</script>
How can i change the label and dataset with controller variables ? My idea is to create a simple list and transform the list to string. Does this work ? 

Thanks for help guys. I cant find any help for chart.js and visualforce...

Greetings,

Marry





 

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.