• Nithesh N
  • SMARTIE
  • 713 Points
  • Member since 2016


  • Chatter
    Feed
  • 16
    Best Answers
  • 1
    Likes Received
  • 8
    Likes Given
  • 12
    Questions
  • 150
    Replies
Hello developers,
I am fairly new to SF development. I have a custom VF page on a global quick action that creates an event. I want to make the vertical spacing on the page more appealing when viewed in SF1. I tried using the new lightningstylesheets="true" tag available in Winter 18, but it still doesn't look very good. I'd like to have more vertical spacing between my inputfields, for starters. Two other strange things I've noticed: searching on the account field cancels out of the screen on iPhone and after saving it navigates back to the home screen. I'd like it to navigate to the new event. Any help or advice is greatly appreciated.
 
<apex:page controller="NewMeeting" lightningStylesheets="true">
<apex:form >
  
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockSection id="eventInformation" columns="1">

    <apex:inputfield label="{!accountLabel}" value="{!dummyContact.AccountId}" >
        <apex:actionSupport action="{!changeAccount}" event="onchange" rerender="eventInformation" />
    </apex:inputField>
    <apex:selectList label="{!contactLabel}" value="{!contactId}" size="1" rendered="{!showContactOptions}" id="contactselectlist">
        <apex:selectOptions value="{!contactOptions}" />
        <apex:actionSupport action="{!changeContact}" event="onchange" rerender="eventInformation" />
    </apex:selectList>
    <apex:pageBlockSectionItem rendered="{!!showContactOptions}"/>
    <apex:inputfield value="{!ev.subject}"/> 
    <apex:inputfield value="{!ev.description}"/>     
</apex:pageBlockSection>
        
<apex:pageBlockbuttons >
   <apex:commandbutton value="Save" action="{!save}" /> 
   <apex:commandbutton value="Cancel" action="{!cancel}" /> 
</apex:pageBlockbuttons>    
    
</apex:pageBlock>
      
</apex:form>
</apex:page>
Say I have two separate lightning resources: A, and B.

How would I pass variables between the two? If, for example, in page A I get all the individuals for whom I can generate profiles (example: word docs) how do I then pass that list of people eligible for profile generation to B, where I can then iterate through the values to generate them?

Or is there an elegant solution to the problem that I didn't see?
Hi All,

I am still learning how to write test class coverage.  Working on an org where a controller never had proper test code coverage.  

Here is the controller:
public class UpdateResumeController {
    
    public List<Organizational_History__c> breakthroughHistoryList {get; set;}
    public List<Organizational_History__c> educationHistoryList {get; set;}
    public List<Organizational_History__c> employmentHistoryList {get; set;}
    public List<SelectOption> sitesOptionList {get; set;}
    public Boolean editBreakthrough {get; set;}
    public Boolean editEducation {get; set;}
    public Boolean editEmployment {get; set;}
    public Boolean allowEdit {get; set;} 
    public String loggedInContactId;
    private Id organizationId;
    private Id breakthroughRecordTypeId;
    private Id educationRecordTypeId;
    private Id employmentRecordTypeId;
    
    public String getLoggedInContactId() {
        return loggedInContactId;
    }
    
