+ Start a Discussion
Ad_InfosysAd_Infosys 

Passing parameters from Scontrol to Web service in SFDC

HI, I implemented the method to pass parameters from SControl to SFDC.

Still I am facing error. My web service is:

global class DTCTest1 {
global class StatusDetail{
webservice String Zip;
webservice String Occupancy;
webservice String Property;
webservice String Grade;
webservice String MaxLoan; }
WebService static String DTC(StatusDetail sd) {
 ZIP_Status_Mapping__c Zsp=[select Status__C from ZIP_Status_Mapping__c where Name =: sd.Zip];
String Cltv=[select Max_CLTV__c from Status_Details__c where ((Occupancy_Type__c =: sd.Occupancy) and (Property_Type__c =: sd.Property) and (Credit_Grade__c =: sd.Grade) and (Max_Loan_Line__c =: sd.MaxLoan)and (Market__C =: Zsp.Status__C))].Max_CLTV__c;
return Cltv;
}

My scontrol has following section.
 
var nr = new sforce.Xml("StatusDetail");
nr.zip = '{!TestScreen__c.Zip__c}';
nr.oc= '{!TestScreen__c.Occupancy__c}';
nr.pro= '{!TestScreen__c.Property__c}';
nr.gra= '{!TestScreen__c.Grade__c}';
nr.max= '{!TestScreen__c.Maxloan__c}';
var result = sforce.apex.execute('DTCTest1' ,'DTC',{sd:nr });
 
I am facin error in retrieving the result. Seems I am not able to send the parameters. Kindly help on this.
 
Thanks in Advance
cheenathcheenath
What is the error?

var nr = new sforce.Xml("StatusDetail");
nr.zip = '{!TestScreen__c.Zip__c}';
nr.oc= '{!TestScreen__c.Occupancy__c}';
nr.pro= '{!TestScreen__c.Property__c}';

You have to use the variable name while assigning the fields.
so instead of

nr.oc

you have to use:

nr.Occupancy

and so on.


Ad_InfosysAd_Infosys
Hey Thanks so much dear!!
hattihatti

HI could you please tell me how to pass a list of wrapper to the webservice. The following is not working var smap1 = new sforce.Xml("inner class[]"); It gives invalid constructor.