You need to sign in to do that
Don't have an account?

Getting illegal conversion error in Wrapper class
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
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 Ram,
As per your method signature you are returning String from the method.
@RemoteAction global static String sendCredentials()
but in your return statement your returning SendCred object. The error message says you cannot do that.
return new sendCred(userName, userPassword);
Ensure that your method return type and return statement both return the same thing.
All Answers
Hi Ram,
As per your method signature you are returning String from the method.
@RemoteAction global static String sendCredentials()
but in your return statement your returning SendCred object. The error message says you cannot do that.
return new sendCred(userName, userPassword);
Ensure that your method return type and return statement both return the same thing.