• Surendra nune
  • NEWBIE
  • 64 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 11
    Questions
  • 31
    Replies

Hi,

How do we prevent un-necessary updates on a record?

For example, a User(say A) is owner and creator of a record. There is a visualforce page which updates this record. Can we prevent the Lastmodifieddate from being updated even though there aren't any changes to the record?

Please don't say that you have to query the record, compare the changes and then update the record.

 

I am using IE11 browser. I am using Forcetk.js to for file upload into content version. The script is working fine in Mozilla and Chrome.
But in IE11, I get the below error in Forcetk.js file. Please help if any one faced similar issue.User-added image
Hi,

I am a senior salesforce developer having nearly 4years of experience. I am certified with:
  • Salesforce certified Force.com Developer.
  • Salesforce certified Advanced developer.
  • Salesforce certified Administrator.
  • Salesforce certified Salescloud consultant.
  • Salesforce certified Service cloud consultant.
Request you to please reach out to me at surendranadhnune@gmail.com if there is any requirement.

Thanks and Regards,
Surendranadh Nune
Hi,

I am using standard set controller with querylocator for pagination of records. But the problem with using StandardSetController(querylocator) is that if the vf page is idle for 15 minutes and if we try to paginate the records after 15 minutes, am getting the below exception:
Exception

Going through the documentation provided by salesforce, I came to know that query loctors expire every 15mins. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_querymore_querylocator.htm

So, I thought of using other constructor StandardSetController(List<Sobject). What I wanted to understand is, when do we use StandardSetController(querylocator)?  Can any one explain me with a scenario.


 
Hi,

I am facing a strange issue in IE11. Please see the below code snippet
<apex:page >

<script type="text/javascript">
function load(){ 
 var request;
        if (window.XMLHttpRequest) {
            request = new XMLHttpRequest();
        } 
 
 if(request.upload){
   alert('upload is allowed');
 }
 }
 load();
</script>


<apex:form id="formid">
<apex:actionfunction name="test" action="{!null}" rerender="formid"/> 
</apex:form>

</apex:page>
I dont get alert if I have the below components in my visualforce page.
  • Commandbutton/commandlink/actionfunction with rerender attribute. 
  • Action region.(Not working even if you just use empty action region).
I need this fix for a file upload utility that I have developed. I am using xhr.upload.onprogress to check the progress of uploaded file.
 
xhr.upload.onprogress = function(e) {

}

The utility is working fine with chrome and firefox, but not working in IE11.
I get the below error, when javascript tries to bind the event.

User-added image

Request you to please let me know if any one have faced similar issue and had any work arounds.
 
Hi,

I need to set the CORS headers to an external system from Salesforce using http callouts.

To get the current request URL I know that we use,
 
URL.getSalesforceBaseUrl().toExternalForm()

But I need the url of visualforce page and Site in an apex controller which is not associated to any vf page for setting the cors headers. 
How can I acheive this?


 
What is the exact difference between the following annotations?
  • HttpPut
  • HttpPatch
  • HttpPost
Please explain with examples
Hi,

I have two visualforce pages PageA,PageB and their respective controllers PageActrl, PageBCtrl .
What are the side affects of initialising PageActrl constructor in pageBCtrl?
Hi,

Is there any sample code to send multipart message from salesforce
Hi,

I am trying to ire a request to non salesforce endpoint from salesforce using below code.
 
sforce.connection.remoteFunction({
             url : "url",
           requestHeaders: {"X-Auth-User":"xxxx", 
                               "X-Auth-Key":"xxx"
                              },
           method: "GET",
           onSuccess : function(response) {
                  console.log(response);
              },
           onFailure : function(response) {
                  alert("Failed" + response);
                  console.log(response);
              }
         });
But if i use the above code, I am getting this exception in browser console
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 401 Unauthorized</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /services/proxy. Reason:
<pre>    Unauthorized</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                

</body>
</html>

Please help me how to fix this.
 
Hi,

I am a senior salesforce developer having nearly 4years of experience. I am certified with:
  • Salesforce certified Force.com Developer.
  • Salesforce certified Advanced developer.
  • Salesforce certified Administrator.
  • Salesforce certified Salescloud consultant.
  • Salesforce certified Service cloud consultant.
Request you to please reach out to me at surendranadhnune@gmail.com if there is any requirement.

Thanks and Regards,
Surendranadh Nune
Hi,

