• Jorge Ortega Traverso
  • NEWBIE
  • 80 Points
  • Member since 2015
  • Solution Architect
  • redk


  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
Hi!
I'm trying to access Salesforce content from an external site. For this I want to use the APIs provided by Salesforce.

From Postman it works OK and I do the following:

I have created a connected app in salesforce with this settings:
- Available OAuth Scopes -> full access
- OAuth Policies -> IP Relaxation -> Relax IP restrictions
- OAuth Policies -> Permited Users -> All users may self-authorize

From Postman:
- I do a post request with the following body:
User-added image

- In hit this endpoint 'https://test.salesforce.com/services/oauth2/token' and I get a good response

User-added image

With this access token I can build another request and I get my resource from salesforce until here everything ok...

My problem is when I try to get the access token from the site's javascript. My code:

User-added image

I get this error:
User-added image

To resolve this issue I have added the site from which I launch the requests to the salesforce CORS whitelist and I have enabled the Enable CORS for OAuth endpoints but nothing seems to change.

With the access token obtained via Postman I can do the following request from my site and it works:

User-added image

This SOQL request send me a JSON with a good response.

Therefore, to solve my problem I would need to obtain this access token from my site in order to later build the following request .
Anybody knows how can I resolve this issue?

Thank you very much in advance,
Best regards
 
I'm trying to access a Sandbox org via a Connected App that is part of a package installed in the org.

However I cannot make it work and if I to the user that tries to log in, under the Login History I see this:

User-added image

I tried to solve it adding the IP at Network Access level and the Profile one, but it does not work either. 

Any suggestion would be really appreciated.

Thanks!
Hi All,

I'm trying to configure my WebChat snippet to match contact records based on a custom external Id field, but it always match the contact based on the firstname and lastname fields.

Anyone who read this can really undestand how the chat API match the contact?

