• Alexander Krykun
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 11
    Questions
  • 6
    Replies

I'm trying to use Ip Telephony and integrate Twilio in Salesforce
So now the issue is how to enable click to dial option
I have already have call center configured and embedded iframe is shown up 
 Iframe -its  a visual force page  with button that should enable click to dial option and it have callback that should respons wether all ok or not and pop up  alert wether its enabled or not 
But when I'm clicking on the "enable click to dial" button nothing happens
No phones enabled to be dialed no any alerts, no exaptions in console, so callback event does not invoked

Code mark up
 

<apex:page controller="TwilioClientController" showHeader="false" >
   <script type="text/javascript" src="//static.twilio.com/libs/twiliojs/1.2/twilio.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="/support/api/37.0/interaction.js"></script>
function enableClickToDial() {
    sforce.interaction.cti.enableClickToDial(function (response) {
        if (response.result) {
            alert('Click to dial was enabled.');
        } else {
           alert('Click to dial was not enabled.');
        }
        alert(response.error);
    }
);
}
<button onclick="enableClickToDial();">enable click to dial</button>
</apex:page>

Similar example from open cti api 
https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_enableclicktodial.htm

User-added image

I have the following task 

I have several links on page from which some files must be downloaded
 Presently I don't know  what exactly format it will be. So let's assume it can be anything(.img, .exe, .txt. etc)

So I need to know approaches how to provide downloading all the formats
Can someone please provide me with such  API references or documentation to accomplish that aim

I have 2 org ad I want to provide making calls from one 1 org to another
I have allredy generated wsdl file for my soap webservice 
Original   class  simply looks like

global class SoapTest {
    webservice static String getGreeting() {
        return 'Hi, pal!';
    }
}

My external  call now loooks like:

soapTestParse.SoapTest sp = new soapTestParse.SoapTest();
String output = sp.getGreeting();
System.debug(output);

as a result I'mI getting 

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session faultcode=sf:INVALID_SESSION_ID faultactor=


I have been reading bunch of posts with the same problem but I still don't know the proper way to solve it

I saw such snippets of code 

in developer guide:

