+ Start a Discussion
ARUN JOYARUN JOY 
Hi ,I created a sharing rule for one of the custom object, and given read write access to role.Now when I tried to login on the behalf of that user , its not allowing to edit the record.CRED settings are turned on  .Its allowing me to read but not write
Best Answer chosen by ARUN JOY
RituSharmaRituSharma
It seems that the record is pending approval hence it's locked. If a record is pending for approval, only approver or admins can edit the record.
Nisar AhmedNisar Ahmed 

Hi All,

 

I have a inputText field in a VF page and I need to disable paste function(Ctrl+v and paste using mouse button) so that we need to compulsorily type in the text box instead of just copy pasting.

 

I have tried the following script:

<script>

function DisableCtrlKey(e)
{
    var code = (document.all) ? event.keyCode:e.which;
    // look for CTRL key press
    if (parseInt(code)==17)
    {
        alert("Please re-type your email address");
        window.event.returnValue = false;
    }
}

function DisableRightClick(event)
{
    //For mouse right click
    if (event.button==2)
    {
        alert("Please re-type your email address");       
    }
}

</script>

 and under the VF page:

<apex:inputText id="confirmemail" value="{!email}" onKeyDown="return DisableCtrlKey(event)" onMouseDown="DisableRightClick(event)" </apex:inputText>

 It works fine but I want to implement the same functionality without using alert function.

 

Can anyone please let me know any work around to accomplish the above scenario.

Any help on this will be highly appreciated.

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
tom_patrostom_patros

This is a bit vintage and uses jQuery, but it's a pretty nice reference for disabling copy/paste - http://www.4guysfromrolla.com/articles/060910-1.aspx

Big EarsBig Ears 
Dear all,

We're looking at the various options of using Salesforce mobile (Salesforce1 application, SF1 Browser, Salesforce Classic in the browser) and are finding limitations with each:

Salesforce 1
  • Overriding the "View" action on an SObject appears to have no effect at all in SF1 and the standard page is displayed
  • The lack of ability to override the Edit action and then return to the normal edit page if the override logic requires it
What have people done to fix their existing overrides when they move to SF1?
 
Salesforce Classic in Mobile
  • If you direct to the full Salesforce classic site in mobile (i.e. switching off the "Enable the Salesforce1 mobile browser app" setting), the UIThemeDisplayed variable still seems to think that the user is in SF1
Lightning Experience
  • With Lightning Experience switched on and "Enable the Salesforce1 mobile browser app" switched off, the user cannot log-in on mobile
  • With Lightning Experience switched on and "Enable the Salesforce1 mobile browser app" switched on, the user is directed to SF1, despite Lightning Experience being responsive to different screen sizes, etc.
Does anybody have any advice, answers or workarounds to these questions? It makes mobile development very difficult when the navigation behaviours/capabilities in the desktop and mobile version differ so wildly.

With thanks,
Andy
Best Answer chosen by Big Ears
Big EarsBig Ears
Lightning Experience questions - These are both by design and cannot be overridden
Michael MMichael M 
Why am I getting this error: "Static method cannot be referenced from a non static context: void EMedCalloutsExtension.makePostCallout1(List<Id>)" ?

The error appears when I try to save this test class:
@isTest
private class EmedscalloutTest2 {
     @isTest static void testCallout() {
         date d = date.today();
         lead l = new lead(firstname = 'test', lastname = 'test', patient_dob__c = d);
         insert l;
         list<string> refids = new list<string>();
         refids.add(l.id);
         
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new EmedsCalloutTest());
        
        // Call method to test.
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        EMedCalloutsExtension tw = new EMedCalloutsExtension();
        tw.makePostCallout1(refids);

    }
}


Here is my first test class/method:
@isTest
global class EmedsCalloutTest implements HttpCalloutMock {
    // Implement this interface method
    global HTTPResponse respond(HTTPRequest req) {
        // Optionally, only send a mock response for a specific endpoint
        // and method.
        System.assertEquals('http://example.com/example/test', req.getEndpoint());
        System.assertEquals('GET', req.getMethod());
        
        // Create a fake response
        HttpResponse res = new HttpResponse();
        res.setHeader('Content-Type', 'application/json');
        res.setBody('{"example":"test"}');
        res.setStatusCode(200);
        return res;
    }
}


