• Hemant Gulati 4
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 15
    Replies
Hello Friends,

I would like to access Salesforce data in SAP through ABAP. I am integrating salesforce with SAP through ABAP.

I have written a function module in ABAP and provide Oauth(Rest based) details to get access of salesforce:-
URL:- https://login.salesforce.com/services/oauth2/token with grant_type=password,ClientId,ClientSecret, username and password.

It returns me an issue:- "SSL Peer Cert Untrusted", i googled and found that i need to import a certificate on SAP, so that it can able to access https://login.salesforce.com/services/oauth2/token.

So kindly help me to get a SSL certificate to import it in SAP. From where i can download certificate, or is there any way to download or create certificate inside the salesforce organization which would be acceptable by SAP. 

Thanks,
Hemant
 
I've started testing the oauth2 auth, However, when I use the correct credentials(of Sandbox Environment), (grant_type: password) I get an Internal Server Error (500 response):

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

It works fine with developer edition credentials.

I have checked out the below links, but could not able to found any solution.

http://salesforce.stackexchange.com/questions/20559/what-is-the-use-of-setting-oauth-callback-url-as-https-login-salesforce-com-se
http://gersic.com/oauth-2-0-for-salesforce-com/
https://developer.salesforce.com/forums/?id=906F00000009CYeIAM

Please help me in this.

Thanks in advance.
 
Hello All,

I am using a canvas HTML element (with other elements of form) in my VF page. Onclicking on submit button, i am trying to save what has been written on canvas by the user as an Image with the other data in the form in the PDF attachment to the record.
Here, i am getting an issue "common.apex.runtime.impl.ExecutionException: An error occurred while parsing the input string."

Code:- 
//Canvas image code (base64 image string)
 String imageScreen=string.valueOf(canvasImage);

Code for attachment:-
1.  Attachment attachmentFile  = new Attachment();
2.  attachmentFile.parentId = parentId;
3.  attachmentFile.Name =  'abc.pdf';
4.  attachmentFile.body =blob.toPdf('<HTML><BODY><div>Test File</div><br/><img src='+imageScreen+' /></BODY></HTML>');
5.  insert attachmentFile;

Error is  in line 4.

and if i'll give static path of an image stored in Document object , it won't generate an error.

I request you all to please help me in this.

Thanks,
Hello All,

I need your help on the foloowing issue:-

I have attach a image file in RICH TEXT BOX field in one of the objects. Now i am trying to aceess that image through REST API from outside salesforce. i want to show that image on my Public site (which is outside salesfoce).

Please share the code  to access the image (stored in rich text box field of an object) through REST API.

Eagerly awaing for the answers.

Thanks in advance..

 
Hello All,

I have a Custom FILE field in knowledge article to store an image, excel file, doc file or pdf, etc with knowledge article.
Now i want to retrieve the file store in FILE custom field through REST services.
Rest services are using outside salesforce(HTML pages with javascript), not in Apex pages

Please help me to find out, how can we able to get the file(image,doc,excel,pdf) stored in FILE Custom field in knowledge Article through REST services(Salesforce REST Services) outside salesforce.
 
I am calling a rest API from javascript from third party appplication outside salesforce and  getting this issue:-

XMLHttpRequest cannot load https://login.salesforce.com/services/oauth2/token. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 400.


My Code:- 
$.ajax({
                    type: 'GET',
                    url: 'https://login.salesforce.com/services/oauth2/token',
                    contentType: 'application/json',
                    dataType: 'json',
                    beforeSend: function(xhr) {
                        xhr.setRequestHeader('grant_type','password'),
                        xhr.setRequestHeader('client_id',  'CLIENT_ID'),
                        xhr.setRequestHeader('client_secret', 'LIENT_SECRET'),
                        xhr.setRequestHeader('username', 'Username'),
                        xhr.setRequestHeader('password', "Password+securityToken")
                    },
                    success: function(response) {
                        console.log('Successfully retrieved ' + response);
                        //Other logic here
                    },
                    error: function(response) {
                        console.log('Failed ' + response.status + ' ' + response.statusText);
                        //Other logic here
                    }
                });


I have made an Connected app adn provide access to that user in Profile settings.

Here are some of my questions:-
1. The callback url in connected app can be http://localhost or should be a proper server URL.
2. Do i need to add http://localhost(server URL) in CORS and REMOTE settings
3. Server URL should be HTTPS (secured)

Please help me in this.

Thanks in advance!
4. I mentioned my error above , please help me in resolving it.
                

 
I am getting this issue "An internal server error has occurred Error ID: 1854847182-41225 (-1177185898)" while inserting a record through lightninig app, as i am calling a Component function from helper file and passing an object(record) in it.

Helper file code:-  

createExpense: function(component, expense) {
       
        this.upsertExpense(component, expense, function(a) {
            var expenses = component.get("v.expenses");
            expenses.push(a.getReturnValue());
            component.set("v.expenses", expenses);
            this.updateTotal(component);
        });
    },
    upsertExpense : function(component, expense, callback) {
        console.log("Save");
        var action = component.get("c.saveExpense",expense);
        console.log("Save2");
        /*action.setParams({
            "expense": expense
        });*/
        if (callback) {
            action.setCallback(this, callback);
        }
        $A.enqueueAction(action);
    }


