• Suneel#8
  • SMARTIE
  • 752 Points
  • Member since 2014

  • Chatter
    Feed
  • 24
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 11
    Questions
  • 189
    Replies
I need to access images from external system using HTTP callouts and display them in Salesforce.
Content-Type →image/png is the format of the reponse Salesforce is receiving
Can we use Blob to store images?
Could anyone throw light on this
I have created a lightning app with a text box and list of contacts under it.As user types in the search string,List contents should be filtered.But I am receiving following error upon typing the search string-rerender threw an error in 'markup://aura:iteration' : Cannot read property 'childNodes' of null.I came across-"http://salesforce.stackexchange.com/questions/71604/lightning-bug-in-lightning-framework-when-using-aurarenderif" but not sure if it is the same reason for this behavior.Could anyone point out the error in my below code.

Component to display list of filtered contacts-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js" />    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />   
    <aura:handler event="c:PFAppEvent" action="{!c.doInit}"/>	
    <aura:attribute name="contacts" type="Contact[]"/>    
    
	<aura:iteration items="{!v.contacts}" var="p">
        <c:ContactItem fullName="{!p.Name}" accountName="{!p.Account.Name}" />        
    </aura:iteration> 
</aura:component>
Component to type in the search string-SearchComponent.cmp
<aura:component >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js,/resource/jQuery/jquery-1.11.3.min.js" afterScriptsLoaded="{!c.loadJQuery}"/>    
    <aura:registerEvent name="PFAppEvent" type="c:PFAppEvent"/>
    
    <input type="text" style="width:100%;" class="form-control" placeholder="Name or Username" id="searchBox" />
</aura:component>
Helper method to call Server Side controller and fetch matching contacts-ContactItemListHelper.js
({
 	getContacts: function(component,event) {
      
        var action = component.get("c.getContacts");
        var searchString;
        if(typeof event != 'undefined'){
   			searchString=event.getParam("searchString");
        }else{
            searchString='';
        }
        console.log('Contact List Item:'+searchString);
        action.setParams({
			"searchString": searchString
		});
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
        });
        $A.enqueueAction(action);
    }    
})
Listener to Search Component-SearchComponentController.js
({
	loadJQuery: function(component, event, helper) {
        console.log('I am loaded');
        var lastValue = '';
		setInterval(function() {
    		if ($("#searchBox").val() != lastValue) {
	        	lastValue = $("#searchBox").val();
                console.log('New Value:'+lastValue);
		        var appEvent = $A.get("e.c:PFAppEvent");
		        appEvent.setParams({ "searchString" : lastValue });
		        appEvent.fire();                
	    	}
		}, 1500);        
	}

})

 
I am not sure why aura:iteration is displaying blank list of values.I can see that p.id is repeating 5 times but it is showing blank values.Please help Below is my component-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="contacts" type="Contact[]"/>
	<aura:iteration items="{!v.contacts}" var="p">
        -->{!p.id}
    </aura:iteration>
</aura:component>
Below is my client side controller-ContactItemListController.js
({
	doInit : function(component, event, helper) {
        helper.getContacts(component);
    }
})
Below is my server sider controller-ContactItemListController.apxc
public class ContactItemListController {
	@AuraEnabled
    public static List<Contact> getContacts() {
        List<Contact> cList=[select id from Contact limit 5];
        System.debug('-------->'+cList.size());
        return cList;//[select id, name from contact limit 100];//cList;
    }
}
Below is my helper file-ContactItemListHelper.js
({
 	getContacts: function(component) {
        var action = component.get("c.getContacts");
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
            console.log("**"+a.getReturnValue());
        });
        $A.enqueueAction(action);
    }
})






 
I want to integrate Siebel's Oracle database with Salesforce using Lightning Connect.As Siebel cannot expose data using OData protocol, can I use Apex Connector Framework to get this done?Also is there a better way to achieve my goal.Please advise
I have configured External Object- Orders as per the instructions in the page -https://developer.salesforce.com/trailhead/lightning_connect/lightning_connect_integrate. But I am not able to see the object in Salesforce1.Please advise
I am dispalying marker for every near by account and below anchor tag should navigate to the respective account upon clicking it.I have used the code in Workbook,but it works neither in Desktop nor in Salesforce1.Please help