    public void setLoggedInContactId(String currentContactId) {
        if (String.isEmpty(loggedInContactId)) {
            loggedInContactId = currentContactId;
            breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
            educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c, Country__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
            employmentHistoryList = [SELECT Employer__c, Role__c, City__c, State__c, Country__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
            organizationId = [SELECT AccountId FROM Contact WHERE Id = :loggedInContactId].AccountId;
            breakthroughRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough History'].Id;
            educationRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Educational History'].Id;
            employmentRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Employment History'].Id;
        }
    }
    
    public UpdateResumeController(){
        sitesOptionList = new List<SelectOption>();
        List <Account> sitesList = [SELECT Portal_Display_Name__c FROM Account WHERE RecordType.Name = 'Breakthrough Organization' AND Program_Status__c IN ('Active', 'Inactive')];
        for (Account acc : sitesList){
            if (acc.Portal_Display_Name__c != null){
                sitesOptionList.add(new SelectOption(acc.Id, acc.Portal_Display_Name__c));
            }
        }
        editBreakthrough = false;
        editEducation = false;
        editEmployment = false;
        String contactId = ApexPages.currentPage().getParameters().get('Id');
        system.debug(contactId);
        system.debug(loggedInContactId);
        allowEdit = loggedInContactId == contactId || contactId == null;
    }
    
    public void enableEditBreakthrough(){
        editBreakthrough = true;
    }
    public void cancelEditBreakthrough(){
        breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
        editBreakthrough = false;
    }
    public void addBreakthroughHistory(){
        List<Organizational_History__c> breakthroughHistoryListAux = new List<Organizational_History__c>();
        breakthroughHistoryListAux.add(new Organizational_History__c(Breakthrough_Contact__c=loggedInContactId, RecordTypeId = breakthroughRecordTypeId));
        breakthroughHistoryListAux.addAll(breakthroughHistoryList);
        breakthroughHistoryList = breakthroughHistoryListAux;
        enableEditBreakthrough();
    }
    public void saveBreakthroughHistory(){
        upsert breakthroughHistoryList;
        editBreakthrough = false;
    }
    
    public void enableEditEducation(){
        editEducation = true;
    }
    public void cancelEditEducation(){
        educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c, Country__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
        editEducation = false;
    }
    public void addEducationHistory(){
        List<Organizational_History__c> educationHistoryListAux = new List<Organizational_History__c>();
        educationHistoryListAux.add(new Organizational_History__c(Organization__c = organizationId, Education_Contact__c=loggedInContactId, RecordTypeId = educationRecordTypeId));
        educationHistoryListAux.addAll(educationHistoryList);
        educationHistoryList = educationHistoryListAux;
        enableEditEducation();
    }
    public void saveEducationHistory(){
        upsert educationHistoryList;
        editEducation = false;
    }
    
    public void enableEditEmployment(){
        editEmployment = true;
    }
    public void cancelEditEmployment(){
        employmentHistoryList = [SELECT Employer__c, Role__c, City__c, Country__c, State__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
        editEmployment = false;
    }
    public void addEmploymentHistory(){
        List<Organizational_History__c> employmentHistoryListAux = new List<Organizational_History__c>();
        employmentHistoryListAux.add(new Organizational_History__c(Organization__c = organizationId, Employment_Contact__c=loggedInContactId, RecordTypeId = employmentRecordTypeId));
        employmentHistoryListAux.addAll(employmentHistoryList);
        employmentHistoryList = employmentHistoryListAux;
        enableEditEmployment();
    }
    public void saveEmploymentHistory(){
        upsert employmentHistoryList;
        editEmployment = false;
    }
    
    public PageReference deleteRecord(){
        String recordId = Apexpages.currentPage().getParameters().get('recordId');
        String recordType = Apexpages.currentPage().getParameters().get('recordType');
        system.debug(recordType);
        system.debug(recordId);
        delete [SELECT Id FROM Organizational_History__c WHERE Id = :recordId];
        Integer i = 0;
        if (recordType == 'breakthrough'){
            breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
        } else if (recordType == 'education'){
            educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
        } else if (recordType == 'employment'){
            employmentHistoryList = [SELECT Employer__c, Role__c, City__c, State__c, Country__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
        }
        return null;
    }
}
Here is the test class (not sufficient only at 20%):
@isTest
private class UpdateResumeControllerTest {

  static testMethod void myUnitTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    //insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
      
        urc.enableEditBreakthrough();
      
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
}

 
I want to create a Visualforce page that displays a set of repeating tables (2 cells x 2 cells each).

How do you reference the Controller in the Apex Page to repeat so that each table shows one record?

Apex Class:
public class Repeat1 {
	public List<pba_Listing__c> ListingFields {get;set;}
	
	public GetData() {
        [Select Name, pba_Status__c From pba_Listing__c WHERE pba_Status__c = 'Active' or pba_Status__c = 'Hold Short Sale' or pba_Status__c = 'Hold Standard Sale'];
	}
    
}
Visualforce page:
 
<apex:page Controller="Repeat1" recordSetVar="a1">
    <apex:pageBlock title="Listing">
        <apex:repeat>
        	<apex:pageBlockTable value="{!a1}" var="a">
        		<table>
            		<tr>
            			<th>Name</th>
            			<th><apex:outputField value="{!a.Name}"/></th>
            		</tr>
            		<tr>
             			<td>Status</td>
                		<td><apex:outputField value="{!a.pba_Status__c}"/></td>
            		</tr>
		        </table>
        	</apex:pageBlockTable>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>


 
I'm trying to write a visualforce page that displays variables from an Apex Class in a table.

Here's the Apex Class
 
public class SettersTestController {
    
    public list <Task> ListCallAry
    Integer CallAry =  [SELECT count()  
                                            FROM Task  
                                            WHERE skyplatform__Is_Call_Record__c = TRUE
                                            And CreatedDate = THIS_MONTH
                                            And CreatedBy = '0056A000001IVgU'];
    
    public list <Event> ListSetAry
    Integer SetAry =  [SELECT count()  
                                            FROM Event  
                                            WHERE RecordTypeId = '0126A0000004Qle'
                                            And CreatedDate = THIS_MONTH
                                            And Appoint_Set_By__c = '0056A000001IVgU'];
    
    public list <Event> ListShownAry
    Integer ShownAry =  [SELECT count()  
                                            FROM Event  
                                            WHERE RecordTypeId = '0126A0000004Qle'
                                            And Type = 'Appointment - Shown'
                                            And ActivityDateTime = THIS_MONTH
                                            And Appoint_Set_By__c = '0056A000001IVgU'];
​}

And then the Visualforce Page:

<apex:page Controller="SettersTestController">
<apex:pageBlock title="Test">
    <apex:pageBlockSection>
        <table>
            <tr>
            	<th>Name</th>
            	<th>Calls</th>
            	<th>Set</th>
            	<th>Shown</th>
            </tr>
            <tr>
          		<td>Ary</td>
        		<td><apex:outputField value="{!Task.ListCallAry}"/></td>
                        <td><apex:outputField value="{!Event.ListSetAry}"/></td>
                        <td><apex:outputField value="{!Event.ListShownAry}"/></td>
            </tr>
        </table>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

The error message is "Unexpected Token: Integer"
how to achive this--
if child record get deleteed then parent record also should get deleted in lookup relationship

 
I have queried all the events in salesforce in a list now i want to loop through that list . if the startdate of event is between 12:00 AM to 1:00 PM i want to store in separate list ? how can i do it ?
Hello i have this trigger and works ok, the problem is that date field (not datetime) returns me the date in yyyy/mm/dd 00:00:00 format and i would like to get the date in DD/MM/YYYY format. This is the Date field Fecha_de_Vencimiento_de_Contrato__c

I will really appreciate your help

 List<Id> conIds = new List<Id>();
   
    if(trigger.isDelete){
        for(Proveedores__c c : Trigger.old){
            conIds.add(c.Cuenta__c);
        }
    }else{
        for(Proveedores__c c : Trigger.new){
        conIds.add(c.Cuenta__c);
        }
    }
    
    List<Account> ProveedoresAccount = [Select id, name, Proveedores_Resumen__c, (Select tipo_de_proveedor__c, Proveedores__c, 
                                        Fecha_de_Vencimiento_de_Contrato__c   from Proveedores__r) from Account where id in : conIds];   
    
    for(Account a: ProveedoresAccount){
        String Proveedores='';
        for(Proveedores__c pro : a.Proveedores__r){
            Proveedores=Proveedores+': '+pro.tipo_de_proveedor__c+': '+pro.Proveedores__c+': '+pro.Fecha_de_Vencimiento_de_Contrato__c +'/' ;       
        }
        a.Proveedores_Resumen__c= Proveedores;
        update(a);
    }
Hello,

Is it possible to include a visualforce (or HTML) page in a visualforce email template?

The use case is I have a set of data that changes, but needs to be appended to several different kinds of emails.  I would like to keep this data in a single visualforce page which I can update only once, and automatically include it at the end of the various other email templates I create.  

(I new here).  Thanks for the help.

I need to be able to show a subset of case fields to users who don't own those cases. They have full CRED to cases and thus full rights to cases they own, but for the cases they don't own, they should be able to see a handful of fields (not all of them). OWD for cases is Private.

My original solution was to create a custom object that would mimic the case fields that should be public and make that object's OWDs Public Read-Only. The object would have a lookup field to the case (so that the data can be pulled from the case and into this object via the Process Builder) as well as to accounts and contacts (so that the records of this object would show up in related lists on accounts and contacts). I posted this solution on the success community to see if anyone had a more elegant solution and someone suggested that using Visualforce would be easier. (Link to the success community post: https://success.salesforce.com/answers?id=9063A000000pHkMQAU).

I know next to nothing about VF (not a developer), but happy to learn, at least enough to try to build this thing. I've been looking at this: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_display_field_values.htm and this: https://salesforce.stackexchange.com/questions/65623/expose-a-child-objects-vf-page-in-parent-objects-page-layout and it looks like I could create a custom VF component that would include the case fields in question and place it on account and contact page layouts as a related list of sorts.This component would basically have to pull select case fields and display them to all users, regardless of case OWDs.

I have the following questions in conjunction with all of this:

  1. Is what I described possible?
  2. If it is, are the two linked resources enough to help me figure it out, or is there anything else I should study?
  3. How does security work for VF components? Can I just add it to people's profiles to make the data displayed in them visible to all, even though case OWDs normally restrict them from seeing those fields?
  4. What happens when you have multiple case records, too many to fit into the component? Do you set the VF componenet's hight and then if the records don't fit within the specified height, a scroll bar appears?
  5. Will this VF page work in the context of a service cloud console (e.g., if someone is looking at an account or contact page in the console, will the VF component be rendered properly, or would a separate component have to be designed for the console)?


Thank you in advance!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

Hello awesome developers!

I have a trigger that I created that should fire to rollup the count of Tasks assoctiated with a Lead in our ORG.  The trigger works as it should and the rollups are perfrorming as we want, however on all other objects (standard or custom) when a Task is being created we receive the following error. 

Apex trigger LeadCountOfTasks caused an unexpected exception, contact your administrator: LeadCountOfTasks: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.LeadCountOfTasks: line 11, column 1

I am seeign that the whoId is not being populated on Account Tasks as that is the WhatId and I think that is the issue with the error, but I am new to apex so I am not sure.  As you can see from my following code, I attemted on the line where this error is coming from, to exclude all tasks for objects other than leads, so again I am lost and lookign for some help to fix this one.  

Thank you in advance fo ryour help and I know one of you awesome Devs can help me with this one!

Shawn
 
trigger LeadCountOfTasks on Task (after delete, after insert, after undelete, after update) {
    Task [] tlist;
        if(Trigger.isDelete)
            tlist= Trigger.old;
        else
            tlist = trigger.new;
    set<id> lid = new set< id> ();
    
    If(!tlist.isEmpty()){
    for(Task ts : tlist)
    {   if(string.valueof(ts.WhoId).startswith('00Q') && ts.WhoId!=null && ts.whatId == null)
        lid.add(ts.Whoid);
    } 
    If(lid.size()>0){
    Map <id,Task > tmap = new Map <id, Task>([select id, Whoid from Task where Whoid in:lid]);
    Map <id, Lead> lmap = new Map <id, Lead>([select id,Count_Activity__c from lead where id in:lid ]);
    
        If(lmap.size()>0){
       List<Lead> llist = [SELECT Id, Count_Activity__c FROM Lead WHERE ID IN:lmap.values()]; 
    for(lead l : lmap.values())
    {
        set<id> tids = new set <id>();
        for(Task tt : tmap.values())
        {
           if(tt.WhoId== l.Id)
            tids.add(tt.id);
        }
        if(l.Count_Activity__c!=tids.size())
        l.Count_Activity__c=tids.size();
        
              tlist = [select id, Whoid from task where whoid in:lid ];
        for(lead le :llist)
        {
            for(Task te:tlist)
            {
                if(tlist.size()>0)
                le.Count_Activity__c = tlist.size();
            }
        }
        
        
    }
    If(lmap.size()>0){
    update lmap.values();
    }
    }
    }
    }
}

 
Hi All,

I'm trying to update the owner of the Account and the corresponding Contract for this account, on completion of the approval process for the Contract - In doing so , while the owner of the Account gets updated successfully , however, the moment I try to update the corresponding Contract an error is thrown which shows a recursive call - Please find the code below :
public void autoTransferAgreementToSales(Contract quNew,Contract quOld ){
     
        List<Account> AccountToUpd = new List<Account>();
        List<Contract > ContractToUpd = new List<Contract >();
        AccountToUpd = [Select Id, OwnerId,Approval_Completion_of_Contract__c from Account where Id = :quNew.AccountId ];
        Map<Id,AccountHistory> history = new Map<Id,AccountHistory>();
        for(AccountHistory t : [Select Acct.AccountId,Acct.OldValue, Acct.NewValue, Acct.Field From AccountHistory Acct Where Acct.Field = 'Owner']){
          if(t.NewValue instanceof ID){
             history.put(t.AccountId, t);
             System.debug('Old: '+ t.OldValue +' New: ' +t.NewValue);
          }  
    
        }
        
        System.debug('DEBUG: autoTransferAgreementToSales::AccountToUpd ********'+ AccountToUpd.size() );
        System.debug('DEBUG: autoTransferAgreementToSales::AccountFldHistory ********'+ history.size() );
         
        for(Account acc: AccountToUpd ) {
           acc.Approval_Completion_of_Contract__c = true;
           if(history.containsKey(acc.Id)){
                 String accOwnerId = String.valueOf(history.get(acc.Id).OldValue);
                 System.debug('DEBUG: autoTransferAgreementToSales::accOwnerId ********'+ accOwnerId );
                 acc.OwnerId     = accOwnerId ;
                  ContractToUpd = [Select Id, OwnerId,Approval_Completion_of_Contract__c  from Contract
                                  where Id=:quNew.Id and AccountId = :quNew.AccountId];
                  for(Contract cont: ContractToUpd ) {
                               cont.Approval_Completion_of_Contract__c = true;
                               cont.OwnerId = accOwnerId ;
                               System.debug('DEBUG: autoTransferAgreementToSales::cont.OwnerId********'+ cont.OwnerId);                            
                   }
                 
           }         
                      
        }
        System.debug('DEBUG: autoTransferAgreementToSales::AccountToUpd ********'+ AccountToUpd.size() );          
        if(AccountToUpd.size() > 0)
              update AccountToUpd ;  
        
       
        System.debug('DEBUG: autoTransferAgreementToSales::ContractToUpd ********'+ ContractToUpd.size() );       
        if(ContractToUpd.size() > 0)
              update ContractToUpd ;         
        
     
     }

Error thrown is : Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Update failed. First exception on row 0 with id 8000k00000092CkAAI; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SubmitForApprovalAgreement: maximum trigger depth exceeded Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck] Contract trigger event AfterUpdate for [8000k00000092Ck]: []".

Any help to resolve this recussion isssue will be much appreciated.

Thanks & Regards,

Debendra Ray
Hi All, 

Please keep your responses as simple as possible, I am learning :)

I created A Class, A controller, and a VF template to display the approval process details, however... The values returned are UserIDs and GMT time stamp - Additionally I can't seem to get a nice table in my visualforce template it doesn't seem to respect the percentages I give it or setting it to 100%. Image of wants below along with my code.

I assume I need to tell my class to give me the Actorname but thats not one of the values I can pull from = getApprovalSteps not sure how to accomplsih this or do I do this somwhere else? 

Class: 

public class OpportunityApprovalHistoryController {
    public String opptyId {get;set;}
    public List<ProcessInstanceHistory> getApprovalSteps() 
    {if (opptyId != null) {Opportunity quote = 
        
[Select Id, 

(Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, 
IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) 

from Opportunity where Id = :opptyId];

 return quote.ProcessSteps;}
 
 return new List<ProcessInstanceHistory> ();}}

Controller:
<apex:component controller="OpportunityApprovalHistoryController" access="global">

<apex:attribute name="oppId" assignTo="{!opptyId}" type="String" description="Id of the opportunity"/>

<apex:dataTable value="{!approvalSteps}" var="step">

<style></style>

<apex:facet name="caption">Approval History</apex:facet>
<apex:facet name="header">Details</apex:facet>

<apex:column width="20%">
<apex:facet name="header">Date</apex:facet>
<apex:outputText value="{!step.SystemModstamp}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Status</apex:facet>
<apex:outputText value="{!step.StepStatus}"/>
</apex:column>

<apex:column width="20%" >
<apex:facet name="header">Assigned To</apex:facet>
<apex:outputText value="{!step.OriginalActorid}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Actual Approver</apex:facet>
<apex:outputText value="{!step.ActorID}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Comments</apex:facet>
<apex:outputText value="{!step.Comments}"/>
</apex:column>

</apex:dataTable>
</apex:component>

VF Template

<messaging:emailTemplate subject="Opportunity {!relatedTo.Name} Submitted for {!relatedTo.Subscription_Discount_Percent__c}% Subscription Discount" recipientType="User" relatedToType="Opportunity">
<messaging:HtmlEmailBody >

<p>Hello {!recipient.Name},</p>

<p>Opportunity: {!relatedTo.Name} for {!relatedTo.Account.Name} has been submitted for approval: </p>

<html>
<head>
<meta content="text/css;charset=utf-8" http-equiv="Content-Type"/>
<meta name="Template" content="Response"/>
</head>
<body>
<p><b>Approval History</b>

<c:opportunityapprovalhistory oppId="{!relatedTo.Id}" />

</p>
</body>
</html>
</messaging:HtmlEmailBody>
</messaging:emailTemplate>

WHAT I WANT

User full name not ID; Date in this format 5/16/2017 Est, and columns that auto size to the text along with borders on the table. 

User-added image
After completing the trailhead for Lightning components, I'm trying one  in my sandbox now.   I'm missing something, and maybe it's my Attribute in the Component, but I'm not sure?  My output doesn't produce the {!v.Transactions[0].name} field (just the "[Transactions List...]".

Component
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" controller="ctrl_TransactionList">
   
    <aura:handler name="init" action="{!c.doInit}" value="{!this}" />
    
    <div class="slds-page-header" role="banner">
    	<div class="slds-grid">
        	<div class="slds-col">
   				[Transactions List...]<br/>
                <ui:outputText value="{!v.Transactions[0].name}" /> 
            </div>
        </div>
    </div>
    
</aura:component>
Componenet Controller
({
	doInit: function(component, event, helper) {
		console.log('doInit...'); 
        
       
        var action = component.get("c.getTransactions");
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(component.isValid() && state === "SUCCESS") {
                component.set("v.items", response.getReturnValue());
            } else {
                console.log("Failed with state: " + state);
            }
        });
        
        $A.enqueueAction(action);
	},
})

Apex Controller
public without sharing class ctrl_TransactionList {
    
    @AuraEnabled
    public static list<Transaction__c> getTransactions() {
        return [SELECT id,name,Payee__r.Name FROM Transaction__c WHERE id = 'a0T2A00000LDUQf'];
    }

}


 
Anyone tried using ​ltng:sendMessage ? According to documentation, It servbes as an event that we can use to send a "string or json" over to other component.  https://developer.salesforce.com/docs/component-library/bundle/ltng:sendMessage/documentation

I have tried using it but it didnt work. Pleas let me know if anyone used it. 

 

Is there any way we could access Address Standard object in Salesforce UI ? I may need to create a custom Address object, But if i could use the existing one, it would be great. There is a standard Address object according to the documentation , but only listed in SOAP API guide. 

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_address.htm

 

Can we use remoting in visualforce components??

 
Does anyone implemented  "Copy to Clipboard" functionality in Lightning, that works well with lightning service enabled?


Best,
Nithesh
Hi folks...Can you help me recreating this curl command into Rest callout...?
curl --request POST \
  --url https://api.imgur.com/3/image \
  --header 'authorization: Client-ID {{clientId}}' \
  --header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  --form image=R0lGODlhAQABAIAAAAAAAP/
What I have written so far...
String apiUrl = 'https://api.imgur.com/3/image'; 
        String apiKey = 'f714837c34e1426'; 
        String boundary = '----WebKitFormBoundary7MA4YWxkTrZu0gW';
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        req.setMethod('POST');    
        req.setEndpoint(url);
        Blob bodyValue = file;
        String authorizationHeader = 'Client-ID ' + apiKey;
        req.setHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
        req.setHeader('Authorization', authorizationHeader);
        req.setBodyAsBlob(bodyValue);
        HTTPResponse res = http.send(req);
        system.debug(res.getBody());
        return res.getBody();

Please help me finish the callout....? The blog post i was referencing is bit confusing. http://blog.deadlypenguin.com/blog/2016/02/09/jira-attaching-a-file-in-salesforce/

