• Jasveer Singh
  • NEWBIE
  • 83 Points
  • Member since 2016
  • Mobilyte Pvt Ltd

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 6
    Likes Given
  • 9
    Questions
  • 41
    Replies
Hi all,

 - I want to acheive something by using $('.ClassName') in JS controller it is looking like impossible to do that by component.find('aura:id');
 - I am using <ltng:require scripts="{!$Resource.MyNameSpace__MyResourceName}"  /> as per lightning guide to add external source library.
 - I found one blog as well there we have unmanaged package and we can use external libraries below is the link
https://login.salesforce.com/packaging/installPackage.apexp?p0=04tB000000011BS 
But I cannot able to install this package as well..some error is coming..

Anybody has any idea how to overcome this error below is the screenshot for the same
User-added image
Please Provide the Best tool link for salesforce Integration

Thanks in advance
Jasveer Singh
i have two salesforce Account Alpha & Beta

if i insert Account in Alpha(like account name='abc') then same Account Inserted into Beta Account like (name='abc' ) 
Hint: basic idea is this is done with the salesforce Rest API

please provide Help
 
We need a process that will follow the below Round Robin to leads before being available to an actual agent as a lead.
 
Flow of Round Robin:
 
  1.  When an incoming  lead comes into the CRM from one of exterior sites, we need to follow a round robin system .
  2.  Agent who is first in round robin receives a notification in email with the client name, email and Phone.
  3. Agent either selects accept, or decline.(If no response within 5 minutes it goes to the next agent.
  4. If agent accepts lead and calls,  it is to record that a call was made, email was sent in CRM for reporting purposes
 
*round robin keeps going around and around until a lead is accepted.
 
trigger createTask on Opportunity (after insert, before update)

List<Task> tasks = new List<Task>(); 
List<Opportunity> Opps = Trigger.new; 
for (Opportunity Opp : Opps) 

Task tsk = new Task(whatID = Opp.ID, Ownerid = Opp.OwnerId, Subject = 'task created', Priority = 'Normal', Status= 'Not Started'); 
tasks.add(tsk);
 } 
 insert tasks;
  }
This is my Both classes And code coverage is 86% please help me to achieve 100% code coverage
Thanks & Regards
Jasveer Singh

public class WrapperClearFunda {

public List<Account> acclist{get;set;}
public List<Contact> conlist{get;set;}
public List<Wrapperclass> wl{get;set;}

public List<Wrapperclass> wlacc{get;set;}
public List<Wrapperclass> wlcon{get;set;}

public WrapperClearFunda(){
acclist=new List<Account>();
conlist=new List<Contact>();

wlacc=new List<Wrapperclass>();
wlcon=new List<Wrapperclass>();

wl=new List<Wrapperclass>();
acclist=[select name from account];
conlist=[select Lastname from Contact];

// insert value into 1st Constructor
for(Integer i=0;i<5;i++)
{
wl.add(new Wrapperclass(acclist[i],conlist[i]));
}

// insert value into 2nd Constructor
for(Account a:acclist){
wlacc.add(new Wrapperclass(a));
}


// insert value into 3rd Constructor
for(Contact c:conlist){
wlcon.add(new Wrapperclass(c));
}


}



public class Wrapperclass{
public Account acc{get;set;}
public Contact con{get;set;}

// 1st Constructor
public Wrapperclass( Account acc, Contact con){
this.acc=acc;
this.con=con;
}

// 2nd Constructor
public Wrapperclass( Account acc){
this.acc=acc;
}

// 3rd Constructor
public Wrapperclass( Contact con){
this.con=con;
}

}


}


+++++++++++++++++++++++++++++++++++++++

@isTest 
private class WrapperClearFundaTest{
  // WrapperClearFunda wcf=new WrapperClearFunda ();
  
    static testMethod void validateHelloWorld1() {
    Account acc=new Account();
    Contact con=new Contact();
    WrapperClearFunda.Wrapperclass w1=new WrapperClearFunda.Wrapperclass(acc,con);
    }
    
    static testMethod void validateHelloWorld2() {
    Account acc=new Account();  
    WrapperClearFunda.Wrapperclass w2=new WrapperClearFunda.Wrapperclass(acc);
    }


    static testMethod void validateHelloWorld3() {
    Contact con=new Contact();
    WrapperClearFunda.Wrapperclass w3=new WrapperClearFunda.Wrapperclass(con);
    }


    static testMethod void validateHelloWorld4() {
    WrapperClearFunda wcf=new WrapperClearFunda ();
   // WrapperClearFunda.Wrapperclass w4=new WrapperClearFunda.Wrapperclass();
    Account acc=new Account(name='axz');
    Contact con=new Contact(lastname='abc');
          insert acc;
          insert con;
          System.assertEquals('abc', con.lastname);
          System.assertEquals('axz', acc.name);
    }

}
 
I am new in salesforce Please Provide me a guidance where i am Study Test Classes of Apex Class and Trigger
Thanks & Regards
Jasveer Singh
Please Provide me a link.
Where i am learn Sales App Step by Step.
Thanks in Advance

Thanks & Regards
Jasveer Singh
I have 3 record types and 2 visualforce pages. I want to override "New" button and display visualforce pages based on the record type selected. But there is a record type for which I want to display standard record creation page and not a visualforce page. How do I do that?
  • October 11, 2016
  • Like
  • 0
Hi All,
 i want to integrate google hangout with salesforce.i have tried the steps given in google hangout documentation 
but its not working .please help.

thanks in advance.
I need to learn about integration. Can anyone suggest me the website from where I can learn integration ?
Hi,
I am looking for the best, quickest way to get used to Salesforce development using a Developer Environment platform. 
I have found two books in developer.salesforce.com:
Force.com Platform Fundamentals
Force.com Workbook
The first one is a 400 pages book and the second is smaller 140 pages.
Can anybody that has reviewed and worked with both tell their opinion about both? Any advise will be helpful.
Feel free to give any other suggestion or advise.
Thanks in advance
public class wrapperExample2 {

  List <Product_Entry__c> ProdList=new List<Product_Entry__c>();
  List <wrapper> lstw =new List<wrapper>();
  
  public List<wrapper> getlstWrapperString() 
  
      { 
              ProdList=[select name,Price__c from Product_Entry__c];
               for (integer i=0; ProdList.size();i++) 
                      {
                  lstw.add(new wrapper(ProdList[i].name,ProdList[i].Price__c));
                      }
              
                      return lstw;
        }
                      
 public Class wrapper {  
     public string name {get;set;}
     public decimal price {get;set;}
     public wrapper(string Name,decimal Price) 
             {
             this.Name = Name;
             this.Price = Price; 
             }
    
     }
  }

 
  • August 03, 2016
  • Like
  • 0
I am having a picklist field(Status) with values A,B,C and D

 I want to hide or remove only D  value from Piclist(Status) in the VF page

Can someone pls help me with the code.

Regards,
Viswa.
I am new to integration and trying a salesforce to salesforce integration using canvas. I am facing a problem while retrieving canvas parameters in visual force page. Not sure what I am doing wrong. Following is the code added on visual force page to retrieve parameter:
<script>
Sfdc.canvas(function(){
var sr = JSON.parse('<%=signedRequestJson%>');
Sfdc.canvas.byId('username').innerHTML = sr.context.environment.parameters.contactId ; });
</script> 
Please help.
Hi,
We have custom tabs and buttons for one of our custom object. When Lightning Experience page loads, initially these tabs and buttons works very well in all browsers. But after navigating 2-3 times these tabs and buttons stops working in IE, at the same time the SF standard tabs and buttons still works. 
We noticed this behavior in IE and FF but not in chrome. In chrome all tabs and buttons works always.

Does anyone has this experience. 
Please help.

Thanks in Advance,
Vinay
Hi,

I want to access the company name and smallphotourl fields from user object in with sharing class and i am not able to access these fields. I have granted access to user by using with sharing button but still not able to access the users. 

I need help that is there any way to access the users in with sharing class so that i access the desired fields from user object.
 
Can any one have the help of complete Triggers
Hi,
How can my make my Visualforce pages responsive?
Hi All,

Please help me out for JAVASCRIPT code which should be appended in Visualforce page that automatically refreshes for 5 secs.
after a record is created then it has to refresh automatically after 5 secs .

Thanks ,
Ram
Hi

I have created a page which should capture all details and generate a pdf.everything is ok but i need to dispaly image in my pdf page uisng vf page.how its possible.

User-added image
 
<apex:page sidebar="false" showHeader="false" renderAs="PDF" standardController="TigerTuesday__c" >
<html xmlns='http://www.w3.org/1999/xhtml'>
  <head>               
                <style type="text/css" media="print">
                    </style>

<apex:stylesheet value="{!$Resource.PDFDocumentStyle}" />
</head>

