• Duncan Barr 2
  • NEWBIE
  • 5 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 6
    Replies
I’m developing an Apex callout using a continuation with the HttpRequest class. I’ve defined the Named Credential and turned off the “Generate Authorization Header” setting in the definition of the Named Credential. If I do the callout synchronously Salesforce doesn’t generate or include any Athorization header (as expected) and all is well. However if I do the callout using a Continuation Salesforce ignores this setting and still sends an Authorizarion header. This is causing 401 errors on my endpoint, I set the auth in a custom header, which is why I don’t want salesforce to generate that header. 

Has anyone faced or overcome this, or know why salesforce is ignoring this setting?
I'm using lightning dataTable component.  But the sortedDirection only ever sorts one direction.  The sortDirection param never updates properly. Here is some code:
 
<aura:component implements="flexipage:availableForAllPageTypes" 
                controller="CrossSellActivityController"
                access="global">

  <!-- Attributes -->
  <aura:attribute name="activities" type="Array" />
  <aura:attribute type="String" name="sortedDirection" default="asc" />
  <aura:attribute name="columns" type="List" />

  <!-- Component DOM -->
  <div>
    <lightning:datatable keyField="id"
                         data="{!v.activities}"
                         columns="{!v.columns}"
                         sortedDirection="{!v.sortedDirection}"
                         onsort="{!c.updateColumnSorting}"
                         hideCheckboxColumn="true" />
  </div>

</aura:component>
Here is the column definition:
var columns = [
  { label: 'Program Key', fieldName: 'Program_Key__c', type: 'text', sortable: true },
  { label: 'Status', fieldName: 'Disposition__c', type: 'text', sortable: true },
  { label: 'User', fieldName: 'Username', type: 'text', sortable: true },
  { label: 'Asset', fieldName: 'Asset', type: 'text', sortable: true },
  { 
    label: 'Timestamp', 
    fieldName: 'CreatedDate', 
    type: 'date', 
    typeAttributes: {
      day: 'numeric',
      month: 'short',
      year: 'numeric',
      hour: '2-digit',
      minute: '2-digit',
      second: '2-digit',
      hour12: true
    },
    sortable: true
  }
];
component.set("v.columns", columns);
And where I console.log out the sortedDirection variable:
updateColumnSorting : function(component, event, helper) {
  var sortDirection = event.getParam('sortDirection');        
  component.set("v.sortedDirection", sortDirection);
  console.log('sortDirection: ', sortDirection);
},
The console.log always outputs 'asc' never flips to 'desc'.  I've even tried changing the definition to Boolean with no luck.
<aura:attribute type="Boolean" name="sortedDirection" default="false" />
I've also tried flipping it myself with a truthy check and setting it back on the sortedDirection attribute, but that doesn't work either.  Am I doing something wrong?


 
Hello,

Could you please help me understand why I receive the following error:
Delete failed. First exception on row 0 with id 04Z7E000000596S; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
Error is in expression '{!processRecord}' in component <apex:page> in page unlockopportunityrecord: External entry point
every time I try to unlock an Opportunity record.
The code in the apex class that I'm using is:
public with sharing class UnlockRecordDuringApprovalController {
        Opportunity objOpportunity;
        String objOpp;
	
        public UnlockRecordDuringApprovalController(ApexPages.StandardController controller) {
    	objOpportunity = (Opportunity)controller.getRecord();
	}
	
       public void processRecord() {
        Approval.UnlockResult unlockedRersult = Approval.unlock(objOpportunity);
        // Iterate through each returned result
        if (unlockedRersult.isSuccess()) {
            // Operation was successful, so get the ID of the record that was processed
            System.debug('Successfully unlocked opportunity with ID: ' + unlockedRersult.getId());
        }
        else {
            // Operation failed, so get all errors                
            for(Database.Error err : unlockedRersult.getErrors()) {
                System.debug('The following error has occurred.');                    
                System.debug(err.getStatusCode() + ': ' + err.getMessage());
                System.debug('opportunity fields that affected this error: ' + err.getFields());
            }
        }
    }    
}
and the Visual Force page code is:
<apex:page standardController="opportunity" extensions="UnlockRecordDuringApprovalController"  action="{!processRecord}" >
</apex:page>
Could you please explain what is causing this error to appear and prevent the unlock of the Opportunity record?

It is quite urgent to find a solution.

Thank you


 

In my apex code, system.now() returns the current Datetime based on a GMT calendar. My aim is to get the date time value in my local time zone.Since we have day light saving, I didn't think  about manipulating the time difference.

 

I would appreciate your suggestions.

 

Under personal information, I have set the time zone as "Time Zone(GMT-05:00) Eastern Daylight Time (America/New_York)".