Thanks ...


 
Hey Everyone, 

I am having trouble displaying the Toast message, in a simple Lightning component, Following os the code.

Cmp
<aura:component implements="flexipage:availableForAllPageTypes" access="global">	

    <aura:attribute name="result" type="String" />
    
    <div aura:id="input" class="slds-box small" >
        <div aura:id="panelList">
            <header class="slds-m-bottom--small">
                <div class="slds-media slds-media--center slds-m-bottom--small">
                    <div class="slds-media__figure">
                        <lightning:icon iconName="utility:answer" />
                    </div>
                    <div class="slds-media__body">
                        <h2 class="slds-text-heading--small "> Text Analyzer </h2>
                    </div>
                </div>
                <div class="slds-form-element">
                    <label class="slds-form-element__label slds-assistive-text" for="searchBox">Search</label>
                    <div class="slds-form-element__control">
                        <ui:inputText aura:id="Text2Analyze" class="slds-input" placeholder="Enter any text..." change="{!c.updateSearch}"/>
                    </div>
                </div>
            </header>
        </div>
    </div>
    
</aura:component>

Controller.js
({
	updateSearch : function(component, event, helper) {
		var inputText = escape(component.find("Text2Analyze").get("v.value"));
        console.log(inputText.length);
        helper.toastThis(inputText.length, 'Input text Length')
	}
})

helper.js
({
	toastThis : function(message, title) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": title || "Error:",
            "message": message,
            "type": "error",
            "mode": "sticky"
        });
        toastEvent.fire();
    }
})

demo App
<aura:application extends="force:slds">
    <c:toastComponent />
</aura:application>

And This is the Error I am getting, when i tired to run it
Action failed: c:toastcomponent$controller$updateSearch [Cannot read property 'setParams' of undefined]
Failing descriptor: {c:toastcomponent$controller$updateSearch}


Please point out the mistakes i made. 

Best,
Nithesh
I created an lightning component that displays the Number and a footer text. But when i added it to the account page through lightning app builder, The surrounding margin size of the component is too big. Is there any way i can control the sizing of the component? 

P.S. I tried creating a css class with height and width properties. and added it to outer div. But it didnt work. 
User-added image
Hey All,
I was wondering is there any website where we can find some lightning tasks or challenges we can do to polish our skills in lightning? 

P.S. I am not talking about Trailhead...Already done that !
 
Can anyone tell me the major difference between them and in what situations we use each of them?

Thanks.
Lets Say I want to Create a Lightning Component in Which I need to a Rest Callout. 
My Question is , Instead of Doing it through Server-Side Controller, Can I Just do the Call from Clientside and call the server-side controller later according to the results of callout?

Please share your thoughts on this and let me know if I am missing something here...

Thanks in Advance.
Its a well known fact that loops inside of loops, especially nested more than once, can be catastrophic for CPU performance. 
for(Integer a = 1; a <= 100; a++) {
    for(Integer b = 1; b <= 100; b++) {
        for(Integer c = 1; c <= 100; c++) {
            System.debug(a * b * c);
        }
    }
}
Is there any alternative algorithm to avoid  nested loops?
I want to know the best practices to avoid the nested loop scenarios if possible.
Thanks !!

 
I want to call an apex method from a custom Button (Url type button) with some merge fields.
With lightning rolling out, I dont want to use Javascript button anymore. 

My Use-Case is to call an Apex static method which takes record id as parameter. 
Public static void methodToBeCalled(ID recordID) {
   //My Code Logic Here
}
From some blogs, I found that i can use REST APIs to do this, But no idea on how to implement it.
So, Please provide me any code sample or any pointers, I appreciate any help.
 
Hey All,
I was wondering is there any website where we can find some lightning tasks or challenges we can do to polish our skills in lightning? 

P.S. I am not talking about Trailhead...Already done that !
 

Is there any way we could access Address Standard object in Salesforce UI ? I may need to create a custom Address object, But if i could use the existing one, it would be great. There is a standard Address object according to the documentation , but only listed in SOAP API guide. 

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_address.htm

 