try{
            if(sforce.one){
                 accountNavUrl = 'javascript:sforce.one.navigateToSObject(\'' + account.Id + '\')';
             }
} catch(err) {
             console.log(err);
             var dId=account.Id;
             accountNavUrl= '\\' + account.Id;
}
console.log('-->'+accountNavUrl );
var content='<a href src="'+accountNavUrl +'" >'+account.Name+ '</a><br/>'+account.BillingStreet +'<br/>' + account.BillingCity +'<br/>' + account.BillingCountry;

Below is the whole code
<apex:page standardController="Account" extensions="AccountMapExt" sidebar="false" showHeader="false">
  <!-- Begin Default Content REMOVE THIS -->
    <apex:includeScript value="https://maps.googleapis.com/maps/api/js?sensor=false" />  

  <style>
        html, body { height: 100%; }    
        .page-map, .ui-content, #map-canvas { width: 100%; height:100%; padding: 0; }
        #map-canvas { height: min-height: 100%; }
  </style>
  <script>
      var lat;
      var lon;
        function initialize(){ 
            if(navigator.geolocation){
                navigator.geolocation.getCurrentPosition(
                    function(position){
                        lat=position.coords.latitude;
                        lon=position.coords.longitude;
                        Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.AccountMapExt.getNearby}',lat, lon,
                              function(result, event){
                                    if (event.status) {
                                           console.log('->'+lat+' '+lon+' '+result);
                                           createMap(lat, lon, result);
                                    } else if (event.type ==='exception') {
                                            //exception case code
                                    } else {
                                    }
                                    },
                                    {escape: true}
                        );                        
                    }
                );
            } 
          
        }    
        function createMap(lat,lon,accounts){
                console.log('Calling map '+ lat+' '+lon);
                var currentPosition = new google.maps.LatLng(lat,lon);            
                var mapDiv = document.getElementById('map-canvas');
                var map = new google.maps.Map(mapDiv, {
                    center: currentPosition, 
                    zoom: 13,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                });
                var positionMarker = new google.maps.Marker({
                    map: map,
                    position: currentPosition,
                    icon: 'https://maps.google.com/mapfiles/ms/micons/green.png'
                });
                
                for(var i=0; i<accounts.length;i++){
                    account= accounts[i];
                    console.log(accounts[i]);
                    setupMarker();
                }                
                
                function setupMarker(){
                    var accountNavUrl;
                    try{
                        if(sforce.one){
                            accountNavUrl = 'javascript:sforce.one.navigateToSObject(\'' + account.Id + '\')';
                            
                        }
                    } catch(err) {
                        console.log(err);
                        var dId=account.Id;
                        accountNavUrl= '\\' + account.Id;
                    }
                    console.log('-->'+accountNavUrl );
                    var content='<a href src="'+accountNavUrl +'" >'+account.Name+ '</a><br/>'+account.BillingStreet +'<br/>' + account.BillingCity +'<br/>' + account.BillingCountry;
                    //Create the callout that will pop up on the marker
                    var infowindow = new google.maps.InfoWindow({content: content});
                    //Place the marker
                    var marker = new google.maps.Marker({
                        map: map,
                        position: new google.maps.LatLng(account.BillingLatitude,account.BillingLongitude)}
                    );              

                    google.maps.event.addListener(marker, 'click', function(){
                        infowindow.open(map, marker);
                    });                          
                }  
                var mapBoundary = new google.maps.LatLngBounds();
                mapBoundary.extend(currentPosition);                    
         }       
         google.maps.event.addDomListener(window, 'load', initialize);           
  </script>

    <body style="font-family: Arial; border: 0 none;">
        <div id="map-canvas"></div>
    </body>    
  <!-- End Default Content REMOVE THIS -->
