+ Start a Discussion
Bhushan burujwaleBhushan burujwale 

soap api to update the isfrozen attribute

Hi Team,

Can you please let me know how I can update the isFrozen attribute using soap API ?
Salesforce DeveloperSalesforce Developer
You can use Force.com Web Services Connector to utilize SOAP API with Java application : https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector

Sample code from Java application to freeze a user:

SObject[] records = new SObject[5];

QueryResult queryResults = connection.query("SELECT Id, IsFrozen FROM UserLogin WHERE UserId ='sampleuserid' limit 1");
      if (queryResults.getSize() > 0) {
        for (int i=0;i<queryResults.getRecords().length;i++) {
          // cast the SObject to a strongly-typed Account
          UserLogin a = (UserLogin)queryResults.getRecords()[i];
          a.setField("isFrozen","TRUE");
          records[i] = a;
        }
      }
      
      // update the records in Salesforce.com
      SaveResult[] saveResults = connection.update(records);

 
Bhushan burujwaleBhushan burujwale
Thanks for the update.
We are using partner WSDL, so we set the type of object we update. We dont have possibility to type cast it
Can you please provide me the sample code for partner WSDL

soUpdate.setType("???????");
soUpdate.setField("?????", "TRUE");
Salesforce DeveloperSalesforce Developer
What error you get if you set this to : 
soUpdate.setType("UserLogin");
soUpdate.setField("isFrozen", "TRUE");