• Rahul Jain 169
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 9
    Replies
I am trying to read a XML file that is stored in Amazon S3 by running this below code in anonymous block. I am getting signature does match issue. 

Here is my Code
 
public String bucketname1 = 'xmlbucketforpoc'; 
public String key1='AKIAJ4Z2VL6H3IYXAOSA';
public String secret1='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';

Datetime now = Datetime.now();

String formattedDateString1 = now.formatGmt('yyyyMMdd')+'T'+now.formatGmt('HHmmss')+'Z';
System.debug('formatted date string...'+formattedDateString1);

String canonical = 'AmazonS3'+'xmlbucketforpoc'+formattedDateString1;
String method1 = 'GET';

String filename1 = 'package1.xml';

HttpRequest req = new HttpRequest();
Http http = new Http();

req.setMethod(method1);
req.setEndpoint('https://' + bucketname1 + '.s3.us-east-1.amazonaws.com/'+ filename1);

req.setHeader('Date', formattedDateString1);
req.setHeader('Content-Type', 'application/xml');
req.setHeader('Content-Encoding', 'UTF-8');

string auth;
                
String stringToSign = 'GET' +
     '\n' +
    formattedDateString1 + '\n' +
    '/' + bucketname1 + '/' + bucketname1 + '/' + filename1;

String encodedStringToSign = EncodingUtil.urlEncode(stringToSign, 'UTF-8');
Blob mac = Crypto.generateMac('HMACSHA1', blob.valueof(stringToSign),blob.valueof(secret1));
String signed = EncodingUtil.base64Encode(mac);               

auth = 'AWS' + ' ' + key1 + ':' + signed;

req.setHeader('Authorization',auth);

HTTPResponse res = http.send(req);
System.debug('doc....'+res.getStatus());
System.debug('doc....'+res.getBody());

This is the error i get - <Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>AKIAJ4Z2VL6H3IYXAOSA</AWSAccessKeyId><StringToSign>GET

Kindly help
 
Hi 
Can you please help using batch apex to send approval reminder email to pending approver on Opportunity. I have an approval process setup with few related users as approvers, but to send the reminder email, time-based workflow process won't help as it needs to pick current pending approver name. Is there a way to capture the pending approver name in custom field and use it in workflow to send email alert? Or, can we have a batch class for this?

I have found below query to get the current pending approver name. Please let me know how to use it in batch apex to send reminder email after 48 hours of submitting for approval.

SELECT CompletedDate, ElapsedTimeInDays, ElapsedTimeInHours, ElapsedTimeInMinutes, Id, ProcessDefinitionId, Status, SubmittedById, TargetObjectId FROM ProcessInstance WHERE TargetObjectId = 'aaaaaaaa' And Status ='Pending'

SELECT ActorId,Comments,CreatedById,CreatedDate, ElapsedTimeInDays, ElapsedTimeInHours,   ElapsedTimeInMinutes,Id, OriginalActorId, ProcessInstanceId,  StepNodeId,StepStatus, SystemModstamp FROM ProcessInstanceStep where ProcessInstanceId='bbbbbbb'

Thanks.
I am trying to comment out a couple old triggers that my Org does not use anymore. They are commented out in the Sandbox and set to inactive. I have also commented out the test classes and the trigger handlers in the sandbox. 

But I am not able to deploy because one the triggers and two of the test classes are on an object that no longer exists. I am getting a  failure because my code coverage is only 63%  The tests that are failing are the ones that I want to turn off along with their trigger. How can I deal with this?
I have created a visual force page to display records on a map - it all work great but I want to change the field ref that is displayed when I click on an Icon - I have added the field into the code but it does nothing. The field that I want to add into the code is Facility_Name__c

I have tried replacing the var Name with this field ref and it will not change it so that the name appears when I hover over the marker - Any ideas what I have done wrong

<apex:page sidebar="false" showheader="false" controller="FacilityRemoter">
 
 
<head>
 
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0; padding: 0 }
  #map-canvas { height: 100% }
</style>
<script src="https://maps.googleapis.com/maps/api/js?key= AIzaSyC3GwkxsiGHfc0y5sheupDf7QzKtbFI4jg&region=AU">
 
