APEX:从内部pbx集成到Salesforce

我希望在Salesforce中为AppExchange创建一个应用 目的是登录到我的PBX并启用click_and_dial 其实我有这段代码:

<apex:page standardController="Contact" extensions="ClickAndDial" action="{!clickAndDial}">
    <apex:form >
        <apex:inputHidden value="{!contact.Id}"/>
        <apex:inputHidden value="{!contact.Phone}"/>
    </apex:form>
</apex:page>`
public  class ClickAndDial {
    public String Phone {get; set;}
    public Id Id { get; set; }
    public Contact contact { get; set; }
    public ClickAndDial(ApexPages.StandardController controller) {
        contact =  (Contact) controller.getRecord();
        Id = contact.Id;
        System.debug('The case record: ' + contact);
        Phone = contact.Phone;
    }

    ....

    public PageReference clickAndDial() {
        PageReference pageRef = new PageReference('/' + Id);
        HTTPRequest loginRequest = new HTTPRequest();
        loginRequest.setEndpoint('callout:SalesforceNC/services/data/v32.0');
        System.debug('Case Owner: ' + Phone);
        System.debug('Case Id: ' + Id);
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setMethod('POST');`
      request.setEndpoint('https://somendpoint');
        request.setHeader('Content-Type','application/x-www-form-urlencoded'); 
        String payload = 'token=' + EncodingUtil.urlEncode('pbx_login_token','UTF-8') + '&data='+EncodingUtil.urlEncode('my_data','UTF-8');
        request.setBody(payload);
        HttpResponse response = http.send(request);
        return pageRef;
    }
}

我需要用户登录令牌才能调用API 如何存储用户的PBX凭据,然后从clickAndDial方法中检索它们,以便在PBX上执行登录?

coder002 回答:APEX:从内部pbx集成到Salesforce

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3151664.html

大家都在问