Here my last unsuccessful try for the extraPrechatInfo
embedded_svc.settings.extraPrechatInfo = [{
    "entityName ": "Contact",
    "showOnCreate": true,
    "linkToEntityName": "Case",
    "linkToEntityField": "ContactId",
    "saveToTranscript": "ContactId",
    "entityFieldMaps":
        [{
            "isExactMatch": true,
            "fieldName": "External_Id__c",
            "doCreate": true,
            "doFind": false,
            "label": "External Id"
        },{
            "isExactMatch": true,
            "fieldName": "FirstName",
            "doCreate": true,
            "doFind": false,
            "label": "First Name"
        },
        {
            "isExactMatch": true,
            "fieldName": "LastName",
            "doCreate": true,
            "doFind": false,
            "label": "Last Name"
        }]
};
Thanks in advance!
Jorge Ortega
 
Hi all,

I'm serializing a custom class containing case object and other objects to JSON, and case's picklist serialize as this
"Status":{"value":"Finished"}
producing this error message when trying to deserialize
System.JSONException: Cannot deserialize instance of picklist from START_OBJECT value { or request may be missing a required field at [line:1, column:733]

Is it any kind of bug on the JSON Serialization or Deserialization?

When serializing Case records directly, picklists serialize in different way
TestJSON.cls

================================

List<Case> lc = new List<Case>();

lc.add(new Case(Status = 'Finished', External_ID__c = 'IDEXT_1'));

lc.add(new Case(Status = 'Finished', External_ID__c = 'IDEXT_2'));

lc.add(new Case(Status = 'Finished', External_ID__c = 'IDEXT_3'));

String js = JSON.serialize(lc);

System.debug(js);



================================

36.0 APEX_CODE,DEBUG;APEX_PROFILING,DEBUG;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
Execute Anonymous: List<Case> lc = new List<Case>();
Execute Anonymous: lc.add(new Case(Status = 'Finished', External_ID__c = 'IDEXT_1'));
Execute Anonymous: lc.add(new Case(Status = 'Finished', External_ID__c = 'IDEXT_2'));
Execute Anonymous: lc.add(new Case(Status = 'Finished', External_ID__c = 'IDEXT_3'));
Execute Anonymous: String js = JSON.serialize(lc);
Execute Anonymous: System.debug(js);
11:23:45.28 (28314495)|USER_INFO|[EXTERNAL]|00524000000Uis5|4contrdev4.jorge.ortega@endesa.accenture.com|hora estándar de Europa central|GMT+02:00
11:23:45.28 (28336160)|EXECUTION_STARTED
11:23:45.28 (28342791)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
11:23:45.28 (30735799)|USER_DEBUG|[6]|DEBUG|[{"attributes":{"type":"Case"},"Status":"Finished","External_ID__c":"IDEXT_1"},{"attributes":{"type":"Case"},"Status":"Finished","External_ID__c":"IDEXT_2"},{"attributes":{"type":"Case"},"Status":"Finished","External_ID__c":"IDEXT_3"}]
11:23:45.30 (30797222)|CUMULATIVE_LIMIT_USAGE
11:23:45.30 (30797222)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

11:23:45.30 (30797222)|CUMULATIVE_LIMIT_USAGE_END

11:23:45.28 (30839576)|CODE_UNIT_FINISHED|execute_anonymous_apex
11:23:45.28 (32935152)|EXECUTION_FINISHED




Class code
global class EquipmentRemovalJob {
        public B1ActivationRequest activation;
        //There is some business methods
}
public class B1ActivationRequest {
        @InvocableVariable
        public Case request;
        @InvocableVariable
        public Contract_ATR__c contract;
        @InvocableVariable
        public CUPS__c cups;
}



Here you have a complete object JSON serialization
{"activation":{"request":{"attributes":{"type":"Case","url":"/services/data/v37.0/sobjects/Case/5008E0000051XOlQAM"},"LastModifiedDate":"2016-08-04T07:33:14.000+0000","LaunchAnnulmentFlow__c":false,"AccountId":"0018E00000LTgvcQAD","Process_Code_Description__c":"B1","Activation_mode__c":"J","Ready_To_Annulment_Flows__c":false,"Do_NOT_send_communication__c":false,"Energy_guarantor__c":"0018E00000LTgvcQAD","BusinessHoursId":"01m24000000Ku16AAC","CreatedById":"00524000000Uis5AAC","Reason_unsubscription_Code_Description__c":"03","ClosedOnCreate":false,"IsClosedOnCreate":false,"Pass_Code__c":"01","Term_symbol_activation__c":"_IM1_/servlet/servlet.FileDownload?file=01525000000A0IU_IM2_¡Qué pena! la imagen no puede mostrarse_IM3_","Status":{"value":"Finished"},"Activation_business_term_icon__c":"_IM1_/img/samples/flag_red.gif_IM2_No se encuentra la imagen_IM3_","IsDeleted":false,"ReceptionDateToShow__c":"2016-08-04T06:34:00.000+0000","isManual__c":true,"CodeDemand__c":"002900001025","Priority":"Medium","Is_first_evaluation__c":true,"REE_Distributor_Code_Description__c":"0029","CreatedByAlias":"JOT","IsStopped":false,"IsEscalated":false,"CUPS__c":"a0r8E000000m841QAA","Term_symbol_acceptance__c":"_IM1_/servlet/servlet.FileDownload?file=01525000000A0IU_IM2_¡Qué pena! la imagen no puede mostrarse_IM3_","CreatedDate":"2016-08-04T06:35:23.000+0000","Id":"5008E0000051XOlQAM","Subscription_Claims__c":false,"Reception_date__c":"2016-08-04T06:00:00.000+0000","Request_Label_Dinamic_Record_Choice__c":"00001025 B1","Input_channel__c":"Online","CNAE__c":"5221","EDE_Energy_user__c":"0018E00000LTiF2QAL","Hidden_Reception_Date__c":"2016-08-04","Term_status_activation__c":"Within term","Stop__c":false,"Ready2CalculateActivationMode__c":false,"IsClosed":false,"VU_issue__c":false,"Activation_expected_date_old__c":"2016-08-19","TestingLaunchingRequestActivationFlow__c":true,"Activation_expected_date__c":"2016-08-04","Term_status_acceptance__c":"Within term","OwnerId":"00G24000001E9t1EAC","Claims_exists_interactions__c":false,"CaseNumber":"00001025","Activation_date__c":"2016-08-04","Acceptance_business_term_icon__c":"_IM1_/img/samples/flag_red.gif_IM2_No se encuentra la imagen_IM3_","LastModifiedByAlias":"JOT","Ready_To_Col__c":true,"Payment_holder__c":"0018E00000LTgvcQAD","Contract_holder__c":"0018E00000LTgvcQAD","Original_Contract__c":"a0u8E000000Z6XNQA0","Requested_power_1__c":4.4,"SystemModstamp":"2016-08-04T07:33:14.000+0000","Energy_user__c":"0018E00000LTiF2QAL","TestingLaunchingActValCollisionFlow__c":false,"Ready_To_Launch_Policy_Mail__c":false,"EventsProcessedDate":"2016-08-04T06:35:23.000+0000","Enforced_communication__c":false,"PM_type__c":"5","Ready_To_Validation_Flows__c":false,"Process_Code_Reason_Unsubscription_F__c":"B1 - 03","LastModifiedById":"00524000000Uis5AAC"},"cups":{"attributes":{"type":"CUPS__c","url":"/services/data/v37.0/sobjects/CUPS__c/a0r8E000000m841QAA"},"Id":"a0r8E000000m841QAA","Provision_s_tension__c":"38","Tension_s_measure__c":null,"State_derivation__c":{"value":"5"},"Provisioning_address__c":"AFUERAS AFUERAS 0 . ALMUDEVAR . HUESCA . 22283","CNAE__c":"5221","Contract_holder__c":"","Payment_holder__c":"","Energy_user__c":"","Guarantor__c":"","SCE_CEMPTITU__c":"00001","CFINCA__c":4784.0,"CDERIND__c":1.0,"CPTOSERV__c":1.0,"Name":"ES0031300004784001XX0F","ContractInForce__c":""},"contract":{"attributes":{"type":"Contract_ATR__c","url":"/services/data/v37.0/sobjects/Contract_ATR__c/a0u8E000000Z6XNQA0"},"Id":"a0u8E000000Z6XNQA0","Sequential__c":101.0,"Entry_date__c":"2016-04-04","Code_contract_Policy_version__c":"8506172861","Version_end_date__c":"2016-08-04","Leaving_date__c":"2016-08-04","SCE_CLINNEG__c":"1","SCE_CEMPTITU__c":"1","REE_distributor_code_description__c":"0029","Description_agent_REE_code__c":null,"Status__c":{"value":"21"}}}}
Hi all,

I'm deploying with the migration tool several changes and I'm getting warning messages like those ones
[...]
[sf:deploy] Component Failures:
[sf:deploy] 2.  objectTranslations/Point_of_measure__c-es.objectTranslation -- Warning: Invalid picklist value: V in field: Point_of_measure__c.Measure_Point_Status__c (line 77, column 13)
[sf:deploy] 3.  objectTranslations/Point_of_measure__c-en_US.objectTranslation -- Warning: Invalid picklist value: P in field: Point_of_measure__c.Measure_Point_Function__c (line 61, column 13)
[...]
The point is that the <masterLabel> of the translations files match with the Point_of_measure__c.Measure_Point_Function__c picklist fullname values included with the package.
<fields>
        <fullName>Measure_Point_Function__c</fullName>
        <externalId>false</externalId>
        <label>Measure Point Function</label>
        <picklist>
            <picklistValues>
                <fullName>R</fullName>
                <default>false</default>
            </picklistValues>
            <picklistValues>
                <fullName>P</fullName>
                <default>false</default>
            </picklistValues>
            <picklistValues>
                <fullName>C</fullName>
                <default>false</default>
            </picklistValues>
            <sorted>false</sorted>
        </picklist>
        <trackHistory>false</trackHistory>
        <trackTrending>false</trackTrending>
        <type>Picklist</type>
</fields>
    <fields>
        <label><!-- Measure Point Function --></label>
        <name>Measure_Point_Function__c</name>
        <picklistValues>
            <masterLabel>C</masterLabel>
            <translation>COMPROBANTE</translation>
        </picklistValues>
        <picklistValues>
            <masterLabel>P</masterLabel>
            <translation>PRINCIPAL</translation>
        </picklistValues>
        <picklistValues>
            <masterLabel>R</masterLabel>
            <translation>REDUNDANTE</translation>
        </picklistValues>
    </fields>
I found this article https://help.salesforce.com/apex/HTViewSolution?id=000175733&language=en_US which points to the record type configuration, but my Point_of_measure__c object hasn't any record type config.

I have two questions
  1. What is this warning about of?
  2. Could I deploy to production with these kind of warning messages?
Hi all,

I've import a WSDL into my Org creating a client classes for my web service.

I'm getting read timeout when invoking this callout with some load (about 4Kb of data included as parameter).

When I invoke the callout with a minimun load (about 1,5Kb) the callout is responding ok, obviously, we cannot reduce call the callouts, because this occurs with outbound messages which are sent to our ESB

I've create a case, and the Salesforce Support guy tells me this
You can increase polling time with below patterns for SOAP and REST based callouts
================================================================
For REST based

req.setTimeout(120000); // timeout in milliseconds - this is two minute

Use the above for increasing HTTP callout time to poll for response

request inita=new request.ManageCollectionHttpPort();
inita.timeout_x=120000;

use above pattern for increasing time out in WSDL API.This is a sample stub class assumed .You will need to figure out your stub class and add timeout__x to same


I'm looking into my Stub class and I cannot find any way to include the line 
request initia = new request.ManageCollectionHttpPort();

May be the support guy only wants me to include the timeout line, anyway, I tried the callout setting the timeout_x property of my stub class to 120K milliseconds and got the same result... IO Exception: Read timed out.

Is ther anyone who solved this issue or explained it because a firewall problem?
Hi!
I'm trying to access Salesforce content from an external site. For this I want to use the APIs provided by Salesforce.

From Postman it works OK and I do the following:

I have created a connected app in salesforce with this settings:
- Available OAuth Scopes -> full access
- OAuth Policies -> IP Relaxation -> Relax IP restrictions
- OAuth Policies -> Permited Users -> All users may self-authorize

From Postman:
- I do a post request with the following body:
User-added image

- In hit this endpoint 'https://test.salesforce.com/services/oauth2/token' and I get a good response

User-added image

With this access token I can build another request and I get my resource from salesforce until here everything ok...

My problem is when I try to get the access token from the site's javascript. My code:

User-added image

I get this error:
User-added image

To resolve this issue I have added the site from which I launch the requests to the salesforce CORS whitelist and I have enabled the Enable CORS for OAuth endpoints but nothing seems to change.

With the access token obtained via Postman I can do the following request from my site and it works:

User-added image

This SOQL request send me a JSON with a good response.

Therefore, to solve my problem I would need to obtain this access token from my site in order to later build the following request .
Anybody knows how can I resolve this issue?

Thank you very much in advance,
Best regards
 
I'm trying to access a Sandbox org via a Connected App that is part of a package installed in the org.

However I cannot make it work and if I to the user that tries to log in, under the Login History I see this:

User-added image

I tried to solve it adding the IP at Network Access level and the Profile one, but it does not work either. 

Any suggestion would be really appreciated.

Thanks!
Hi all,

I've import a WSDL into my Org creating a client classes for my web service.

I'm getting read timeout when invoking this callout with some load (about 4Kb of data included as parameter).

When I invoke the callout with a minimun load (about 1,5Kb) the callout is responding ok, obviously, we cannot reduce call the callouts, because this occurs with outbound messages which are sent to our ESB

I've create a case, and the Salesforce Support guy tells me this
You can increase polling time with below patterns for SOAP and REST based callouts
================================================================
For REST based

req.setTimeout(120000); // timeout in milliseconds - this is two minute

Use the above for increasing HTTP callout time to poll for response

request inita=new request.ManageCollectionHttpPort();
inita.timeout_x=120000;

use above pattern for increasing time out in WSDL API.This is a sample stub class assumed .You will need to figure out your stub class and add timeout__x to same


I'm looking into my Stub class and I cannot find any way to include the line 
request initia = new request.ManageCollectionHttpPort();

May be the support guy only wants me to include the timeout line, anyway, I tried the callout setting the timeout_x property of my stub class to 120K milliseconds and got the same result... IO Exception: Read timed out.

Is ther anyone who solved this issue or explained it because a firewall problem?
Receiving this error when editing a visualforce page in sandbox through developer console or third party IDE.  This page has been working in production for some time. Both page and controller are set to version 32 in sandbox and production. 
The page can be edited directly through Develop->Pages.

Here's a very simplified version of the page which produces the error
 
<apex:page standardController="User" extensions="SalesRepGoalController2"> 

<b>Hello World!</b>
</apex:page>
and controller
 
public with sharing class SalesRepGoalController2{
private String userID = '' ; 	
public SalesRepGoalController2(ApexPages.StandardController c)
	{
		userID = c.getId(); 
	}
}

Java 1.7 was installed, but has been uninstalled.

Windows 8 Enterprise,  64bit
IE 10
JRE none

 
  • July 20, 2015
  • Like
  • 1
So I'm fairly new to the Force.com platform.

That said, I'm working on doing some practical metadata backups and restores for our org and sandboxes using the ANT Migration Toolkit.
Using the IDE I'm able to quickly get the initial package.xml for *everything* and use it to retrieve the related metadata using the Migration Toolkit.
Everything is just wonderful until I retrieve all the metadata from one sandbox and try to deploy on another new sandbox within the same org.

Hundreds of cryptic errors (262 to be exact) occurred with a single deploy. Everything is correct between the orgs and my logins are working fine.

I was under the impression that this stuff just worked. Is it just me or are there other things that the documentation just doesn't tell you??

Thanks!