3

I have created a mobile app in Android and iOS using the Salesforce SDK. I want to add functionality of multi currency by using isMultiCurrencyOrganization() method from the UserInfo class. Now I am quite new to Salesforce mobile SDK so I don't know how I can use the methods of UserInfo class and check if user's organization has multi-currency enabled.

1 Answer 1

2

The only way I know of doing this is to use the SOAP API. You would concatenate strings to create the request - for example:

String req = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:enterprise.soap.sforce.com\">"+
"  <soapenv:Header>"+
"     <urn:SessionHeader>"+
"        <urn:sessionId>"+client.getAuthToken()+"</urn:sessionId>"+
"     </urn:SessionHeader>"+
"  </soapenv:Header>"+
"  <soapenv:Body>"+
"     <urn:getUserInfo />"+
"  </soapenv:Body>"+
"</soapenv:Envelope>";

POSTing this request to client.getInstanceUrlAsString()+"/services/Soap/c/31.0/"+client.getClientInfo().orgId would result in a response like:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="<a rel="nofollow" class="external free" href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>"
  xmlns="urn:enterprise.soap.sforce.com">
  <soapenv:Body>
     <getUserInfoResponse>
        <result>
           <accessibilityMode>false</accessibilityMode>
           <currencySymbol>$</currencySymbol>
           <organizationId>00DD0000000EEW9MAO</organizationId>
           <organizationMultiCurrency>false</organizationMultiCurrency>
           <organizationName>Acme</organizationName>
           <profileId>00eD0000000v3qnIAA</profileId>
           <roleId xsi:nil="true"/>
           <userDefaultCurrencyIsoCode xsi:nil="true"/>
           <userEmail>[email protected]</userEmail>
           <userFullName>John Smith</userFullName>
           <userId>005D0000000nWYVIA2</userId>
           <userLanguage>en_US</userLanguage>
           <userLocale>en_US</userLocale>
           <userName>[email protected]</userName>
           <userTimeZone>America/Los_Angeles</userTimeZone>
           <userType>Standard</userType>
           <userUiSkin>Theme2</userUiSkin>
        </result>
     </getUserInfoResponse>
  </soapenv:Body>
</soapenv:Envelope>

You would need to parse the value for organizationMultiCurrency out of that XML.

7
  • I imported com.salesforce.androidsdk.rest.RestClient.ClientInfo but the method client.getInstanceUrlAsString() is not available. Any suggestions on this would be really helpful Oct 12, 2014 at 9:24
  • Do you maybe need to get a more recent version? I see it in the docs: forcedotcom.github.io/SalesforceMobileSDK-Android/com/…
    – metadaddy
    Oct 17, 2014 at 17:43
  • Hi I managed to get client.getInstanceUrlAsString() working. But the Soap url returns GET not supported. HTTP ERROR 405. Could you please tell me how to find the SOAP API version. Oct 20, 2014 at 11:41
  • Use POST, as I said in the answer.
    – metadaddy
    Oct 20, 2014 at 15:47
  • Sorry for troubling again...I've solved the above issues, but using POST method, I get an HTTPFileNotFound exception. Any clues? Oct 21, 2014 at 8:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .