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

How do i got return value from APEX Class???
Hello,
I m using APEX Class for Check my login form inputs..
Basically I m passing my Username, Password via function from aspnet page. In apex class following coding i m using... when after process this coding ( Username password is match retuen true, or false).. but I got a error when save this Apex Class...
How do I perform my login Username and Password is correct ? If Correct/wrong how do i return the value to asp.net page????
APEX Code
I m using APEX Class for Check my login form inputs..
Basically I m passing my Username, Password via function from aspnet page. In apex class following coding i m using... when after process this coding ( Username password is match retuen true, or false).. but I got a error when save this Apex Class...
How do I perform my login Username and Password is correct ? If Correct/wrong how do i return the value to asp.net page????
APEX Code
global class getLoginCheck{ WebService static Lead getLoginCheckFromusername(string username,string password) { Contact r=[SELECT Count() from Contact WHERE Firstname = :username]; Integer result = 0; if(r=0) { result = 0; } return result ; } }
aspx.cs
getLoginInfo.Lead getLoginInfoFromUsername = getLoginInfoObj.getLoginCheckFromusername(txtUsername.text,txtPassword.text);
// Dropdown list name is ddlUsername
/**** How do I get return value from return fucnction from Apex Code and how to bind the all the retrn data's to dropdown list ****/
Try this
global class getLoginCheck{
WebService static boolean getLoginCheckFromusername(string username,string password) {
List<Contact> r=[SELECT Id from Contact WHERE Firstname = :username];
return r.size() < 0 ? false : true;
}
}
All Answers
try this
global class getLoginCheck{
WebService static boolean getLoginCheckFromusername(string username,string password) {
list<Contact> r=[SELECT Count() from Contact WHERE Firstname = :username];
return r.isEmpty ? false : true;
}
}
but i think this apex class needs to return a lead object to your .NET application...but as u are querying contact how can u get the lead?
When I m using your code...i
global class getLoginCheck{
WebService static boolean getLoginCheckFromusername(string username,string password) {
List<Contact> r=[SELECT Count() from Contact WHERE Firstname = :username];
return r.isEmpty ? false : true;
}
}
i got a error
Error: Compile Error: Illegal assignment from Integer to LIST<Contact> at line 5 column 1
Try this
global class getLoginCheck{
WebService static boolean getLoginCheckFromusername(string username,string password) {
List<Contact> r=[SELECT Id from Contact WHERE Firstname = :username];
return r.size() < 0 ? false : true;
}
}