Can we use remoting in visualforce components??

 
'm working on a trigger for an org I do some volunteering for and I'm stuck (because I'm not good at this).  
Preservation_Object__c is the Master object and Preservation_Activities__c is the child account

It's supposed to update the parent object with the Activity_Type__c of most recent Activity_Date__c

When the Child record is updated or inserted, it works like it's supposed to.

With the trigger.isdelete added, I'm getting an "Attempt to de-reference a null object" error at line 5. 

Any thoughts on how this could get fixed?
trigger RollUpRecentActivity on Preservation_Activities__c (after insert, after update, before delete) {
    set<Id>setPreserveId = new set<Id>(); 
    list<Preservation_Object__c>listPreserve = new list<Preservation_Object__c>(); 
    if(trigger.isInsert || trigger.isUpdate || trigger.isdelete){
        for(Preservation_Activities__c oActivities:trigger.new){ 
            setPreserveId.add(oActivities.Preservation_Object__c); 
        }
    }
    system.debug('@developer-->setPreserveId: '+setPreserveId);
    if(setPreserveId.size()>0){ 
        for(Preservation_Activities__c oActivities:[
            Select Preservation_Object__c,id,Name,Activity_Type__c,Activity_Date__c  
            from Preservation_Activities__c 
            where Preservation_Object__c In:setPreserveId and Activity_Date__c != null and isDeleted = FALSE
            order by Activity_Date__c desc limit 1]){
                Preservation_Object__c oPreserve = new Preservation_Object__c();
                oPreserve.Id = oActivities.Preservation_Object__c;
                oPreserve.Last_Activity_Type__c = oActivities.Activity_Type__c;
                listPreserve.add(oPreserve);
            }
        system.debug('@developer-->listPreserve: '+listPreserve); 
        if(listPreserve.size()>0){ 
            update listPreserve;
        }
    }
}

 
Hello developers,
I am fairly new to SF development. I have a custom VF page on a global quick action that creates an event. I want to make the vertical spacing on the page more appealing when viewed in SF1. I tried using the new lightningstylesheets="true" tag available in Winter 18, but it still doesn't look very good. I'd like to have more vertical spacing between my inputfields, for starters. Two other strange things I've noticed: searching on the account field cancels out of the screen on iPhone and after saving it navigates back to the home screen. I'd like it to navigate to the new event. Any help or advice is greatly appreciated.
 
<apex:page controller="NewMeeting" lightningStylesheets="true">
<apex:form >
  
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockSection id="eventInformation" columns="1">

    <apex:inputfield label="{!accountLabel}" value="{!dummyContact.AccountId}" >
        <apex:actionSupport action="{!changeAccount}" event="onchange" rerender="eventInformation" />
    </apex:inputField>
    <apex:selectList label="{!contactLabel}" value="{!contactId}" size="1" rendered="{!showContactOptions}" id="contactselectlist">
        <apex:selectOptions value="{!contactOptions}" />
        <apex:actionSupport action="{!changeContact}" event="onchange" rerender="eventInformation" />
    </apex:selectList>
    <apex:pageBlockSectionItem rendered="{!!showContactOptions}"/>
    <apex:inputfield value="{!ev.subject}"/> 
    <apex:inputfield value="{!ev.description}"/>     
</apex:pageBlockSection>
        
<apex:pageBlockbuttons >
   <apex:commandbutton value="Save" action="{!save}" /> 
   <apex:commandbutton value="Cancel" action="{!cancel}" /> 
</apex:pageBlockbuttons>    
    
</apex:pageBlock>
      
</apex:form>
</apex:page>
Say I have two separate lightning resources: A, and B.

How would I pass variables between the two? If, for example, in page A I get all the individuals for whom I can generate profiles (example: word docs) how do I then pass that list of people eligible for profile generation to B, where I can then iterate through the values to generate them?

Or is there an elegant solution to the problem that I didn't see?
Hi All,

I am still learning how to write test class coverage.  Working on an org where a controller never had proper test code coverage.  

Here is the controller:
public class UpdateResumeController {
    
    public List<Organizational_History__c> breakthroughHistoryList {get; set;}
    public List<Organizational_History__c> educationHistoryList {get; set;}
    public List<Organizational_History__c> employmentHistoryList {get; set;}
    public List<SelectOption> sitesOptionList {get; set;}
    public Boolean editBreakthrough {get; set;}
    public Boolean editEducation {get; set;}
    public Boolean editEmployment {get; set;}
    public Boolean allowEdit {get; set;} 
    public String loggedInContactId;
    private Id organizationId;
    private Id breakthroughRecordTypeId;
    private Id educationRecordTypeId;
    private Id employmentRecordTypeId;
    
    public String getLoggedInContactId() {
        return loggedInContactId;
    }
    
    public void setLoggedInContactId(String currentContactId) {
        if (String.isEmpty(loggedInContactId)) {
            loggedInContactId = currentContactId;
            breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
            educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c, Country__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
            employmentHistoryList = [SELECT Employer__c, Role__c, City__c, State__c, Country__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
            organizationId = [SELECT AccountId FROM Contact WHERE Id = :loggedInContactId].AccountId;
            breakthroughRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough History'].Id;
            educationRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Educational History'].Id;
            employmentRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Employment History'].Id;
        }
    }
    
    public UpdateResumeController(){
        sitesOptionList = new List<SelectOption>();
        List <Account> sitesList = [SELECT Portal_Display_Name__c FROM Account WHERE RecordType.Name = 'Breakthrough Organization' AND Program_Status__c IN ('Active', 'Inactive')];
        for (Account acc : sitesList){
            if (acc.Portal_Display_Name__c != null){
                sitesOptionList.add(new SelectOption(acc.Id, acc.Portal_Display_Name__c));
            }
        }
        editBreakthrough = false;
        editEducation = false;
        editEmployment = false;
        String contactId = ApexPages.currentPage().getParameters().get('Id');
        system.debug(contactId);
        system.debug(loggedInContactId);
        allowEdit = loggedInContactId == contactId || contactId == null;
    }
    
    public void enableEditBreakthrough(){
        editBreakthrough = true;
    }
    public void cancelEditBreakthrough(){
        breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
        editBreakthrough = false;
    }
    public void addBreakthroughHistory(){
        List<Organizational_History__c> breakthroughHistoryListAux = new List<Organizational_History__c>();
        breakthroughHistoryListAux.add(new Organizational_History__c(Breakthrough_Contact__c=loggedInContactId, RecordTypeId = breakthroughRecordTypeId));
        breakthroughHistoryListAux.addAll(breakthroughHistoryList);
        breakthroughHistoryList = breakthroughHistoryListAux;
        enableEditBreakthrough();
    }
    public void saveBreakthroughHistory(){
        upsert breakthroughHistoryList;
        editBreakthrough = false;
    }
    
    public void enableEditEducation(){
        editEducation = true;
    }
    public void cancelEditEducation(){
        educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c, Country__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
        editEducation = false;
    }
    public void addEducationHistory(){
        List<Organizational_History__c> educationHistoryListAux = new List<Organizational_History__c>();
        educationHistoryListAux.add(new Organizational_History__c(Organization__c = organizationId, Education_Contact__c=loggedInContactId, RecordTypeId = educationRecordTypeId));
        educationHistoryListAux.addAll(educationHistoryList);
        educationHistoryList = educationHistoryListAux;
        enableEditEducation();
    }
    public void saveEducationHistory(){
        upsert educationHistoryList;
        editEducation = false;
    }
    
    public void enableEditEmployment(){
        editEmployment = true;
    }
    public void cancelEditEmployment(){
        employmentHistoryList = [SELECT Employer__c, Role__c, City__c, Country__c, State__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
        editEmployment = false;
    }
    public void addEmploymentHistory(){
        List<Organizational_History__c> employmentHistoryListAux = new List<Organizational_History__c>();
        employmentHistoryListAux.add(new Organizational_History__c(Organization__c = organizationId, Employment_Contact__c=loggedInContactId, RecordTypeId = employmentRecordTypeId));
        employmentHistoryListAux.addAll(employmentHistoryList);
        employmentHistoryList = employmentHistoryListAux;
        enableEditEmployment();
    }
    public void saveEmploymentHistory(){
        upsert employmentHistoryList;
        editEmployment = false;
    }
    
    public PageReference deleteRecord(){
        String recordId = Apexpages.currentPage().getParameters().get('recordId');
        String recordType = Apexpages.currentPage().getParameters().get('recordType');
        system.debug(recordType);
        system.debug(recordId);
        delete [SELECT Id FROM Organizational_History__c WHERE Id = :recordId];
        Integer i = 0;
        if (recordType == 'breakthrough'){
            breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
        } else if (recordType == 'education'){
            educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
        } else if (recordType == 'employment'){
            employmentHistoryList = [SELECT Employer__c, Role__c, City__c, State__c, Country__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
        }
        return null;
    }
}
Here is the test class (not sufficient only at 20%):
@isTest
private class UpdateResumeControllerTest {

  static testMethod void myUnitTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    //insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
      
        urc.enableEditBreakthrough();
      
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
}

 
I want to create a Visualforce page that displays a set of repeating tables (2 cells x 2 cells each).

How do you reference the Controller in the Apex Page to repeat so that each table shows one record?

Apex Class:
public class Repeat1 {
	public List<pba_Listing__c> ListingFields {get;set;}
	
	public GetData() {
        [Select Name, pba_Status__c From pba_Listing__c WHERE pba_Status__c = 'Active' or pba_Status__c = 'Hold Short Sale' or pba_Status__c = 'Hold Standard Sale'];
	}
    
}
Visualforce page:
 
<apex:page Controller="Repeat1" recordSetVar="a1">
    <apex:pageBlock title="Listing">
        <apex:repeat>
        	<apex:pageBlockTable value="{!a1}" var="a">
        		<table>
            		<tr>
            			<th>Name</th>
            			<th><apex:outputField value="{!a.Name}"/></th>
            		</tr>
            		<tr>
             			<td>Status</td>
                		<td><apex:outputField value="{!a.pba_Status__c}"/></td>
            		</tr>
		        </table>
        	</apex:pageBlockTable>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>


 
how to achive this--
if child record get deleteed then parent record also should get deleted in lookup relationship

 
Hello, I am trying to create new Platform Event using REST call. I have found an trailhead with “Spotted Bear” application, and it works on my dev environment (I also have own domain and connected app). Then I use following endpoint: https://test.salesforce.com/services/oauth2/authorize?response_type=code&client_id=cliend_id_from_connectedapp&redirect_uri=redirecturi

I get following response:
 
{
    "id": "https://login.salesforce.com/id/test/test",
    "asserted_user": true,
    "user_id": "test",
    "organization_id": "test",
    "username": "email@icloud.com",
    "nick_name": "email",
    "display_name": "Michal Surname",
    "email": "email@icloud.com",
    "email_verified": true,
    "first_name": "Michal",
    "last_name": "Surname",
    "timezone": "Europe/Dublin",
    "photos": {
        "picture": "https://myapp-dev-ed--c.eu11.content.force.com/profilephoto/id/F",
        "thumbnail": "https://myapp-dev-ed--c.eu11.content.force.com/profilephoto/id/T"
    },
    "addr_street": null,
    "addr_city": null,
    "addr_state": null,
    "addr_country": "PL",
    "addr_zip": null,
    "mobile_phone": null,
    "mobile_phone_verified": false,
    "is_lightning_login_user": false,
    "status": {
        "created_date": null,
        "body": null
    },
    "urls": {
        "enterprise": "https://myapp-dev-ed.my.salesforce.com/services/Soap/c/{version}/id",
        "metadata": "https://myapp-dev-ed.my.salesforce.com/services/Soap/m/{version}/id",
        "partner": "https://myapp-dev-ed.my.salesforce.com/services/Soap/u/{version}/id",
        "rest": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/",
        "sobjects": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/sobjects/",
        "search": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/search/",
        "query": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/query/",
        "recent": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/recent/",
        "tooling_soap": "https://myapp-dev-ed.my.salesforce.com/services/Soap/T/{version}/id",
        "tooling_rest": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/tooling/",
        "profile": "https://myapp-dev-ed.my.salesforce.com/0050Y000002PAnbQAG",
        "feeds": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/chatter/feeds",
        "groups": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/chatter/groups",
        "users": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/chatter/users",
        "feed_items": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/chatter/feed-items",
        "feed_elements": "https://myapp-dev-ed.my.salesforce.com/services/data/v{version}/chatter/feed-elements",
        "custom_domain": "https://myapp-dev-ed.my.salesforce.com"
    },
    "active": true,
    "user_type": "STANDARD",
    "language": "en_US",
    "locale": "en_IE_EURO",
    "utcOffset": 0,
    "last_modified_date": "2017-09-18T13:46:11.000+0000",
    "is_app_installed": true
}


 
As a response I get many fields, but I need only “id” and “rest” , but when I am trying to create new platform event via url: https://mydomain.my.salesforce.com/services/data/v40.0 /sobjects/Notification__e/
 
As a response I get only:
 
[
    {
        "message": "Session expired or invalid",
        "errorCode": "INVALID_SESSION_ID"
    }
]


 
I do not know what to do since there is no information about session_id: https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_events_publish_api.htm
 
 
Hi all,
I'm on the "App development with Salesforce DX" module, "Get ready to create an app" unit and then the topic, "Metadata Magic: Pull Changes into your Project" but am failing to understand a core concept.

I have created the salesforce dx project for the geolocation app and a scratch org with the salesforce DX CL. I have also created a Git account to use as my version control system.

What I don't understand is how do I actually pull metadata from my scratch org into my Git repository? The directions the trailhead topic give are:
See my note in bold below. 

As a best practice, immediately commit the source you brought into your project to a VCS. Scratch orgs are ephemeral and temporary, so you always want a backup of work you’ve saved locally.
Salesforce DX is version control agnostic, so you can use whatever system you prefer. Here’s an example of the Git commands you can use with GitHub. Use these one-time commands to initialize the repo and connect it to GitHub:

git init
git remote add origin [github ssh url]


***When I try the "git init" command in my windows command prompt - the command prompt tells me that "git" is not recognized as an internal or external command, operable program or batch file***

These commands commit the file to the repo, master:

git add -A
git commit -m “Added custom object and permset”
git push origin master

Whatever VCS you use, we recommend that you configure it to exclude the .sfdx folder from being added to the repository. This folder holds temporary information for your scratch orgs, so you don’t have to save it for posterity in your VCS. In git, you would add it to the .gitignore file.
Now your updated object definition is safe and sound in your VCS. But it isn’t very interesting without any associated data. Scratch orgs come with some standard data based on the edition you choose. However, it’s important to add some sample data that’s more relevant to the app or artifact you’re building. In our example, the new custom Location field could use some sample data. So let’s use the Salesforce CLI to add some for the new compound field.


I am not seeing instructions or a process to which you actually connect your Salesforce DX project to your VCS. Can anyone help me? Thanks!
Hi,

We are using the Bulk API to upsert Accounts and Contacts into Salesforce as they register in our system.

We make an upsert bulk request using an external ID. Then, we check if the Account was successfully upserted by getting information from a formula field that generates a score for the Account. Finally, we send this information to a third-party system.

The problem is that some Accounts upserted does not appear immediately in the GUI platform, and the users are complaining about information appearing in the third-party but not in Salesforce, and in our system the upsert request returned and the query for getting information successfully before the request to the third-party system was made. So, we are having some sort of delay between the Bulk API acknowledge the upsert request, and the information being available through the GUI.

Could you help me?
Hi Experts,

I have a requirement to provide users with a external website link in salesforce and authenticate the users on the external website.

Please suggest how should I proceed ( my org uses external IDP ) shall i go with oauth or single sign on( if possible), also can you share some documents
Is it possible to have a custom web service send back a report chart in its response?   If so, would love at least some high-level steps on how to accomplish this.
Hello Developers!

I have this trigger on opportunity which allows only $500 opportunity amount per day per user. Now Trigger seem to be working fine. But however, I have a question.
Since the upcoming record's Id is not availble in Trigger.New then why is it works at line 18? Wouldn't the opp.Id is null at that line?
Trigger FiveHundred_Dollars_Opp_Amount_Limit on Opportunity(Before Insert, Before Update, After UnDelete){
     
     If(Trigger.IsInsert || Trigger.IsUpdate || Trigger.IsUnDelete){
         
         For(Opportunity opp : Trigger.New){
             
             If(Opp.Amount > 500){
                 Opp.addError('Opportunitys Amount Can not be greater than $500 per day.');
             }
             else If(Opp.Amount == null){
                 // Let it go.
             }
             
             else If(opp.Amount != null){
                 
                 List<Opportunity> FetchingCurrentUsersTodaysOpps = [Select Id, Amount
                                                                             FROM Opportunity
                                                                                 WHERE Id != :Opp.Id
                                                                                 AND   CreatedDate = Today
                                                                                 AND   Amount != null
                                                                                 AND   OwnerId =:Opp.OwnerId];
                 Double SummingAmount = Opp.Amount;
                 If(!FetchingCurrentUsersTodaysOpps.IsEmpty()){
                     
                     For(Opportunity EveryOpp : FetchingCurrentUsersTodaysOpps){
                         SummingAmount += EveryOpp.Amount;
                     }
                 If(SummingAmount > 500){
                     Opp.addError('You have reached the miximum limit of $500 opportunity Amount Per Day.');
                 }
                 }
             }
         }
     }
}

Thank You!
Hi,

I want to call a Lightning Component event from a Visualforce page in a Community.

I've tried in this way
 
<div id="lightning" style=""></div>

<script>
$Lightning.use("c:TheApp", function() {
	$Lightning.createComponent("c:TheComponent", {},
		"lightning",
		function(cmp) {
			createdCmp = cmp;
			var myExternalEvent;
			myExternalEvent = $A.get("e.c:TheEvent");
			myExternalEvent.setParams({
				"p": 'p',
			});
		myExternalEvent.fire();
	});
});
</script>
It's working but it is not what I exactly want, because in this way the compnent is inserted in the page a runtime.

Is there a way to call the event without inserting the component a runtime, but inserting it in the page with the community builder ?

Thanks in advance.

HI All, I do not have much experience in Salesforce but i am learning and i came acroos this statement "You can use an object to change its own field values using trigger.new, but only in before triggers. In all after triggers, trigger.new is not saved, so a runtime exception is thrown"

I have two issue now 
a)  As it is mentioned we can not update Object in After Trigger but we can update it like below 
trigger AccountNumberUpdate on Account (before insert,after insert) {
list<Account> up = new list<Account>();


for (Account c : Trigger.new)
{
if (Trigger.isBefore)
{
if (String.isBlank(c.AccountNumber))
{
 c.AccountNumber.addError('Account Number Can not be bLanks');
  
}}

if (Trigger.isAfter)

{
 Account a = [Select Id,AccountNumber from Account where id = :c.id];
 a.AccountNumber = NULL;
 up.add(a);

}
update up;
}

b) (Refre Above Code)Second issue with order of execution lets say i have custom validation on field here AccountNumber and in all after trigger again i am making AccountNumber blank in that  case error will not throw because custom validation does not takes place after trigger . Is it limitation of salesforce ?

Regards,
Rajesh 
Hi - 

I've got a circumstance where I need to pass the name of a class method to another method which would execute then passed method.

Example:
the class I'd want to call:
public class1 {
    public static void methodA() {
    };
}

The class I'd pass the method name to...
public class2 {
   public static void methodRunner(string methodName) {
      run( class1.methodName() );  // call that would execute the method (TBD)
   }
}

so the call would be - 
class2.methodRunner( class1.methodA );

In case you're wondering why go to all this work? 
I'd like to create a generic way to run class methods as batch processes from the console in prod to efficiently retrofit existing data - without littering the prod org with lots of one-time use code.

Looking forward to everyone's collective insights...

Thanks,

Steve