• #29848

    What are the properties inside LoginScopeHeader in Salesforce?

    What are the properties inside LoginScopeHeader in Salesforce?

    Tagged: , , ,


    Hello Madhulika,

    The properties inside the LoginScopeHeader element concern the authentication of Self-Service and Customer Portal users. It specifies your organization ID using the existing login().

    There are two fields inside the LoginScopeHeader:-

    1.  organizationId – The ID of the organization against which you will authenticate Self-Service users.
    2.  portalId – Specify only if user is a Customer Portal user. The ID of the portal for this organization. The ID is available in the Salesforce user interface:
      a. From Setup, enter Customer Portal Settings in the Quick Find box, then select Customer Portal Settings
      b. Select a Customer Portal name, and on the Customer Portal detail page, the URL of the Customer Portal displays. The Portal ID is in the URL.


    Salesforce | shariq shariq #1


    Specifies your organization ID so that you can authenticate Self-Service users for your organization using the existing login().

    Example –

    /// Demonstrates how to set the LoginScopeHeader values.
    public void LoginScopeHeaderSample()
    // Web Reference to the imported Partner WSDL.
    APISamples.partner.SforceService partnerBinding;

    string username = “USERNAME”;
    string password = “PASSWORD”;

    // The real Client ID will be an API Token provided by salesforce.com
    // to partner applications following a security review. For more details,
    // see the Security Review FAQ in the online help.
    string clientId = “SampleCaseSensitiveToken/100”;

    partnerBinding = new SforceService();
    partnerBinding.CallOptionsValue = new CallOptions();
    partnerBinding.CallOptionsValue.client = clientId;

    // To authenticate Self-Service users, we need to set the OrganizationId
    // in the LoginScopeHeader.
    string orgId = “00ID0000OrgFoo”;
    partnerBinding.LoginScopeHeaderValue = new LoginScopeHeader();
    partnerBinding.LoginScopeHeaderValue.organizationId = orgId;
    // Specify the Portal ID if the user is a Customer Portal user.
    string portalId = “00ID0000FooPtl”;
    partnerBinding.LoginScopeHeaderValue.portalId = portalId;

    APISamples.partner.LoginResult lr =
    partnerBinding.login(username, password);
    catch (SoapException e)

    Hope this helps.

Viewing 3 posts - 1 through 3 (of 3 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?