I am using standard set controller with querylocator for pagination of records. But the problem with using StandardSetController(querylocator) is that if the vf page is idle for 15 minutes and if we try to paginate the records after 15 minutes, am getting the below exception:
Exception

Going through the documentation provided by salesforce, I came to know that query loctors expire every 15mins. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_querymore_querylocator.htm

So, I thought of using other constructor StandardSetController(List<Sobject). What I wanted to understand is, when do we use StandardSetController(querylocator)?  Can any one explain me with a scenario.


 
Need to connect to Gliffy using Oauth in salesforce. Can anyone please help me regarding this. From where I can start? I have read some information related to this so I understand that I need to create connected up but I am confused. Where I can test this & what is Callback URL,oauth_token.

Please help me.
Hi this is the requiremnt
i have to copy the standard field(Closedate) on opportunities object to custom filed(start_date__c) on Opportunities products object
and opportunities products have another field called enddate where enddate = start_date_c + 1 year + 14 days and also check according for leap year (i.e) leap year may have 1 day extra ​
Please help me with the apex trigger
Created Apex class to show Case Tasks and Case Emails in chronological order on visualforce page. The problem is that I am not able to show fields on visualforce page, not sure where I am going wrong. Any help/pointers would be appreciated

Here is the Apex Class code

global with sharing class CaseEmailExtension {

  private final Case currentCase;

 public CaseEmailExtension(ApexPages.StandardController currentcase) {
    this.currentCase = (Case)currentcase.getRecord();
  }
  
    global class commoncontainer implements Comparable {

    public DateTime createdDate{get;set;}

    public String content{get;set;}
    
    global Integer compareTo(Object compareTo) {
        commoncontainer compareToEmp = (commoncontainer)compareTo;
        if (createddate== compareToEmp.createddate) return 0;
        if (createddate> compareToEmp.createddate) return 1;
        return -1;        
    }
  }

  public List<commoncontainer> getSortcommoncontainer(){
    List <commoncontainer> containerlist = new List<commoncontainer>();
    
    for(EmailMessage emailmsg : getsortEmails())
{
    CommonContainer cc=new CommonContainer();
    cc.createdDate=emailmsg.CreatedDate;
    cc.content='Subject:' + emailmsg.CreatedDate + 'From:' + emailmsg.FromAddress + 'To:' + emailmsg.ToAddress + 'BCC:' + emailmsg.BCCAddress + 'Subject:' + emailmsg.Subject + 'EmailBody:' + emailmsg.TextBody + 'CreatedBy:' + emailmsg.CreatedBy.Name;
    containerList.add(cc);
}

    for(Attachment att: getattachments())
{
    CommonContainer cc=new CommonContainer();
    cc.createdDate=att.CreatedDate;
    cc.content='Name:' + att.Name + 'Created By:' + att.CreatedBy.name;
    containerList.add(cc);
}

    for(Task task: gettask())
{
    CommonContainer cc=new CommonContainer();
    cc.createdDate=task.CreatedDate;
    cc.content='Assigned To:' + task.Who.Name + 'Created By:' + task.CreatedBy.name + 'Status:' + task.Status + 'Priority:' + task.Priority + 'Due Date:' + task.ActivityDate + 'Subject:' + task.Subject + 'Description' + task.Description;
    containerList.add(cc);
}
containerlist.sort(); 
   return containerlist; 
  }

public List<EmailMessage> getSortEmails(){
    List <EmailMessage> sortedEmails = new List<EmailMessage>();
    sortedEmails = [SELECT Id, FromAddress, ToAddress, BCCAddress, CreatedDate, Subject, HasAttachment, Incoming, TextBody, CreatedBy.Name  
            from EmailMessage where ParentId =: currentCase.Id 
            order by MessageDate DESC ];
    return sortedEmails;
  }

public List<Task> getTask() {
    List<Task> Task= new List<Task>();
    Task = [SELECT Id, Priority, Subject, Status, Description, CreatedDate, ActivityDate, CreatedBy.Name,Who.Name
            from Task order by CreatedDate DESC]; 
    return Task;  
  }
}

Here is the Visualforce Page code

<apex:page standardController="Case" showHeader="false" sidebar="false" title="Case Number: {!Case.CaseNumber}" extensions="CaseEmailExtension">
<apex:form >
<apex:pageBlock title="Case Number: {!Case.CaseNumber}">

<apex:pageBlockButtons location="top" >
            <apex:CommandButton value="Print" onclick="javascript:window.print(); return false"/>
            <apex:CommandButton value="Close" onclick="window.close(); return false;"/>
    </apex:pageBlockButtons>

