Skip to main content
I have a method which creates Map<String,Object> by querying a object. I need to pass this value to a future method which has callout. Since callout method does not accept Sobject type as parameter, i need to convert this Map<String,Object> to Map<String,String>. 

Appreciate any insights on this issue

List<SObject> listObjectRecords = database.query('select ' + cusFields + ' from '+ objName + ' WHERE ID = \'' + objId + '\'');

 for(SObject sObj : listForMap) {

Map<String,Object> mapObj = (Map<String,Object>)Json.deserializeUntyped(Json.serialize(sObj));

}

 
4 件の回答
  1. 2015年2月24日 21:10
    Please see below code 

    List<SObject> listObjectRecords = database.query('select ' + cusFields + ' from '+ objName + ' WHERE ID = \'' + objId + '\'');

     for(SObject sObj : listObjectRecords ) {

    Map<String,Object> mapObj = (Map<String,Object>)Json.deserializeUntyped(Json.serialize(sObj));

    }

    listObjectRecords returns me a list which is used to build map<string,object>. Here String is name of the field and Object is value of the field. But i need this as Map<String,String> instead of Map<String,Object>
0/9000