Controller file code:- 

public with sharing class ExpenseController {
    @AuraEnabled
    public static Expense__c saveExpense(Expense__c expense) {
        // Perform isUpdateable() check here
        System.debug('Upsert Start');
        upsert expense;
        System.debug('Upsert Done');
        return expense;
    }
  
    @AuraEnabled
    public static List<Expense__c> getExpenses() {
        // Perform isAccessible() check here
        return [SELECT Id, Name, Amount__c, Client__c, Date__c,
                Reimbursed__c, CreatedDate FROM Expense__c];
    }
    
}


getExpenses function is running correctly, but when i am calling saveExpense from helper file, it generates error.

Please help me.

Thanks,
Hemant Gulati
Hello Friends,

I would like to access Salesforce data in SAP through ABAP. I am integrating salesforce with SAP through ABAP.

I have written a function module in ABAP and provide Oauth(Rest based) details to get access of salesforce:-
URL:- https://login.salesforce.com/services/oauth2/token with grant_type=password,ClientId,ClientSecret, username and password.

It returns me an issue:- "SSL Peer Cert Untrusted", i googled and found that i need to import a certificate on SAP, so that it can able to access https://login.salesforce.com/services/oauth2/token.

So kindly help me to get a SSL certificate to import it in SAP. From where i can download certificate, or is there any way to download or create certificate inside the salesforce organization which would be acceptable by SAP. 

Thanks,
Hemant
 
I've started testing the oauth2 auth, However, when I use the correct credentials(of Sandbox Environment), (grant_type: password) I get an Internal Server Error (500 response):

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

It works fine with developer edition credentials.

I have checked out the below links, but could not able to found any solution.

http://salesforce.stackexchange.com/questions/20559/what-is-the-use-of-setting-oauth-callback-url-as-https-login-salesforce-com-se
http://gersic.com/oauth-2-0-for-salesforce-com/
https://developer.salesforce.com/forums/?id=906F00000009CYeIAM

Please help me in this.

Thanks in advance.
 
Hello All,

I need your help on the foloowing issue:-

I have attach a image file in RICH TEXT BOX field in one of the objects. Now i am trying to aceess that image through REST API from outside salesforce. i want to show that image on my Public site (which is outside salesfoce).

Please share the code  to access the image (stored in rich text box field of an object) through REST API.

Eagerly awaing for the answers.

Thanks in advance..

 
I am calling a rest API from javascript from third party appplication outside salesforce and  getting this issue:-

XMLHttpRequest cannot load https://login.salesforce.com/services/oauth2/token. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 400.


My Code:- 
$.ajax({
                    type: 'GET',
                    url: 'https://login.salesforce.com/services/oauth2/token',
                    contentType: 'application/json',
                    dataType: 'json',
                    beforeSend: function(xhr) {
                        xhr.setRequestHeader('grant_type','password'),
                        xhr.setRequestHeader('client_id',  'CLIENT_ID'),
                        xhr.setRequestHeader('client_secret', 'LIENT_SECRET'),
                        xhr.setRequestHeader('username', 'Username'),
                        xhr.setRequestHeader('password', "Password+securityToken")
                    },
                    success: function(response) {
                        console.log('Successfully retrieved ' + response);
                        //Other logic here
                    },
                    error: function(response) {
                        console.log('Failed ' + response.status + ' ' + response.statusText);
                        //Other logic here
                    }
                });


I have made an Connected app adn provide access to that user in Profile settings.

Here are some of my questions:-
1. The callback url in connected app can be http://localhost or should be a proper server URL.
2. Do i need to add http://localhost(server URL) in CORS and REMOTE settings
3. Server URL should be HTTPS (secured)

Please help me in this.

Thanks in advance!
4. I mentioned my error above , please help me in resolving it.
                

 
I want to add an image to a pdf I am creating and attach it to an email that I send via apex code. I am using html and Blob.toPdf() to make the pdf. I saw this post regarding Blob.toPdf()'s limitations on images: https://help.salesforce.com/apex/HTViewSolution?id=000123577&language=en_US. It says:

"To work around this Blob.toPdf()'s limitation you may resort to one of the below approaches:
1. Store the image as a static resource and then use it in code. 
2. Use a Visual Force Page and render it as pdf "

So I tried both ways, the first one throws an error: "An error occurred while parsing the input string" (which happens with <img> tag no matter what src I use). 
And the second way is not an option for me cause I have to get the page content that I'm rendering as pdf and attach it to my email BUT "Page.getContent() does not work in Triggers or Email Services".

Is there a work around this limitations?
 

I've started testing the oauth2 auth via using curl on the command line (as described in another post in this forum).

 

I get all the expected warnings when using intentionally incorrect credentials (bad secret, bad client_id, etc).

 

However, when I use the correct credentials, (grant_type: password) I get an Internal Server Error (500 response):

 

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 1854879326-13153 (-657290999)

 

 

Also, the link in the error message leads me to a page that tells me the data is missing. Does this imply that the REST pilot is not available in my instance (cs3.salesforce.com)?