<apex:repeat value="{!sortCommonContainer}" var="cc">

    <apex:pageblock >
    <apex:facet name="header">
        <apex:outputText value="{0,date,dd'.'MM'.'yyyy HH:mm:ss z}" style="font-weight:bold;font-style:italic;font-size:12px;float:left ">
        <apex:param value="{!cc.CreatedDate}" />
        </apex:outputText>
        </apex:facet>
        <td width="100%" align="left">
            <table cellpadding="2px">
                <tr>
                                                
                </tr>
            </table>
        </td>
                
          
        </apex:pageblock>
</apex:repeat>
</apex:form>
</apex:page>
What is the exact difference between the following annotations?
  • HttpPut
  • HttpPatch
  • HttpPost
Please explain with examples
HI Experts,
Requirement: Delete the  contacts with same account name which i am going to create with before insert event..
I have written this code, but it is not working.. please suggest me ..


trigger Delete_Duplicate_Contact_With_same_accountName on Account (Before insert) {
list<contact> con = [select id, lastname from contact];
for(account a : trigger.new){
if(a.name== con.lastname){
delete con;
}
else{
create a
}
}



Thanks and regards,
Anji
 
I need to add a selectlist on the vf page which has less number of picklist values than actual picklist on the object. I need to make the selectlist required and when the value is not selected the error message should display just below the select list as displayed for object fields.
Hi Guys,

I am trying to get the IP Address using apex. It gets me the correct IP's but sometimes its working weired and returning some unknown IP.

I am using X-Salesforce-SIP.. can anybody help on this?

Thanks,
Vetriselvan M
Hi,

This is my trigger and how to write test class for this trigger.

trigger OppProductDelete on OpportunityLineItem (before delete){
Id sysAdminId = [Select Id, Name from Profile where id = '00e90000001qXNbAAM' LIMIT 1].Id;
for (OpportunityLineItem oppProd : trigger.old){
if(UserInfo.getProfileId() ==sysAdminId)
oppProd.addError('This Opp Product may not be deleted');}
}

thanks.
 
Dear Community

I have a couple of apex handler classes which are executed on certain trigger actions. It so comes that the test classes of the individual apex classes do interfere with one another.

So I might have some code executed on an OpportunityLineItem insertion which updates the Opportunity. For the test class i need to create an test opportunity record which will also cause all my triggers on opportunity to run.

All of this is no problem yet. But here it comes: One of my Test classes uses the "System.runAs()" with different users to create test opportunities because depending on the user/profile/permission set assigned to the user, some code might execute differently.
Because this runAs method will create opportunities as different users and I have a trigger on Opportunity which executes a SOQL on the User object, the SOQL itself is executed as the user defined in the runAs method. Now for some unclear reason, I receive an error that there was no record to assign to a variable (see example)
User aUser = [ SELECT Id FROM User WHERE isActive = true AND Profile.Name = 'System Administrator' LIMIT 1 ];

Every user / profile associated with user which could possibly run this query has at least read access to the user object (sharing rules). I don't know if they have default access to the Profile object, but if that would be the problem, I'd expect another error message. The one I receive is the following:

System.QueryException: List has no rows for assignment to SObject

I'd expect an insufficient cross-object access error if Profile.Name would not be available...

Do you have insights on that?

Is there a way to query the names of all test classes that exist in my Org using the  Tooling REST API? 

 

 

Hi All,

 

Did anyone do SagePay Integration using apex? I want to implement it for my client. I got the document from SagePay. The request format is only given in the document. The way to do the encryption and sending the request are not provided over there.

 

Please help me out to complete this.

 

 

Thanks

Raja

Hi.

In the VF I used the date format as YYYY-MM-dd in the 
<apex:outputText value="{0,date,YYYY/MM/dd}">
Before the last week of the year it was OK. When the new year falls in the  last week of Decemeber comes the issue.
For example
2014:
S   M  T  W Th F Sat
28 29 30 31 1   2 3

In the above calendar 1st Jan of 2015 falls in the Thurusday.So when I viewd the records of 28,29,30 of December 2014 It showed as
2015-12-28
2015-12-29
2015-12-30
2015-12-31

After that I came to know that
@"YYYY" is week-based calendar year.
@"yyyy" is ordinary calendar year.
http://realmacsoftware.com/blog/working-with-date-and-time

cheers
suresh