</script>
<script>
var map;
function initialize() {
    var mapOptions = {
        center: new google.maps.LatLng(-16.45789579, 145.3789838),
        zoom: 15
    };
    map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
    loadFacilities();
}
function loadFacilities() {
    Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.FacilityRemoter.findAll}',
        function(result, event){
            if (event.status) {
                for (var i=0; i<result.length; i++) {
                    var id = result[i].Id;
                    var name = result[i].Name;
                    var lat = result[i].Location__Latitude__s;
                    var lng = result[i].Location__Longitude__s;
                    addMarker(id, name, lat, lng);
                }
            } else {
                alert(event.message);
            }
        },
        {escape: true}
    );
}
function addMarker(id, name, lat, lng) {
    var marker = new google.maps.Marker({
            position: new google.maps.LatLng(lat, lng),
            map: map,
            title: name
    });
    google.maps.event.addListener(marker, 'click', function(event) {
        window.top.location = '/' + id;
    });
}
 
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
  <div id="map-canvas"/>
</body>
</apex:page>
Hi all,

I am trying to create a simple visualforce page, which I can then display in a lightning component on lightning page layout.  The issue I am running into is that part of the in-line edit is being cut-off on my page.  See below image.
In Line Edit
Here is my visualforce page code:
<apex:page standardController="Contact" lightningStylesheets="true">
  <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">
    <head>
      <meta charset="utf-8" />
      <meta http-equiv="x-ua-compatible" content="ie=edge" />
      <title>Contact Details</title>
      <meta name="viewport" content="width=device-width, initial-scale=1" />
      
      <apex:slds />
    </head>
    <body>
      <div class="slds-scope">
          <apex:form styleClass="slds-form-element slds-size_2-of-2" >
              <apex:pageBlock >
                  <apex:pageBlockSection title="Basic">
                      <apex:pageBlockSectionItem >
                          <apex:outputlabel value="Name: "/>
                          <apex:outputField value="{!Contact.Name}">
                              <apex:inlineEditSupport event="ondblClick"/>
                          </apex:outputField>
                      </apex:pageBlockSectionItem>
                      
                      <apex:pageBlockSectionItem >
                          <apex:outputlabel value="Account Name: " />
                          <apex:outputField value="{!Contact.AccountID}">
                              <apex:inlineEditSupport event="ondblClick"/>
                          </apex:outputField>
                      </apex:pageBlockSectionItem>
                      
                      <apex:pageBlockSectionItem >
                          <apex:outputlabel value="Title: " />
                          <apex:outputField value="{!Contact.Title}">
                              <apex:inlineEditSupport event="ondblClick"/>
                          </apex:outputField>
                      </apex:pageBlockSectionItem>
                      
                      <apex:pageBlockSectionItem >
                          <apex:outputlabel value="Email: " />
                          <apex:outputField value="{!Contact.Email}">
                              <apex:inlineEditSupport event="ondblClick"/>
                          </apex:outputField>
                      </apex:pageBlockSectionItem>
                  </apex:pageBlockSection>
              </apex:pageBlock>
          </apex:form>
      </div>
    </body>
  </html>
</apex:page>
Any thoughts on how to fix this page?
Hi,
I am unable to create Opportunity with CRED permissions on profile. On click of New Opportunity, I am able to see the record type selection page, but when I select record type and click on Continue button, it says Insufficient privileges. Could someone please help me with this?
Thanks.
Hi,
   I got this question in some interview, where I tried to solve but unsuccessful. Please help me out.

trigger to rollup opportunity amount on Account field where opportunity
record type is "Revenue Type"
Opportunity field: Opty_Amount_C
Account field: Total_Opty_Amount_C
We are looking for a part time Salesforce developer to participate in several adhoc projects. The ideal candidate will have the following attributes and qualifications:
  • Superior written and verbal communciation skills
  • Through knowledge of the salesforce platform
  • Experience writing Visualforce pages and developing Apex code
  • Familiar with process builder and visual flows
  • Well versed in the transition from classic experience to lightning
  • U.S. citizen