• Aayush Mall
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

We are working on sandbox org which has an installed managed package.

This managed package has a custom object. I had to add a button on the Ligtning record detail page of the object. As this was the managed package object I was not having the edit access to the lightning page, hence I cloned the existing one and while editing the cloned one I dropped a custom lightning compnent from the App builder. 

When deploying the changes from Sandbox to Production. I created an outbound changeset and added the new page from the Ligtning Page section. 
This changeset on deploying to production fails with message.
"Invalid Component [Related_List_View]: missing required property[SObjecttype]"

Can anyone help me here. 

I have a managed package installed in my sandbox org.

The Manage package has an object named Transaction.
I need to add an action/button on the lightning page layout of the object detail page.

I followed below steps to achieve this.

1. In the Object Manager, I selected my custom object i.e "Transaction".

2. In Buttons, Links, and Actions I created "New Action" of action type as Lightning Component/ Custom Visualforce. Created Label and Name for the action.

3. Gone to page layouts of the object and added that button in the page layout.

Still, I am not able to view this button on the object detail page in lightning.

The same process I follow for adding buttons on Account page and other custom object pages which are not part of any managed package.

Is this the issue of changing the layout of a managed package object. I reviewed this link which says we should be able to edit everything in the layout inside a managed package.

The Managed package which I am using is of Sage Financials.
I need to upload a csv file from Apex to a global bucket in s3 and keep the URL.

Below described is my approach for the same using AWS request signing process.
 
public static void uploadCSVFileToS3(String csvFile, String filename, String awsAccessKey, String awsSecretKey, String bucketname){
        try{
            String formattedDateString = Datetime.now().format('EEE, dd MMM yyyy HH:mm:ss');
            String requestType = 'PUT';
            String contentType = 'text/csv';
            String filePath = 'https://s3.amazonaws.com' + '/'+ bucketname + '/' + 'demo.csv';
            
            HttpRequest req = new HttpRequest();
            req.setMethod(requestType);
            req.setHeader('Host','https://s3.amazonaws.com');
            req.setEndpoint(filePath);
            req.setHeader('Content-Length', String.valueOf(csvFile.length()));
            req.setHeader('Content-Type', contentType);
            req.setHeader('Date', formattedDateString);
            req.setHeader('ACL', 'public-read-write');
            Blob CSV = Blob.valueof(csvFile);
            req.setBodyAsBlob(CSV);
            
            String auth = createAuthHeader(requestType, contentType, filename, formattedDateString, bucketname, awsAccessKey, awsSecretKey);
            
            Http http = new Http();
            
            HTTPResponse res = http.send(req);
            System.debug('RESPONSE STRING: ' + res.toString());
            System.debug('RESPONSE STATUS: ' + res.getStatus());
            System.debug('STATUS_CODE: ' + res.getStatusCode());
        } catch(System.CalloutException e) {
            system.debug('AWS Service Callout Exception: ' + e.getMessage());
            system.debug('AWS Service Callout Exception: ' + e.getCause());
            system.debug('Exception: ' + e.getStackTraceString());
        } catch(Exception e) {
            system.debug('Exception: ' + e.getMessage());
            system.debug('Exception: ' + e.getStackTraceString());
        }  
    }

    public static String createAuthHeader(String method, String contentType, String filename, String formattedDateString, String bucket, String key, String secret){
        string auth;
        
        String stringToSign = method+'\n'+bucket+'/'+filename+'\n';
        Blob mac = Crypto.generateMac('HmacSHA1', blob.valueof(stringToSign), blob.valueof(secret));
        String sig = EncodingUtil.base64Encode(mac);
        auth = 'AWS' + ' ' + key + ':' + sig;
        
        
        return auth;
    }

I have followed the link here (https://developer.salesforce.com/forums/?id=906F0000000BMDFIA4) for the approach used.

I am able to upload the file to same bucket from ruby or javascript using the aws sdk's, but it is giving me a response code of 400 (Bad Request).
I think this is a problem of the process of signing request.

It will be highly appreciated if someone can help me here.
I have a managed package installed in my sandbox org.

The Manage package has an object named Transaction.
I need to add an action/button on the lightning page layout of the object detail page.

I followed below steps to achieve this.

1. In the Object Manager, I selected my custom object i.e "Transaction".

2. In Buttons, Links, and Actions I created "New Action" of action type as Lightning Component/ Custom Visualforce. Created Label and Name for the action.

3. Gone to page layouts of the object and added that button in the page layout.

Still, I am not able to view this button on the object detail page in lightning.

The same process I follow for adding buttons on Account page and other custom object pages which are not part of any managed package.

Is this the issue of changing the layout of a managed package object. I reviewed this link which says we should be able to edit everything in the layout inside a managed package.

The Managed package which I am using is of Sage Financials.
I need to upload a csv file from Apex to a global bucket in s3 and keep the URL.

Below described is my approach for the same using AWS request signing process.
 
public static void uploadCSVFileToS3(String csvFile, String filename, String awsAccessKey, String awsSecretKey, String bucketname){
        try{
            String formattedDateString = Datetime.now().format('EEE, dd MMM yyyy HH:mm:ss');
            String requestType = 'PUT';
            String contentType = 'text/csv';
            String filePath = 'https://s3.amazonaws.com' + '/'+ bucketname + '/' + 'demo.csv';
            
            HttpRequest req = new HttpRequest();
            req.setMethod(requestType);
            req.setHeader('Host','https://s3.amazonaws.com');
            req.setEndpoint(filePath);
            req.setHeader('Content-Length', String.valueOf(csvFile.length()));
            req.setHeader('Content-Type', contentType);
            req.setHeader('Date', formattedDateString);
            req.setHeader('ACL', 'public-read-write');
            Blob CSV = Blob.valueof(csvFile);
            req.setBodyAsBlob(CSV);
            
            String auth = createAuthHeader(requestType, contentType, filename, formattedDateString, bucketname, awsAccessKey, awsSecretKey);
            
            Http http = new Http();
            
            HTTPResponse res = http.send(req);
            System.debug('RESPONSE STRING: ' + res.toString());
            System.debug('RESPONSE STATUS: ' + res.getStatus());
            System.debug('STATUS_CODE: ' + res.getStatusCode());
        } catch(System.CalloutException e) {
            system.debug('AWS Service Callout Exception: ' + e.getMessage());
            system.debug('AWS Service Callout Exception: ' + e.getCause());
            system.debug('Exception: ' + e.getStackTraceString());
        } catch(Exception e) {
            system.debug('Exception: ' + e.getMessage());
            system.debug('Exception: ' + e.getStackTraceString());
        }  
    }

    public static String createAuthHeader(String method, String contentType, String filename, String formattedDateString, String bucket, String key, String secret){
        string auth;
        
        String stringToSign = method+'\n'+bucket+'/'+filename+'\n';
        Blob mac = Crypto.generateMac('HmacSHA1', blob.valueof(stringToSign), blob.valueof(secret));
        String sig = EncodingUtil.base64Encode(mac);
        auth = 'AWS' + ' ' + key + ':' + sig;
        
        
        return auth;
    }

I have followed the link here (https://developer.salesforce.com/forums/?id=906F0000000BMDFIA4) for the approach used.

I am able to upload the file to same bucket from ruby or javascript using the aws sdk's, but it is giving me a response code of 400 (Bad Request).
I think this is a problem of the process of signing request.

It will be highly appreciated if someone can help me here.