• Patrick Thai
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
In some part of our salesforce app, we require the user to confirm his password. We create a VF component that would call the following login() method (I think we pick this code from the web):
public static String buildSoapLogin(String username, String password){
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartElement('', 'login', 'urn:partner.soap.sforce.com');
        w.writeNamespace('', 'urn:partner.soap.sforce.com');
        w.writeStartElement('', 'username', 'urn:partner.soap.sforce.com');
        w.writeCharacters(username);
        w.writeEndElement();
        w.writeStartElement('', 'password', 'urn:partner.soap.sforce.com');
        w.writeCharacters(password);
        w.writeEndElement();
        w.writeEndElement();
        String xmlOutput ='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body>'
                    + w.getXmlString()
                    + '</Body></Envelope>';
        return xmlOutput;
    }
    
    public static Boolean login(String password) {
        HttpRequest request = new HttpRequest();
        String loginServer = (URL.getSalesforceBaseUrl().getHost().contains('cs') ? 'test' : 'login');
        request.setEndpoint('https://' + loginServer + '.salesforce.com/services/Soap/u/22.0');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
        request.setHeader('SOAPAction', '""');
        request.setBody(buildSoapLogin(UserInfo.getUserName(),password));
        
        if(Test.isRunningTest()) {
            if(password == 'password')
                return true;
            else
                return false;
        } else {
            return (new Http()).send(request).getBodyDocument().getRootElement()
              .getChildElement('Body','http://schemas.xmlsoap.org/soap/envelope/')
              .getChildElement('loginResponse','urn:partner.soap.sforce.com') != null;
        }
    }

To avoid needing the security token, we whitelisted all the ARIN, RIPE, APNIC IP addresses in the Network Access setup as described o, this Knowledge Article. But login may still fail. When checking the User login History we can read the following:
  • 2/3/2017 10:08:16 AM CET    Salesforce.com IP    Other Apex API    Failed: API security token required    N/A    test.salesforce.com
  • 2/3/2017 10:05:16 AM CET    136.146.210.252    Other Apex API    Success    N/A    test.salesforce.com    United States
The second IP addresse is part of the ARIN address ranges, so the login is succesful. But we don't know why the "Salesforce.com IP" case fails and we don't have any mean to know what is the actual IP address behind this label. Is there a hidden list of salesforce IP addresses?

 
Hello,

I would like to build a list of articles in Apex/Visualforce and display information about the Article assignment. But when I checked  the Knowledge Article and Knowledge Article Version schema, I found and indirect way to know the "Assigned To" User, by checking the ProcessInstances of the KnowledgeArticle. But I couldn't find a way to retrieve the Due Date and the Instructions.

Is there anyway to access to those fields ?

Thanks to anyone who could help.
In some part of our salesforce app, we require the user to confirm his password. We create a VF component that would call the following login() method (I think we pick this code from the web):
public static String buildSoapLogin(String username, String password){
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartElement('', 'login', 'urn:partner.soap.sforce.com');
        w.writeNamespace('', 'urn:partner.soap.sforce.com');
        w.writeStartElement('', 'username', 'urn:partner.soap.sforce.com');
        w.writeCharacters(username);
        w.writeEndElement();
        w.writeStartElement('', 'password', 'urn:partner.soap.sforce.com');
        w.writeCharacters(password);
        w.writeEndElement();
        w.writeEndElement();
        String xmlOutput ='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body>'
                    + w.getXmlString()
                    + '</Body></Envelope>';
        return xmlOutput;
    }
    
    public static Boolean login(String password) {
        HttpRequest request = new HttpRequest();
        String loginServer = (URL.getSalesforceBaseUrl().getHost().contains('cs') ? 'test' : 'login');
        request.setEndpoint('https://' + loginServer + '.salesforce.com/services/Soap/u/22.0');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
        request.setHeader('SOAPAction', '""');
        request.setBody(buildSoapLogin(UserInfo.getUserName(),password));
        
        if(Test.isRunningTest()) {
            if(password == 'password')
                return true;
            else
                return false;
        } else {
            return (new Http()).send(request).getBodyDocument().getRootElement()
              .getChildElement('Body','http://schemas.xmlsoap.org/soap/envelope/')
              .getChildElement('loginResponse','urn:partner.soap.sforce.com') != null;
        }
    }

To avoid needing the security token, we whitelisted all the ARIN, RIPE, APNIC IP addresses in the Network Access setup as described o, this Knowledge Article. But login may still fail. When checking the User login History we can read the following:
  • 2/3/2017 10:08:16 AM CET    Salesforce.com IP    Other Apex API    Failed: API security token required    N/A    test.salesforce.com
  • 2/3/2017 10:05:16 AM CET    136.146.210.252    Other Apex API    Success    N/A    test.salesforce.com    United States
The second IP addresse is part of the ARIN address ranges, so the login is succesful. But we don't know why the "Salesforce.com IP" case fails and we don't have any mean to know what is the actual IP address behind this label. Is there a hidden list of salesforce IP addresses?

 
Hello,

I would like to build a list of articles in Apex/Visualforce and display information about the Article assignment. But when I checked  the Knowledge Article and Knowledge Article Version schema, I found and indirect way to know the "Assigned To" User, by checking the ProcessInstances of the KnowledgeArticle. But I couldn't find a way to retrieve the Due Date and the Instructions.

Is there anyway to access to those fields ?

Thanks to anyone who could help.

We have a project to move some of our paper processes to electronic processes

We've gotten the Salesforce white paper on the topic and still have some questions

 

Namely, how did you enforce the e-signature?

Do you have users re-authenticate when approving?

Do you use a component or third party to process e-signatures?

What kind of timeline and cost was associated with deploying that?

 

There are other interpretation questions, but the big hurdle (as I see it) is the electronic signature