• Eduardo Andrade
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 5
    Questions
  • 5
    Replies

Hi, I can query on ContentDistribution the url of a file that I manually shared with external.

Is it possible to generate that url from Apex?

Thanks

I've tried to use SLDS downloaded here: https://www.lightningdesignsystem.com/downloads/ (static resource) and loaded the css in my html with

<link rel="stylesheet" type="text/css" href="slds.css"> . It worked, but without loading font and icon. Is there a way to load all elements (folders in the static resource: fonts, icons, etc..) in my simple html?

Hi trailblazers,

​is there a way to process the inbound email and get the information of the email it is replying to?

For example, I'll send an email through apex and when a person answer to that email I could update some record related to the sended email based on that answer.

I understand how to process inbound emails like this examples (https://help.salesforce.com/articleView?id=code_inbound_email.htm&type=5) but I don't knwo if is possible to do what I want.

Hi, I'm new to create web services. I've created a class to update an opportunity, it worked in the workbench tool, but when I've tried the direct link (https://<myinstance>.salesforce.com/services/apexrest/opt/<opp id>) on the browser, it showed the following page error:

<Errors>
<Error>
<errorCode>INVALID_SESSION_ID</errorCode>
<message>Session expired or invalid</message>
</Error>
</Errors>

Is there a way I can pass session id through the url, or I have to create an application to deal with salesforce authentication?

Appreciate any help.

Hi, a have a simple trigger that creates a custom object depending on attachment name:

trigger CreateCustomObject on Attachment (before insert) {
	for(Attachment a : Trigger.New) {
        if(a.name.substring(0,6) == 'CO_SD-'){
            CustomObject__c io = new CustomObject__c(opportunity__c = a.ParentId, attachName__c = a.Name);
			insert io;
        }
    }
}


How can I test this trigger? I've tried this, but with no success:

@isTest
public class TestCreateCustomObject {
    @isTest static void TestOne(){
	
        Opportunity op = [select id from opportunity limit 1];
        insert op;

        Attachment at = new Attachment(name = 'CO_SD-test.txt', parentId = op.Id);
        insert at;
        
        List<CustomObject__c> co_list = [select id from CustomObject__c order by createddate desc limit 1];
        System.assertEquals(at.name, co_list[0].attachName__c);
        
    }
}
Thanks any idea.

Hi, I can query on ContentDistribution the url of a file that I manually shared with external.

Is it possible to generate that url from Apex?

Thanks

I am trying to create an apex trigger that subtracts the quantity from an inventory field of a custom object when the status of a seperate custom object's record's picklist is selected as shipped. I am new to apex programming and am not sure where to start.

Hi, a have a simple trigger that creates a custom object depending on attachment name:

trigger CreateCustomObject on Attachment (before insert) {
	for(Attachment a : Trigger.New) {
        if(a.name.substring(0,6) == 'CO_SD-'){
            CustomObject__c io = new CustomObject__c(opportunity__c = a.ParentId, attachName__c = a.Name);
			insert io;
        }
    }
}


How can I test this trigger? I've tried this, but with no success:

@isTest
public class TestCreateCustomObject {
    @isTest static void TestOne(){
	
        Opportunity op = [select id from opportunity limit 1];
        insert op;

        Attachment at = new Attachment(name = 'CO_SD-test.txt', parentId = op.Id);
        insert at;
        
        List<CustomObject__c> co_list = [select id from CustomObject__c order by createddate desc limit 1];
        System.assertEquals(at.name, co_list[0].attachName__c);
        
    }
}
Thanks any idea.

I use the password flow to get the access token like this:

 

curl -k https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=[clientid]" -d "client_secret=[clientsecret]" -d "username=[myusername]" -d "password=[mypassword][mysecuritytoken]"

 

which returns

 

{"id":"https://login.salesforce.com/id/00Di0000000JgfhEAC/005i0000000dbdwAAA",
"issued_at":"1366942091291",
"instance_url":"https://na15.salesforce.com",
"signature":"yZsqE5VvYAZb+2dVw2zUNFsTllZxy9JjZBMFxYIGcAI=",
"access_token":"00D...vZ1"}

 

Then I do

 

curl -k https://na15.salesforce.com/services/data/v27.0/chatter/users/me -H 'Authorization: Bearer 00D...vZ1'

 

but I get this error response:

 

[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]

curl: (6) Could not resolve host: Bearer
curl: (6) Could not resolve host: 00D...vZ1'

 

Any idea of what is wrong?

 

  • April 26, 2013
  • Like
  • 0
I have a custom lightning page with custom lightning component that related to the Account object.
I need to open this page by button in the same window.
How I can do it? 
I can set this component to VisualForce page, but maybe there is another option?