• ram @SFDC
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
global class sendCred{
        public String userName;
        public String userPassword;
        public sendCred(String userName, String userPassword){
            this.userName = userName;
            this.userPassword = userPassword;
        }
    }
    /*==============================*/
    @RemoteAction global static String sendCredentials() {
                
        try{
        User userRec = [select id, Nextiva_Username__c, Nextiva_Password__c from User where id =: userinfo.getuserid()];
             String userName = String.ValueOf(userRec.Nextiva_Username__c);
             String userPassword = String.ValueOf(userRec.Nextiva_Password__c);
             return new sendCred(userName, userPassword);
        } catch(Exception ex){
            return ex.getMessage();
        }
        
    }
I am using above code but getting "Error: Compile Error: Illegal conversion from SoftPhoneDialController.sendCred to String at line 282 column 14" . Please help me on this
 Hi,
I need a solution for below requirement, i tried but i am not getting proper result. Please help me on this.

1. if list returns == account, case, opportunity, contracts, idea, product, order, solution, campaign
     order should be    account, case, opportunity, remaining all are in alphabetical order.
2. if list returns == account, opportunity, contracts, idea, product, order, solution, campaign
 order should be        account, opportunity, remaining all are in alphabetical order.
3. if list returns == case, opportunity, contracts, idea, product, order, solution, campaign
 order should be       case, opportunity, remaining all are in alphabetical order.
4. if list returns == account, case, contracts, idea, product, order, solution, campaign
 order should be       account, case, remaining all are in alphabetical order.
5. etc
how we achieve this
<li><apex:outputLink value="{!URLFOR($Action.Account.New, 0127F000000K0EU)}" >New Account</apex:outputLink></li>

i am using this link for creating a new account. but it is skipping record type selection. How it will navigate to the record type selection page and it should work in both classic and lightning.
global class sendCred{
        public String userName;
        public String userPassword;
        public sendCred(String userName, String userPassword){
            this.userName = userName;
            this.userPassword = userPassword;
        }
    }
    /*==============================*/
    @RemoteAction global static String sendCredentials() {
                
        try{
        User userRec = [select id, Nextiva_Username__c, Nextiva_Password__c from User where id =: userinfo.getuserid()];
             String userName = String.ValueOf(userRec.Nextiva_Username__c);
             String userPassword = String.ValueOf(userRec.Nextiva_Password__c);
             return new sendCred(userName, userPassword);
        } catch(Exception ex){
            return ex.getMessage();
        }
        
    }
I am using above code but getting "Error: Compile Error: Illegal conversion from SoftPhoneDialController.sendCred to String at line 282 column 14" . Please help me on this
Hi Everyone,
           I have this apex rest web service , that returns the parametres of record when an external application sends the Id through the URL.

Apex Class:
@RestResource(urlMapping='/v1/cans/*')
global with sharing class MyRestResource {
    @HttpGet
    global static CanWrapper doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        CanWrapper response= new CanWrapper();
        String CanId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        List<CAN__c> result = [SELECT Awarded_Project__c, Opportunity__r.Proposal__c,Opportunity__r.Account.Name, Opportunity__r.Master_IDIQ_Project__c FROM CAN__c WHERE Id = :CanId];
        if(result.size()>0){
            response.canrecord=result[0];
            response.status='Success';
            response.message='Callout Sucess';
        }
        else{
            response.status='Fail';
            response.message='No Record Found';        
        }
        return response;
        
    }
    global class CanWrapper {
          public CAN__c canrecord;
          public String status;
          public String message;
    }
}

Apex Test
@isTest
private class Test_MyRestResource{



  static testMethod void testDoGet() {

    RestRequest req = new RestRequest(); 
    RestResponse res = new RestResponse();

    req.requestURI = 'https://cs11.salesforce.com/services/apexrest/v1/cans/'+'a0DZ000000V5SjqMAF';  
    req.httpMethod = 'GET';
    RestContext.request = req;
    RestContext.response = res;
    Test.startTest();
    MyRestResource.CanWrapper results = MyRestResource.doGet();
    Test.stopTest();

    System.assertEquals('Success', results.status);
    System.assertEquals('Callout Sucess', results.message);

  }

}


Even though I am giving a legit Id in my test class , it is not returning a record. It is returning null  and the method fails. Because of that if(result.size()>0)  condition is not getting evaluated to True. Can anyone please help me with this???


Thanks a lot for your time

Shrey Tyagi