</apex:page>

 
Hi,
I have this question how to restrict approval process not to apply based on opp owner(user) role for only specific roles of opp owner.
Owner.UserRole.Name = "User role name" can this formula used to do that
Please let me know. Thanks in advance.
 
Hi All,

I have a requirement where i have a custom object O1 which is having field f1, f2, f3, f4 and I have an email template. When ever a field value is changed i would like to trigger an emailtemplate stating "(f1.OldValue) has been changed to (f1.NewValue)" of that field only. And if there are no change in other fields then the mentioned statement shouldn't appear.
Can anyone tell me the approach.

Regards
 
I messedup with different answers of batch apex help me on this.


Please correct me below if i go wrong any where.!

/* All in case of batch apex*/
* querylocator ---- will fetch 50 million records.
* one soql query -- will fetch 50000 records.
* getquerylocator-- will fetch 10000 records.
===========================================

Please give me clarification for below.

* How many SOQL queries we can write in a single Batc Apex Class.?
* If we can use more than one SOQLs, can we write on different Objects in the same Batch Apex class.?
* Can SOQL query write in all the methods.(start(), execute(), finish()).?

 Give me clarification on this points, i am confused on these things, even shortly or with explanation.

Thanks.
I am trying to develop a report that shows accounts that does not have a specific object data associated. 

My accounts data is populated with building data that we survey and I have objects created with specific fields for each survey we do I need to pull a report on a daily basis to see what buildings that wasn’t surveyed and that was surveyed. I do have a trigger created for duplicates.  Each object has a look up field for account ( Building). Any thought on how I should go about this is much appreciated.
 
 
We have a custom object My_Cases which has a status__c field and the other fields. We want to have a close case button in the detail page of My_case__c, when click it, we want to go to the edit page of My_Case__c with Closed selected in status__c, and only a few fields shown up which some of them are read only. Actually we have created a closed case page layout for it. But I don't know how to call it from my button. Do I have to make my own VF for this function?
I have the opportunity standard object with a custom field called "serial number."  This field is set to look up from  a custom object called "Inventory" where these serial numbers are logged.  The inventory object has all the pertinent info that I need regarding that serial number and also a field called "opportunity." When I create an opportunity, I go the "serial number" field and look up the serial number I need from the inventory object.  This works fine.  What I am trying to do is have the "opportunity" custom field on the inventory object populate the opportunity name where that serial number is assigned automatically.  It seems that I need to use a formula, but I can't get it to work.  Please help!
Please! can someone help me to solve my little problem because I can not do the same,
public class OdtDetailController2 
    {

       
         public list<wrapperclass> Jonintwrapper{get;set;}
         public list<wrapperclass> Odtwrapper{get;set;}
         public Ordre_Travail__c OrdreTravail {get; set;}
        Public Double TotalNombre=0;
        Public Double TotalQuantite=0;
       Public Double Total;
       
         
         public OdtDetailController2(ApexPages.StandardController controller) 
             {
                 OrdreTravail = (Ordre_Travail__c)controller.getRecord();
                 OrdreTravail = [SELECT Id, Date__c, Produit__c, Nombre__c FROM Ordre_Travail__c];
                 list<JointMatProd__c> Jointure = [SELECT id, MatierePremiere__c, Quantite__c FROM JointMatProd__c WHERE produit__c = :OrdreTravail.Produit__c];
                 
                 //list<Ordre_Travail__c> OrdreTravail = [SELECT id, name, Date__c, Produit__c, Nombre__c FROM Ordre_Travail__c WHERE produit__c = :Ordre_Travail__c.Produit__c];
                 //list<JointMatProd__c> Jointure = [SELECT id, MatierePremiere__c, Quantite__c FROM JointMatProd__c WHERE produit__c = :Ordre_Travail__c.Produit__c];
                 Odtwrapper = new list<wrapperclass>();
                 /*for(Ordre_Travail__c Odt: OrdreTravail)
                     {
                        Odtwrapper.add(new wrapperclass(Odt));*/
                         if(OrdreTravail.Nombre__c!=Null){
                             //TotalNombre+=odt.Nombre__c;
                             Odtwrapper.add(new wrapperclass(OrdreTravail));
                             TotalNombre+=OrdreTravail.Nombre__c;

                        } 
                    // }
                     
                 Jonintwrapper = new list<wrapperclass>();
                 for(JointMatProd__c Joint: Jointure)
                     {
                        if(Joint.Quantite__c==Null)
                        Joint.Quantite__c=0; 
                        Jonintwrapper.add(new wrapperclass(Joint,Double.ValueOf(Joint.Quantite__c*TotalNombre)));
                        
                     }
                       

              }
    
              public class wrapperclass
                  {
                       public Ordre_Travail__c ODT{get;set;}
                       public JointMatProd__c JOINT{get;set;}
                       Public Decimal Total{get;set;}
                       
                       public wrapperclass(Ordre_Travail__c OrdreTravail) 
                           {
                                this.ODT = (OrdreTravail);
                           }
                           
                       public wrapperclass(JointMatProd__c Joint,Decimal Total) 
                           {
                                this.JOINT = (Joint);
                                this.Total=Total;
                           }
                  }
    }