stub.inputHttpHeaders_x.put('Authorization', 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==');
 

but How can I dynamically get this token? Even if I hard code session id of target org, error remains the same.

In another poste

partnerSoapSforceCom.LoginResult partnerLoginResult = myPartnerSoap.login('karnashiva@cognizant.com.dev', 'Password123'); 
soapSforceComSchemasClassAccountins.SessionHeader_element webserviceSessionHeader = new soapSforceComSchemasClassAccountins.SessionHeader_element(); 
webserviceSessionHeader.sessionId = partnerLoginResult.sessionId;

I don't have neither login method no loginresult class in my generated from wsdl apex class

In another poste

ws.inputHttpHeaders_x = new Map <String, String>(); 
String b64_string = EncodingUtil.base64Encode(Blob.valueOf('<user_name>:<password>')); ws.inputHttpHeaders_x.put('Authorization', 'Basic ' + b64_string);
it still doesn't work

Can someone help, or give some tips or proper examples of soap callouts?

I would like to use Lightning Professional cloud edition which is provided in that sheet
https://www.salesforce.com/assets/pdf/datasheets/DS_SalesCloud_EdCompare.pdf
I also need to use Web services API which is optional
Will the Lightning Proffesional which  uses web services api work? Or  I have to make an additional payment for it?

I have 2 orgs. I want to retrive particular account records from another org to my current org, using rest api 
I'm using custom domain name on second org.
Its look like https://nara-narayana-dev-ed.my.salesforce.com/

 

On my current org code that respons for creating request looks like 

Httprequest req=new httprequest();
        String domainName='nara-narayana-dev-ed-c.eu6.visual.force.com';

        String endPointURL='https://'+domainName+'/services/apexrest/Account/0015800000FvETO';
        req.setendpoint(endPointURL);
        req.setHeader('Content-Type', 'application/xml; charset=utf-8');
        req.setmethod('GET');
        req.setHeader('Authorization','Bearer '+ UserInfo.getSessionId());
        Http http = new Http();
        HTTPResponse res = http.send(req);
         String response=res.getbody();
        System.debug('****************res.getStatusCode();'+res.getStatusCode());
        System.debug('****************res.getbody();'+res.getBody());

Rest resourse on second org looks like:(for simplicity, its now returns string 'hello')

@RestResource(urlMapping='/Account/*')
global with sharing class AccountManager {

    @HttpGet
    global static String getAccountById() {
        RestRequest req = RestContext.request;
        /*String accId = req.requestURI.substring(
                req.requestURI.lastIndexOf('/') + 1);
        Account result = [
                SELECT Name
                FROM Account
                WHERE Id = :accId
        ];*/
        return 'hello';
    }

    @HttpPost
    global static String createAccount(String name) {
        Account acc = new Account(
                Name = name);
        insert acc;
        return acc.Id;
    }
}
 

As a result i'm getting [{"errorCode":"NOT_FOUND","message":"Could not find a match for URL /Account/0015800000FvETO"}]
in debug log and status code is 404. So I assume its something wrong with endpoint url. How to make it correct?

Also I have added this url https://nara-narayana-dev-ed.my.salesforce.com  to Remote site settings

 

I'm trying to repet creating aproval process example from force.com workbook
https://developer.salesforce.com/docs/atlas.en-us.workbook.meta/workbook/approvals_1.htm

in this example we can launch approval process by clicking 'submit for approval' when price of line item is not equal to merchandise price.

User-added image
let's simulate the following situation
I have 1 user jenifer   with editing permissions on line item object
And I have Administrator user Alexander Krykun who must to approve changing the price of line item when it is not equal to merchandise price.
So, every time when jenifer want to change price of line item which differs from the merchandise price she must click 'submit for approval ' button. 
But what if she forgot do that? Line item price will remain distinct from merchandise price without approving. 
So, I would like to know are there any ways to launch approving process without obligatory  pressing 'submit for approval' button by jenifer?

As I understood manual sharing- it is when we want private object to  be granted access(read or write)  to    some particular user/group or role.

So, in my System administrator profile I want to share 'job' object with jenifer manager  user(Standart user profile)

job object set to private access in sharing settings on System administrator profile 

User-added image

next what i have made - from quick find box users-Krykun Alexander(System adm. profile)-sharing- add 

In this step I have the first questin: Is manual sharing about one particualr record or whole records of particual object or about all ?

I wasn't offered to choose object or record:

User-added image

When I go to jenifer manager account   I don't see job tab

 User-added image

User-added image

Also i can  choose sharing on detail page on particular record  from System administrator profile  and  make the same.

Also result will be the same. I can't see neither job tab no its records from Jenifer manager account.

1) so what the differences between enforcing manual sharing from 'user-particular user-shariing- add' and clicking sharing on record detail page? 
2) why I don't see any results?

 

 

I'm trying  to change object permissions   on particular profile from  my system administrator account on Standard user profile. When i'm clicking edit button on my custom object, checkboxes are still not editable. What can be the matter?

User-added image

I have set private access to Account records on my administrator profile in sharing settings section

User-added image

And for example I want to extend Account records  access with one particualr user. For this option I  chose manual sharing. and added sharing in my Administrator profile with another user as below 

User-added image

But as a result Jenifer manager still dont't see any Acoount records. 

User-added image

What the problem is? Are there any rules of sharing settings, sharing rules, object, field level security  priority execution?

 

 

I  have simple Sobject in my bd, with 2 number fields: index1__c, index2__c:

on my visualforce page i'm going to create record of this object only when these filelds are equal.

if they aren't I want to render another field of this objcet which says why they aren't equal

Creating the record must be obtained by pressing enter key. 

On pressing enter nothing happens.

Is any restrictons where  <apex:actionSupport> tag must be placed in? 

VF page 

<apex:page id="HM6" controller="HM6Controller">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:inputField value="{!hm.index1__c}"/>
                <apex:inputField value="{!hm.index2__c}"/>
               
             
            </apex:pageBlockSection>
            
        </apex:pageBlock>
        
        <apex:outputpanel id="block">
        
         <apex:outputField value="{!hm.reason_not_equals__c}" rendered="{!NOT(check)}" />
          <apex:actionSupport event="onkeypress" action="{!save}" reRender="block" />
          
        </apex:outputpanel>/>
        <apex:pageMessages />
    </apex:form>
</apex:page>
 

controller

/**
 * Created by LanaPC on 22.06.2016.
 */

