• SFDC developer55
  • NEWBIE
  • 15 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 14
    Replies
I am trying to call one rest API using Httprequest (from salesforce using Apex code), but not able to figure how I can pass the body.  I would appreciate if anyone share the way to pass the below mentioned body in the HttpRequest.

here are the details:
End-point URL : https://api.boomi.com/api/rest/v1/AccountID/EnvironmentExtensions/XXXXXXXXXX

Body:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bns:EnvironmentExtensions xmlns:bns="http://api.platform.boomi.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="XXXXXXXXXXXXXXXX" extensionGroupId="" environmentId="XXXXXXXXXXXXXXX">
    <bns:connections>
        <bns:connection name="SFDC connection" id="XXXX">
            <bns:field componentOverride="false" usesEncryption="false" encryptedValueSet="false" value="email@gmail.com" id="user"/>
            <bns:field componentOverride="false" usesEncryption="true" encryptedValueSet="true" id="password" value="password"/>
        </bns:connection>
    </bns:connections>
</bns:EnvironmentExtensions>


Apex code to call Rest API:


      String endPointURL = 'https://api.boomi.com/api/rest/v1/AccountID/EnvironmentExtensions/XXXXXXXXXX';
      
      String userName = 'XXXXXX';
      String password = 'XXXXXXX';

      String body= '';
      String query;
      query = '';
      Blob headerValue = Blob.valueOf(userName + ':' + password);
      String authorizationHeader = 'BASIC ' +
      EncodingUtil.base64Encode(headerValue);
      accs1 = new List<cAccount>();
      Httprequest request = new HttpRequest();
      Http http = new Http();
      request.setMethod('POST');
      request.setEndpoint(endPointURL);
      request.setHeader('Content-Type', 'application/json');
      // Header info with remote server user name and password
      request.setHeader('Authorization', authorizationHeader);
      request.setBody(query); 
            
      request.setTimeout(120000); 
      request.setBody(query);          
      //Making call to external REST API
      HttpResponse response = http.send(request);  
      System.debug('responseBody: '+response.getBody());
Hi All,

Any idea how can I parse the below Rest API response using Apex code and how can I display this pageblock section.

<bns:QueryResult xmlns:bns="http://api.platform.boomi.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfResults="3">
<bns:result xsi:type="bns:Process" id="XXXXXX" name="AAA"/>
<bns:result xsi:type="bns:Process" id="XXXXXXXX" name="BBBB"/>
<bns:result xsi:type="bns:Process" id="XXXXXX" name="CCC"/>
</bns:QueryResult>

Regards,
PR
Hi All,

Did anyone implement QR code scanner in Salesforce project?

What I need? If user scans the attached QR code, it should return the result after decode.

For e.g. If you scan the attached image (QR code) then it should return “ER-0000130”.

We are able to get the results from online demo’s, here is one example:http://dwa012.github.io/html5-qrcode/

However, after implementing code in SFDC, I am getting one or more errors. 

Please let me know if anyone implemented any QR code scanner in their project, with the instruction to implement.

Thank you.
Regards,
Paddy 
I need to get the value of Locale from user object using javascript.  Could you please help me on this?   Locale image from User Object 

Regards,
Paddy

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}

I have a custom button in communities and on click of that this javascript method file get called..

 

And below code is not working.. it is giving undefined//

alert ("{!$User.CustomField__c}")

 

However, it is working fine for the standard field..For e.d below code is working fine .. I am able to see the Id but same thing is not working for the Custom field.

alert ("{!$User.Id}")

 

 

Thank you for the help in advance.

 

Regards,

Paddy

Hi Guys,

 

We have a custom button on a detail page which is used for custom clone and should be acccessible only for user that are assigned with a specific permission set. When I try to achieve this using

var permissionsetid = sforce.connection.query("select id,label from PermissionSet where Label = " + "\'" + "permissionset name" + "\'");

 

The system throwing 

 

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'PermissionSet' is not supported.', detail:{InvalidSObjectFault:{exceptionCode:'INVALID_TYPE', exceptionMessage:'sObject type 'PermissionSet' is not supported.', row:'-1', column:'-1', }, }, }

 

Can anyone let me know that can we achieve this through script, I already thought of a workaround to redirect user to a page from where I can query permissionsets and validate the logged in user.

 

--yvk

 

Hi All,

 

I have a use case in which user with different locale can access the VF page.

On this VF page I have some number calculation using JavaScript this number field are directly bind with SF object fields.

So whenever user with different locale access this page the bind number field display format is changed and result in improper calculation.

 

For example, a number that we would write in the US as "1,250,500.75" would be written differently in different countries: "1.250.500,75" in Germany, "1 250 500,75" in France, and "1'250'500.75" in Switzerland, and "125,0500.75" in Japan.

 

Any thoughts or workaround would be appreciated

 

Thanks in advance.

 

 

 

 

I am trying a simple Account GET operation on Boomi from Salesforce through REST API. The following is the code in Salesforce which is executed by button click.

public pageReference AccountGet()
{
String username = <Boomi username>;
        String password = <Boomi password>;
Blob headerValue = Blob.valueOf(username + ':' + password);
        String authorizationHeader = 'BASIC ' +  EncodingUtil.base64Encode(headerValue);
HttpRequest req = new HttpRequest();
        req.setEndPoint('https://platform.boomi.com/api/rest/v1/<Boomi Account Id>/Account/<Boomi Account Name>');
        req.setMethod('GET');
        req.setHeader('Authorization', authorizationHeader);
     
        Http http = new Http();
HttpResponse res = http.send(req);
        
        AccCreateBody = res.getBody();
        AccCreateStatus = res.getStatus();
        AccCreateStatCode = res.getStatuscode();
return null;
}

Execution of the above code results in '500 Internal Server Error'. Any pointers on how to proceed will be greatly helpful.
Thanks!

Hello, I have a data table I've created on a Visual Force page. This table lists out all my records I've created for a custom Sales object. I was asked to gather the total amount cummulated for each record and display it on the top row (not counting the Header Values). I have come up with the total amount, but I am having trouble getting it to display the way I want.  

 

Here's an example of the layout I need.  I want the Total amount to display directly underneath the header row.

Total   Employee   Amount

$350    Mike            $50

           Steve           $100

           Perry           $150

           Johnson      $50

 

However, here is what I am getting using the following code:

 <apex:column headerValue="Total" width="50">
        <apex:facet name="header"><apex:outputPanel >
        <apex:outputText value="${!Total['sum']}" /></apex:outputPanel></apex:facet>
</apex:column>

 This code takes my header value "Total" and replaces it with the numeric total, so I am seeing:

 

$350    Employee   Amount

            Mike            $50

            Steve          $100

            Perry           $150

           Johnson       $50

 

I also decided to create my Headers using standard <TH> tags, rather than the <column headerValue="">, and then setup my dataTable without column headers.  However, this resulted in the following layout:

 

Total   Employee   Amount

$350

           Mike              $50     

           Steve            $100

           Perry            $150

           Johnson       $50

 

While the total amount is directly underneath the "Total" header, the other records have jumped down a line. Is there a way to get this total amount to display in my first layout?

 

Thanks!

Mike

Hi,
 
From past few days, i am facing a problem when i click the custom button.
It shows a javascript error "sforce not defined".
Prior to winter'09 release, this issue was not there.
 
Is anyone else facing this issue.
 
Any help on this will be highly appreciated.
 
Thanks,
OnDemand