and my actual code:
trigger  ReferralCreateContact on Lead (after insert, after update) {
if(!Test.isRunningTest()) { 
    if (trigger.isInsert){
     List<string> leadIds = new List<string>();
    for (lead ref : trigger.new){
      if(System.IsBatch() == false && System.isFuture() == false){ 
        if (ref.Epaces_Checked__c != true){
          lead newl = new lead();
          newl.Id = ref.id;
          leadIds.add(newl.id);
        EMedCalloutsExtension.makePostCallout1(leadIds); 
        }
      }}} }
public class EMedCalloutsExtension {
    static string EmedrequestId;
    static string requestStatus;
    
@future(callout = true)
public static void  makePostCallout1(list<id> refIds) {
    
  List <Lead> refs =[Select Id, firstname, lastname, gender__c, patient_dob__c, patient_ssn__c, Epaces_Checked__c, Emed_Request_Id__c, medicaid_id__c, medicare_id__c from Lead where Id in :refIds]; 
     List<lead> refToUpdate = new List<Lead>();      
           for (lead ref : refs){

 //Set up reassignment of static resource string items              
   String ssnReplace; 
           if (ref.Patient_SSN__c != null){
            ssnReplace = ref.Patient_SSN__c.replace('-','');
           }
    String genderLetter;
           if (ref.Gender__c == 'Male'){
               genderLetter = 'M';
           } else if (ref.Gender__c == 'Female'){
               genderLetter = 'F';
           }
           
           String first;
           String second;
           String third;
            String d = String.valueOf(ref.Patient_DOB__c);
           system.debug('***dob string raw: ' + d);
                first = d.substring(0,4);
                second = d.substring(5,7);
                third = d.substring(8,10);
           String dob = first + second + third;
           system.debug('***dob formatted: ' + dob);

 
//REQUEST #1          
      string reqbody;
     StaticResource r =[Select Id,Body from StaticResource where Name='EMedCalloutBody' limit 1];
      reqBody=r.body.toString(); 
     // reqBody=reqBody.replace('{{FirstName}}', ref.firstname);     
     // reqBody=reqBody.replace('{{LastName}}', ref.lastname);  
               if (ref.Medicaid_ID__c != null){
     // reqBody=reqBody.replace('{{MedicaidId}}', ref.medicaid_id__c); 
      reqBody = reqBody.replace('{{residentInfo}}', '{"first_name": "'+ ref.firstname +'", "last_name": "' + ref.lastname +'", "id_type":"MI", "subscriber_id":"' + ref.medicaid_id__c + '"}');             
               } 
               else if (ref.gender__c != null && ref.Patient_DOB__c != null && ref.Patient_SSN__c != null){
                   reqBody = reqBody.replace('{{residentInfo}}', '{"first_name": "'+ ref.firstname +'", "last_name": "' + ref.lastname +'", "gender":"' + genderLetter + '", "birthdate": "' + dob + '", "social_security_number": "' + ssnReplace + '"}');    
               }
       HttpRequest req = new HttpRequest();
           req.setHeader('Content-Type', 'application/json');
                req.setMethod('POST');
                req.setBody(reqBody);
                req.setEndpoint('callout:Emed');
                req.setTimeout(2 * 60 * 1000);
                    system.debug('ENDPOINT: ' + req.getendpoint());
                       system.debug('BODY: '+ req.getBody());
         Http http = new Http();
           HttpResponse response = http.send(req);
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
        } else {
            system.debug(response.getstatuscode());
           System.debug(response.getBody());
             string requestId = response.getbody().substringAfter('"request_id": ').substringBefore(',');
      //      ref.Emed_Request_Id__c = requestId;
            EmedrequestId = requestId;
            

              string reqbodyResp;   
              StaticResource r2 =[Select Id,Body from StaticResource where Name='EmedResponseBody' limit 1];
               reqbodyResp=r2.body.toString();
              reqbodyResp=reqbodyResp.replace('{{requestId}}', EmedrequestId);
               
               HttpRequest req2 = new HttpRequest();
                  req2.setHeader('Content-Type', 'application/json');
                req2.setMethod('POST');
                req2.setBody(reqbodyResp);
                req2.setEndpoint('callout:Emed_Response');
                req2.setTimeout(2 * 60 * 1000);
                        system.debug('ENDPOINT2: ' + req2.getendpoint());
                        system.debug('BODY2: '+ req2.getBody());
                  Http http2 = new Http();
                 HttpResponse response2 = http2.send(req2);
               
        if (response2.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response2.getStatusCode() + ' ' + response2.getStatus());
        } else {
            system.debug(response2.getstatuscode());
           System.debug(response2.getBody());
            Id refId = ref.id;
            // instantiate a new instance of the Queueable class
            EmedFollowupCallout makeAnotherFollowUp = new EmedFollowupCallout(response2.getBody(), refId, requestId);
            // enqueue the job for processing
            ID jobID = System.enqueueJob(makeAnotherFollowUp);

           } 
 
        }
          return;
    } 
}
   
}


 
Best Answer chosen by Michael M
RituSharmaRituSharma
Static methods can not be referenced from a non-static context. makePostCallout1 is a static method of EMedCalloutsExtension class so to call it, you don't need to create an instance of EMedCalloutsExtension class.