public with sharing class HM6Controller {
    public HM6__c hm;

    public HM6__c getHM(){
        return hm;

    }
    public boolean check;

    private String fillMessalge(Decimal index1, Decimal index2){
        if(index1>index2) {
            return 'index1>index2';
        }else return 'inde1<index2';
    }

    public HM6Controller(){
        hm=new HM6__C();

    }

    public Boolean getcheck(){
        if (hm.index1__c==hm.index2__c){
        check = true;
        return check;
        }
        else {
           hm.reason_not_equals__c= fillMessalge(hm.index1__c,hm.index2__c);
            check= false;
            return  check;
        }
    }

    public PageReference save(){
        if (getcheck()) insert hm;
        return null;
    }


}

I have many to many relationship  between 3 objects:

User-added image

I want to insert list of sumarry(child) to parent object(accuunt)
Account acc = [Select ID, name,(SELECT id, Name FROM sumarry__r) from Account where name = 'apple'];

sumarry__c one = new sumarry__c();
sumarry__c two = new sumarry__c();
one.name = 'one';
two.name = 'two';
lists.add(one);
lists.add(two);
how to make it properly.
this operation acc.sumarry__r=lists cause 
"Field is not writeable: sumarry__r" 
or acc.sumarry__r.add(one) cause 
'System.QueryException: List has no rows for assignment to SObject'

 

I'm trying to use Ip Telephony and integrate Twilio in Salesforce
So now the issue is how to enable click to dial option
I have already have call center configured and embedded iframe is shown up 
 Iframe -its  a visual force page  with button that should enable click to dial option and it have callback that should respons wether all ok or not and pop up  alert wether its enabled or not 
But when I'm clicking on the "enable click to dial" button nothing happens
No phones enabled to be dialed no any alerts, no exaptions in console, so callback event does not invoked

Code mark up
 

<apex:page controller="TwilioClientController" showHeader="false" >
   <script type="text/javascript" src="//static.twilio.com/libs/twiliojs/1.2/twilio.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="/support/api/37.0/interaction.js"></script>
function enableClickToDial() {
    sforce.interaction.cti.enableClickToDial(function (response) {
        if (response.result) {
            alert('Click to dial was enabled.');
        } else {
           alert('Click to dial was not enabled.');
        }
        alert(response.error);
    }
);
}
<button onclick="enableClickToDial();">enable click to dial</button>
</apex:page>

Similar example from open cti api 
https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_enableclicktodial.htm

User-added image

I'm trying to use Ip Telephony and integrate Twilio in Salesforce
So now the issue is how to enable click to dial option
I have already have call center configured and embedded iframe is shown up 
 Iframe -its  a visual force page  with button that should enable click to dial option and it have callback that should respons wether all ok or not and pop up  alert wether its enabled or not 
But when I'm clicking on the "enable click to dial" button nothing happens
No phones enabled to be dialed no any alerts, no exaptions in console, so callback event does not invoked

Code mark up
 

<apex:page controller="TwilioClientController" showHeader="false" >
   <script type="text/javascript" src="//static.twilio.com/libs/twiliojs/1.2/twilio.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="/support/api/37.0/interaction.js"></script>
function enableClickToDial() {
    sforce.interaction.cti.enableClickToDial(function (response) {
        if (response.result) {
            alert('Click to dial was enabled.');
        } else {
           alert('Click to dial was not enabled.');
        }
        alert(response.error);
    }
);
}
<button onclick="enableClickToDial();">enable click to dial</button>
</apex:page>

Similar example from open cti api 
https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_enableclicktodial.htm

User-added image

I have 2 org ad I want to provide making calls from one 1 org to another
I have allredy generated wsdl file for my soap webservice 
Original   class  simply looks like

global class SoapTest {
    webservice static String getGreeting() {
        return 'Hi, pal!';
    }
}

My external  call now loooks like:

soapTestParse.SoapTest sp = new soapTestParse.SoapTest();
String output = sp.getGreeting();
System.debug(output);

as a result I'mI getting 

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session faultcode=sf:INVALID_SESSION_ID faultactor=


I have been reading bunch of posts with the same problem but I still don't know the proper way to solve it

I saw such snippets of code 

in developer guide:

stub.inputHttpHeaders_x.put('Authorization', 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==');
 

but How can I dynamically get this token? Even if I hard code session id of target org, error remains the same.

In another poste

partnerSoapSforceCom.LoginResult partnerLoginResult = myPartnerSoap.login('karnashiva@cognizant.com.dev', 'Password123'); 
soapSforceComSchemasClassAccountins.SessionHeader_element webserviceSessionHeader = new soapSforceComSchemasClassAccountins.SessionHeader_element(); 
webserviceSessionHeader.sessionId = partnerLoginResult.sessionId;

I don't have neither login method no loginresult class in my generated from wsdl apex class

In another poste

ws.inputHttpHeaders_x = new Map <String, String>(); 
String b64_string = EncodingUtil.base64Encode(Blob.valueOf('<user_name>:<password>')); ws.inputHttpHeaders_x.put('Authorization', 'Basic ' + b64_string);
it still doesn't work

Can someone help, or give some tips or proper examples of soap callouts?

I have 2 orgs. I want to retrive particular account records from another org to my current org, using rest api 
I'm using custom domain name on second org.
Its look like https://nara-narayana-dev-ed.my.salesforce.com/

 

On my current org code that respons for creating request looks like 

Httprequest req=new httprequest();
        String domainName='nara-narayana-dev-ed-c.eu6.visual.force.com';

        String endPointURL='https://'+domainName+'/services/apexrest/Account/0015800000FvETO';
        req.setendpoint(endPointURL);
        req.setHeader('Content-Type', 'application/xml; charset=utf-8');
        req.setmethod('GET');
        req.setHeader('Authorization','Bearer '+ UserInfo.getSessionId());
        Http http = new Http();
        HTTPResponse res = http.send(req);
         String response=res.getbody();
        System.debug('****************res.getStatusCode();'+res.getStatusCode());
        System.debug('****************res.getbody();'+res.getBody());

Rest resourse on second org looks like:(for simplicity, its now returns string 'hello')

@RestResource(urlMapping='/Account/*')
global with sharing class AccountManager {

    @HttpGet
    global static String getAccountById() {
        RestRequest req = RestContext.request;
        /*String accId = req.requestURI.substring(
                req.requestURI.lastIndexOf('/') + 1);
        Account result = [
                SELECT Name
                FROM Account
                WHERE Id = :accId
        ];*/
        return 'hello';
    }

    @HttpPost
    global static String createAccount(String name) {
        Account acc = new Account(
                Name = name);
        insert acc;
        return acc.Id;
    }
}
 

As a result i'm getting [{"errorCode":"NOT_FOUND","message":"Could not find a match for URL /Account/0015800000FvETO"}]
in debug log and status code is 404. So I assume its something wrong with endpoint url. How to make it correct?

Also I have added this url https://nara-narayana-dev-ed.my.salesforce.com  to Remote site settings

 

As I understood manual sharing- it is when we want private object to  be granted access(read or write)  to    some particular user/group or role.

So, in my System administrator profile I want to share 'job' object with jenifer manager  user(Standart user profile)

job object set to private access in sharing settings on System administrator profile 

User-added image

next what i have made - from quick find box users-Krykun Alexander(System adm. profile)-sharing- add 

In this step I have the first questin: Is manual sharing about one particualr record or whole records of particual object or about all ?

I wasn't offered to choose object or record:

User-added image

When I go to jenifer manager account   I don't see job tab

 User-added image

User-added image

Also i can  choose sharing on detail page on particular record  from System administrator profile  and  make the same.

Also result will be the same. I can't see neither job tab no its records from Jenifer manager account.

1) so what the differences between enforcing manual sharing from 'user-particular user-shariing- add' and clicking sharing on record detail page? 
2) why I don't see any results?

 

 

I'm trying  to change object permissions   on particular profile from  my system administrator account on Standard user profile. When i'm clicking edit button on my custom object, checkboxes are still not editable. What can be the matter?

User-added image

I have many to many relationship  between 3 objects:

User-added image

I want to insert list of sumarry(child) to parent object(accuunt)
Account acc = [Select ID, name,(SELECT id, Name FROM sumarry__r) from Account where name = 'apple'];

sumarry__c one = new sumarry__c();
sumarry__c two = new sumarry__c();
one.name = 'one';
two.name = 'two';
lists.add(one);
lists.add(two);
how to make it properly.
this operation acc.sumarry__r=lists cause 
"Field is not writeable: sumarry__r" 
or acc.sumarry__r.add(one) cause 
'System.QueryException: List has no rows for assignment to SObject'

 

Hi Everyone,

While uploading an enterprise wsdl i got this error
Error: Uploaded wsdl size exceeded the maximum upload limit: {0}
Help me to solve this issue

Thanks
Halns