You need to sign in to do that
Don't have an account?
Narinder Singh 1
Illegal assignment from List<RecordType> to String
I am getting this error on the following code
What am I doing wrong?
String recordTypeName = [Select Name from RecordType where Id=:theCase.recordTypeId and SObjectType = 'Case' limit 1]];
What am I doing wrong?
Please try this:
String recordTypeName = [Select Name from RecordType where Id=:
theCase.recordTypeId and SObjectType = 'Case' limit 1][0].name;
Thanks,
Pratik
All Answers
You are assigning object to string that is why it is giving you an error.
Try this
String recordTypeName =[Select Name from RecordType where Id=:theCase.recordTypeId and SObjectType = 'Case' limit 1].name;
Please mark this as Best Answer if it helps you and let me know if you are still finding any issue in this.
Please try this:
String recordTypeName = [Select Name from RecordType where Id=:
theCase.recordTypeId and SObjectType = 'Case' limit 1][0].name;
Thanks,
Pratik
Thanks,
Pratik
public class UtraceHttp {
public String result {set;get;}
public String ipAddress {set;get;}
public String statuscode {set;get;}
public String status {set;get;}
Public Map<String,String> xmlMap{set;get;}
public void submit(){
Http p = new Http();
HttpRequest req= new HttpRequest();
req.setEndpoint('https://xml.utrace.de/?query='+ipAddress);
req.setMethod('Get');
HttpResponse res= p.send(req);
result=res.getBody();
statusCode= res.getStatusCode();
status=res.getStatus();
Dom.Document doc= New Dom.Document();
doc.load(result);
DOM.XMLNode root= doc.getRootElement();
for(DOM.XMLNode Chaild:root.getChildElements())
{
for(DOM.XMLNode v:chaild.getChildElements())
{
xmlMap.put(v.getname(),v.gettext());
}
}
}
}