Instead of below code:
EMedCalloutsExtension tw = new EMedCalloutsExtension();
tw.makePostCallout1(refids);

Write below code:
EMedCalloutsExtension.makePostCallout1(refids);
SFAdmin5SFAdmin5 

Anyone ever seen this before?  I've got a user attaching a photoshop file and word file to an email from SFDC, but Salesforce puts a .html extension onto the file when sent from Salesforce as an email attachment.  No idea what causes this or how to prevent it.

 

Anyone seen this before?

Best Answer chosen by Admin (Salesforce Developers) 
colemabcolemab

Any attachments over 3 MB will be converted to an HTML link that points to the content servers for salesforce.  said servers will hold the file(s) for 30 days.

 

Please accept this as the solution if this answers your question.

AlasAlas 

What is MVC??

 

I know it as MODEL(objects) VIEW(visualforce) CONTROLLER(apex).

 

 

Why we will call as MVC, and if some one asks what is MVC what definition i can tell.

 

What is the use of MVC architecture??

Best Answer chosen by Admin (Salesforce Developers) 
SamuelDeRyckeSamuelDeRycke

It's a code design pattern that seperates your code into the parts you listed yourself. The use is a better structure of your code, which makes it easier to change and maintain it. With little impact, you should for instance be able to replace the entire view, without changes to the model or controller logic.

 

This is a well established pattern, and there are 1000 articles, blogs, papers, books,video's  about it.   http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller (chek out the references for more info)

Marián ČekanMarián Čekan 
Hi, I am trying to import some sample data into Salesforce using data loader. But after trying to map the fields, all of my "File Column Header" are in one row, so I can only add one "Name" field. It is the same problem as mentioned here: https://developer.salesforce.com/forums/?id=906F0000000BKBAIA4 but I did not manage to success. Any advice please? thanks in advance
Best Answer chosen by Marián Čekan
AnudeepAnudeep (Salesforce Developers) 
Hi Marián - Can you try the solution listed here?
EmilienGuichardEmilienGuichard 
Hi all,

I'm stuck in the Apex Integration Services - Apex SOAP Callouts challenge with the following message "The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.".

Could you please advise ?
Best Answer chosen by EmilienGuichard
Jeff DouglasJeff Douglas
Try changing line #3 in ParkLocator to: 
ParkService.ParksImplPort park = new ParkService.ParksImplPort();
Sorry... it's case sensitive.  :(

If you had entered ParkService originally it would have generated this code in this manner. Not sure if it didn't overwrite these classes or something.

Jeff Douglas
Trailhead Developer Advocate
Caleb Kuester 35Caleb Kuester 35 
Hey guys.

Is this possible?

I understand the significance of converting the Lead record and how crucial the Account record is in the whole purpose for converting Lead records to begin with, but a structure that I am implementing has this requirement.

My solution would be to have a master Account record that would take the place of the created Account record (for the Opportunity and Contact's purposes) and delete the new Account record.

Checking with you guys to see if this is really necessary.

Also, as an aside, if I'm going to be overriding the standard lead conversion button, is there a more declarative approach than the creation of a Visualforce page, or Lightning Component to override?

Thanks in advance!
Best Answer chosen by Caleb Kuester 35
VinayVinay (Salesforce Developers) 
Hi Caleb,

Unfortunately,  This might not be possible and there is no way you can stop Account creation on Lead conversion.

Check below references.

https://trailblazers.salesforce.com/answers?id=9063A000000iQRnQAM
https://salesforce.stackexchange.com/questions/71484/convert-lead-in-salesforce-without-creating-an-account

Thanks,
Rhiannon Athey 3Rhiannon Athey 3 
I was trying to complete a module in Trailhead when I recieved this error.  I did also create a new org and I am still recieving the same error. 

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: UUAIAOQQ
Best Answer chosen by Rhiannon Athey 3
ANUTEJANUTEJ (Salesforce Developers) 
Hi,

For all the Certification and Trailhead Guidance please report it here,

https://trailhead.salesforce.com/en/help?support=home

https://trailhead.salesforce.com/help

So that our trailhead support engineers will look into it and get back to you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Regards,
Salesforce Support.