<c:pdfheaderfooter type="header" position="center">
       

               <img  src="{!$Resource.TigerTuesdayLogo}" ></img> 
  
          </c:pdfheaderfooter>
          
          
          <c:pdfheaderfooter type="footer" position="right" showPageNumbers="true">
    <table width="100%" border="0" >
    
    <tr>
         <td> 
         <img width="200%" height="100%" alt="logo" src="{!$Resource.TigerTuesdayLogo}" ></img>
    </td> 
    </tr>
    </table>
    
    </c:pdfheaderfooter>
    
     <table>
   <apex:outputPanel rendered="{!IF(TigerTuesday__c.Issue__c==null,false,true)}">
   <tr> 
   <td><b>Issue </b></td> <td>:{!TigerTuesday__c.Issue__c}&nbsp;<b>|</b>&nbsp;{!TigerTuesday__c.Issue_Date__c} </td>
  </tr>
 
  </apex:outputPanel>
  </table>  
  
  <table >
   <apex:outputPanel rendered="{!IF(TigerTuesday__c.Name==null,false,true)}" >
   <tr> 
   <td style="font-size:25px;font-family:rebuchet MS,Arial,Helvetica,sans-serif;color:Orange;">{!TigerTuesday__c.Name}</td>
  </tr>
 
  </apex:outputPanel>
  </table> 
  
  
  <table >
   <apex:outputPanel rendered="{!IF(TigerTuesday__c.Paragraph__c==null,false,true)}" >
   <tr> 
   <td >{!TigerTuesday__c.Paragraph__c}</td>
  </tr>
 
  </apex:outputPanel>
  </table> 







</html>
</apex:page>

 
I have  a javascript on a vf page from which i want to pass value to the controller. but i am getting null in the controller.can anyone help me in this? my code:
VF page:

<apex:page controller="visitController" showHeader="false" sidebar="false" setup="true" standardStylesheets="false">
<apex:form > <style> body { padding: 20px; background-color:#ffffc9 } p { margin : 0; } </style>
<Script> function geoFindMe()
{ var output = document.getElementById("out");
if (!navigator.geolocation){
output.innerHTML = "<p>Geolocation is not supported by your browser</p>"; return;
}
function success(position)
{ var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
echo(latitude,longitude );
output.innerHTML = '<p>Latitude is ' + latitude + '° <br>Longitude is ' + longitude + '°</p>'; var img = new Image();
img.src = "https://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=13&size=300x300&sensor=false"; output.appendChild(img); };
function error() {
output.innerHTML = "Unable to retrieve your location"; };
output.innerHTML = "<p>Locating…</p>";
navigator.geolocation.getCurrentPosition(success, error); }
</script>
<body>
 <apex:pageBlock id="block"> Sales Visit Name: <br />
<apex:inputField value="{!visit.name}" /><br />
Sales Visit Description: <br /> <apex:inputField value="{!visit.Description__c}" /><br /> Longitude: <br /> <apex:inputField value="{!visit.Longitude__c}" id="longitude" /><br />
Latitude: <br /> <apex:inputField value="{!visit.Latitude__c}" id="latitude" /><br /> <br/> <br/>
<apex:commandButton onclick="geoFindMe()" action="{!save}" value="Show my location!" /> <div id="out"></div>
<apex:actionFunction name="echo" action="{!echoVal}" reRender="resultPanel" status="myStatus">
<apex:param name="latitude" assignTo="{!enteredText1}" value="" />
<apex:param name="longitude" assignTo="{!enteredText2}" value="" />
</apex:actionFunction> </apex:pageBlock>
</body>
</apex:form>
</apex:page>

Controller:
public class visitController { 
    public String save { get; set; }

  public String Latval ;
  public String Lonval ;
    public Sales_Visit__c visit {get;set;}
 
 public String latitude {get;set;} 
 public String longitude{get;set;} 
  
    public visitController() {
        visit = new Sales_Visit__c();
        
       
    }   
 public void echoVal() 
    { 
    //  Latval = Apexpages.currentPage().getParameters().get('latitude');
     // Lonval = Apexpages.currentPage().getParameters().get('longitude'); 
     
    //  System.debug('*********latitude echoValechoVal latitude*********'+Latval);
     //      System.debug('*********longitude echoValechoVal longitude*********'+Lonval);
    } 

    
    public PageReference save() {
     Latval = Apexpages.currentPage().getParameters().get('latitude');
   Lonval = Apexpages.currentPage().getParameters().get('longitude'); 
     
     System.debug('*********latitudelatitude*********'+Latval);
           System.debug('*********longitudelongitude*********'+Lonval);
    
        insert visit;
        
        visit = new Sales_Visit__c();
        return null;
    }
}
Hi All,

I am new Salesforce Lightning experience. I am trying to call an external JavaScript by loading it as a Static resource and calling it in my Lightning application using the following syntax but I am unable to get it work.

<aura:application >
       <ltng:require scripts="{!$Resource.SDFCTestJS}" afterScriptsLoaded="{!c.afterScriptsLoaded}"/>
</aura:application>

Please suggest how can I get it work.

P.S : I read a solution that we can load Javascript by creating a Helper class and call it from our Component. Can anyone suggest a way so that I don't need to create helper everytime I call a component as I am going to have many; a way that I can include the JS directly from the above.

Thanks in advance.

Warm Regards,
Shubham
SFDC
 

HI ALl,

I have a requirement with Salesforce with Amazon server with S3 Integration. I need to upload the files and same time download the files or URL of file form Amazon to  Salesforce.

I have uploaded the file using PUT method. Response i m receiving is like only [Status=OK and Statuscode=200] successful
but i m not getting any other things like uploadid or URL of the file.

i need URL of the File uploaded in Salesforce. Help me out from this

Thanks,

Reddy

Hi all,

 

How many users you can create in Unlimited Edition?

 

Please help me....

 

Thanks for u r help.....

How can I write a SOQL query to ID the opportunity contact roles where the contact account doesn't equal the opportunity account?  I'm trying to clean up the opportunity contact roles that were migrated in from another CRM and associated to the wrong opportunity.
Hi All,
 i want to integrate google hangout with salesforce.i have tried the steps given in google hangout documentation 
but its not working .please help.

thanks in advance.
Hi All,

I am new Salesforce Lightning experience. I am trying to call an external JavaScript by loading it as a Static resource and calling it in my Lightning application using the following syntax but I am unable to get it work.

<aura:application >
       <ltng:require scripts="{!$Resource.SDFCTestJS}" afterScriptsLoaded="{!c.afterScriptsLoaded}"/>
</aura:application>

Please suggest how can I get it work.

P.S : I read a solution that we can load Javascript by creating a Helper class and call it from our Component. Can anyone suggest a way so that I don't need to create helper everytime I call a component as I am going to have many; a way that I can include the JS directly from the above.

Thanks in advance.

Warm Regards,
Shubham
SFDC
 
Hi Guys,
I was integrating Instagram  with Salesforce,and getting access_tokek in url like this

https://c.ap2.visual.force.com/apex/instaIntegration#access_token=6394********83e.**********8af6330377c35d316

i dont know how to get the access token attached with'#'

Thanks
hi guys i created a vf page,in which im getting the customer's signature on canvas, and saving that page as pdf in the realted list of attachment,
but problem is that the signature is not visible in pdf look into my code 

vf page

<apex:page controller="upl1" SHowHeader="false" sidebar="false" standardStylesheets="false" >
    
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <apex:stylesheet value="{!URLFOR($Resource.bootstrap,'bootstrap-3.3.6-dist/css/bootstrap.min.css')}"/>
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"/>
    <apex:includeScript value="{!URLFOR($Resource.bootstrap,'bootstrap-3.3.6-dist/js/bootstrap.min.js')}"/>
    
    </head>
        

    <body>  
            <div class="well well-lg text-center"><h1>Invoice</h1></div>
        
            <apex:form id="pbform">
          <apex:pageMessages />
          <div class="container1">
           <h1 class="labelCol vfLabelColTextWrap ">Record Signature:</h1>
           <canvas id="signatureCanvas" height="100px" width="350px" style="border: 3px solid antiquewhite; border-radius: 8px;" ></canvas>
          </div><br/>
          
          <div style="margin-left: 41%;">
           <apex:commandButton value="Save Signature" onclick="saveSignature();return false;" styleClass="button1"/>&nbsp;&nbsp;&nbsp;
           <apex:commandButton value="Clear" onclick="clearSign();return false;" styleClass="button1"/>
          </div>
       </apex:form>
       
        
        <apex:form >
            <apex:pageBlock >
                <apex:pageblockTable value="{!inv}" var="v" styleclass="table table-hover table table-box">
                    <apex:column headerValue="Product name">
                        <apex:outputField value="{!v.name}"/>
                    </apex:column>
                    <apex:column headerValue="Price">
                        <apex:outputField value="{!v.price__c}"/>
                    </apex:column>
                    <apex:column headerValue="Quantity">
                        <apex:outputField value="{!v.quantity__c}"/>
                    </apex:column>
                    <apex:column headerValue="Total">
                        <apex:outputField value="{!v.total_amount__c}"/>
                    </apex:column>
                </apex:pageblockTable>
            </apex:pageBlock>
            <div style="margin-left: 41%;">
            <apex:commandButton value="Generate pdf" action="{!gpdf}" styleClass="button1"/>
            </div>
        </apex:form>
    
    </body>
    <script>
  var canvas;
  var context;
  var drawingUtil;
  var isDrawing = false;
  var accountId = '';
  var prevX, prevY, currX, currY = 0;
  var accountId;

   function DrawingUtil() {
   isDrawing = false;
   canvas.addEventListener("mousedown", start, false);
   canvas.addEventListener("mousemove", draw, false);
   canvas.addEventListener("mouseup", stop, false);
   canvas.addEventListener("mouseout", stop, false);
   canvas.addEventListener("touchstart", start, false);
   canvas.addEventListener("touchmove", draw, false);
   canvas.addEventListener("touchend", stop, false);
   w = canvas.width;
      h = canvas.height;
  }

   function start(event) {
   event.preventDefault();
   
   isDrawing = true;
   prevX = currX;
   prevX = currY;
   currX = event.clientX - canvas.offsetLeft;
   currY = event.clientY - canvas.offsetTop;
   
   context.beginPath();
   context.fillStyle = "cadetblue";
   context.fillRect(currX, currY, 2, 2);
            context.closePath();
   
  }

   function draw(event) {
   event.preventDefault();
   if (isDrawing) {
    prevX = currX;
             prevY = currY;
             currX = event.clientX - canvas.offsetLeft;
             currY = event.clientY - canvas.offsetTop;
    context.beginPath();
    context.moveTo(prevX, prevY);
    context.lineTo(currX, currY);
    context.strokeStyle = "cadetblue";
    context.lineWidth = "2";
    context.stroke();
    context.closePath();
   }
  }

   function stop(event) {
   if (isDrawing) {
    context.stroke();
    context.closePath();
    isDrawing = false;
   }
  }
  
  function clearSign() {
   context.clearRect(0,0,w,h);
  }

   canvas = document.getElementById("signatureCanvas");
  context = canvas.getContext("2d");
  context.strokeStyle = "black";
  context.lineWidth = "2";
  drawingUtil = new DrawingUtil(canvas);
  

   function saveSignature() {
   var strDataURI = canvas.toDataURL();
   strDataURI = strDataURI.replace(/^data:image\/(png|jpg);base64,/, "");
   var accId = location.href.split('=')[1];
   accountId = accId;
   var result = CaptureSignatureController.saveSignature(strDataURI, accId, processResult);
  }

   function processResult(result) {
   alert(JSON.stringify(result));
   window.location.href = '/'+accountId;
  }

  </script>
  
  <style>
  .container1 {
   text-align: center;
   font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
   color: cadetblue;
   font-weight: 500;
   font-size: 14px;
  }
  
  .button1 {
   font-family: calibri;
   border-radius: 8px;
   background-color: rgb(51, 116, 116);
   height: 36px;
   color: azure;
   font-size: 17px;
   border-width: 0px;
   width: 116px;
  }
 </style>   
</apex:page>


controller


global with sharing class upl1 
{
    public List<cart__c> inv{get;set;}
    Id id;
    
    global upl1()
    {
        id=ApexPages.currentPage().getParameters().get('cid');
        inv=new List<cart__c>();
        inv=[select name,type__c,price__c,quantity__c,total_amount__c from cart__c where consumer__c=:id];
        
        
    }
    global static String saveSignature(String imageUrl, String accountId) 
 {
  
      try 
      {
       Attachment accSign = new Attachment();
       accSign.ParentID = accountId;
       accSign.Body = EncodingUtil.base64Decode(imageUrl);
       accSign.contentType = 'image/png';
       accSign.Name = 'Signature Image';
       accSign.OwnerId = UserInfo.getUserId();
       insert accSign;
       
       return 'success';
       
      }
      catch(Exception e)
      {
       system.debug('---------- ' + e.getMessage());
       return JSON.serialize(e.getMessage());
      }
  return null; 
 }
   
 
    public String rt{get;set;}
    public PageReference gpdf()
    {
       rt='pdf';
       attach();
        PageReference reRend2 = new PageReference('https://ap2.salesforce.com/'+id);
                                  reRend2.setRedirect(true);
                                   return reRend2;  
    }
    public void attach() 
        {
        Attachment myAttach = new Attachment();
        myAttach.ParentId = id;//Id of the object to which the page is attached
        myAttach.name = 'inv.name.pdf';
        PageReference myPdf = Page.task7i;//myPdfPage is the name of your pdf page
        myAttach.body = myPdf.getContentAsPdf();
        insert myAttach;
        
        }

}User-added image


User-added image