here's my problem

"Visualforce ErrorAide sur cette page
System.QueryException: List has more than 1 row for assignment to SObject 
Class.OdtDetailController2.<init>: line 16, column 1"
 
I'm trying to edit multiple records with a list controller extension. I want to use the standard controller {!Save} action, so I only need to use the extension to limit the records I want to show up in my list. The problem is that when I include the list controller extension in my VF page, my edits are not saved. Below is my code for page and extension respectively. Please let me know what I'm doing wrong. If I need to write a custom {!Save} action, please help guide me on how to do that. Thanks for your help!

Visualforce page (called customCommissionEdit):
<apex:page standardController="lda_Commission__c" recordSetVar="TheseCommissions" extensions="extCustomCommissionList">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="quicksave" action="{!quicksave}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!TheseCommissions}" var="comm">
                <apex:column value="{!comm.name}"/>
                <apex:column value="{!comm.Agent_Order__c}"/>
                <apex:column value="{!comm.Agent__c}"/>
                <apex:column value="{!comm.Comm_Dollars__c}"/>
                <apex:column value="{!comm.Comm_Pct__c}"/>
                <apex:column headerValue="Commission Percent">
                    <apex:inputField value="{!comm.Comm_Pct__c}"/>
                </apex:column>
                <apex:column value="{!comm.LAO_Agent__c}"/>
                <apex:column value="{!comm.Role__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller extension (called extCustomCommissionList):
public with sharing class extCustomCommissionList {

    public extCustomCommissionList(ApexPages.StandardSetController controller) {
    }

     public list<lda_Commission__c> getTheseCommissions() {
            return [SELECT DealID__c, Name, Agent__c, LAO_Agent__c, Agent_Order__c, Comm_Dollars__c, Comm_Pct__c, Fiduciary__c, Role__c FROM lda_Commission__c WHERE DealID__c = :ApexPages.currentPage().getParameters().get('id')]; 
        } 
}

The lda_Commission__c object that I'm trying to edit is a child to another object, so I just want the user to edit the related child lda_Commission__c.

 
I have the below formula that has been working fine, until this month...

DATE( 
year(End_of_Mth__c) 
+ floor((month(End_of_Mth__c) + 4)/12) + if(and(month(End_of_Mth__c)=12,4>=12),-1,0) 

if( mod( month(End_of_Mth__c) + 4 , 12 ) = 0, 12 , mod( month(End_of_Mth__c) + 4 , 12 )) 

min( 
day(End_of_Mth__c), 
case( 
max( mod( month(End_of_Mth__c) + 4 , 12 ) , 1), 
9,30, 
4,30, 
6,30, 
11,30, 
2,28, 
31 


)

when my End of Mth date is 8/31/2014 the date being returned is 12/31/2015 instead of 12/31/2016.  All other months are working fine (before and after 8/31/2014) - I can't figure out why just that date is messing up?

Thank you!!