• Manto
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
I am trying to a callout to one of our webservice from my class. The call returns with exception : PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

A bit of googling gave me this link : https://help.salesforce.com/articleView?id=000326722&type=1&mode=1 and it says Salesforce's certificate trust policy is to require server and client certificate chains to include all intermediate certificates that exist between the server or client certificate and the chain's root certificate. When I spoke to our infra team, they say all certficates are bundled in same file, so they cant do any thing more than that. We have several systems working fine with this setup and this is first time Salesforce is trying to consume a webservice. I am not an expert in this certoificates stuff, can someone who has some insigths help me out please. Out certificate chain is below
Root: QuoVadis Global Root CA 2 G3 //In SF SSL CA list
Intermediate: QuoVadis  Global SSL ICA G3
bottom: our own certificate
Infra team says all these 3 are bundled in same file to avoid any issues. Any idea how can i proceed?
  • February 26, 2020
  • Like
  • 0
We are trying to Implement Custom JIT handler for one of our communities. Our main requirement isto create a community user, only when there is a contact record exists with 'student' record type. In ‘createUser’ method, before checking whether a contact exists, I need to make sure the request is for this particular community access. I was expecting communityId to be passed to the method and I can use that Id to verify the community. However communityId is null when createUser method gets called with NO existing user record. Here is the documentation link:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_Auth_SamlJitHandler.htm (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_Auth_SamlJitHandler.htm" style="color:#0563c1; text-decoration:underline)
communityId : The ID of the community. This parameter can be null if you’re not creating a community user.
This description is more confusing, as the decision to whether create a user or not is taken within this method. Since the SSO setup is same for other communities as well, I need to make sure I am creating new users for access top this community only.
Here is what my logic is:

global User createUser(Id samlSsoProviderId, Id communityId, Id portalId, String federationIdentifier, Map<String, String> attributes, String assertion) {

if(communityId != null && communityName == 'My New Community Name')
{
// Query User records with federation id = email, if found , return user
// if not, query contacts with email, if found create a new user and return newly created user (do not insert)
// return null if a matching contact not found
// note: I get community name using ConnectApi class, passing community Id
}
}

global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId, String federationIdentifier, Map<String, String> attributes, String assertion) {
   // get user with matching federation id and activate if inactive
}



Why is communityId null in createUser method?
In what other scenarios, createUser and updateUser methods gets called?
If communityId is null for createUser always, is it possible to pass this info as a key value pair in attributes map by the IDP provider? 
Please help
 
  • February 26, 2020
  • Like
  • 0
Hi all i need to create a record from json response
 
Http http = new Http();
            HttpRequest request = new HttpRequest();

            request.setEndpoint('xxxxxxxxxxxx');
            request.setMethod('POST');
         	request.setHeader( 'Content-Type', 'application/json' );
        	String JSONContent = 'xxxxxxxx';
        	request.setBody(JSONContent);
        	
            HttpResponse response = http.send(request);
        	
            if (response.getStatusCode() == 200) 
            {
                
              System.debug(response.getBody());
            }

The response i am getting is like this
 
-{
"settings" : -{
"success" : 1,
"message" : Call report return successfully. ,
"fields" : -[
call_report_id,
call_duration,
call_started_at,
call_end_at,
call_status,
call_case_id,
expert_notes,
expert_chat,
call_media_url,
call_media_status
]
},
"data" : -{
"call_detail" : -[
-{
"call_report_id" : 505usUAAQ,
"call_duration" : 00:00:03,
"call_started_at" : 2020-02-27 17:59:29,
"call_end_at" : ,
"call_status" : Waiting,
"call_case_id" : jklfgdjdklgjkldgjkldgjf,
"expert_notes" : ,
"expert_chat" : 
}
],
"call_medial" : -[
-{
"call_media_url" : ,
"call_media_status" : Pending
}
]
}
}
 i need to create a single record from above the response in a custom object.
for call_detail  and call_medial fields


Thanks in advance
trigger BaltimoreNo on Account (before insert) {
    for (Account acc : Trigger.new){
        if (acc.BillingCity='Baltimore'){
            alert ('Company XYZ will not do business in city of Baltimore');
     
        }
    }
}
I am trying to a callout to one of our webservice from my class. The call returns with exception : PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

A bit of googling gave me this link : https://help.salesforce.com/articleView?id=000326722&type=1&mode=1 and it says Salesforce's certificate trust policy is to require server and client certificate chains to include all intermediate certificates that exist between the server or client certificate and the chain's root certificate. When I spoke to our infra team, they say all certficates are bundled in same file, so they cant do any thing more than that. We have several systems working fine with this setup and this is first time Salesforce is trying to consume a webservice. I am not an expert in this certoificates stuff, can someone who has some insigths help me out please. Out certificate chain is below
Root: QuoVadis Global Root CA 2 G3 //In SF SSL CA list
Intermediate: QuoVadis  Global SSL ICA G3
bottom: our own certificate
Infra team says all these 3 are bundled in same file to avoid any issues. Any idea how can i proceed?
  • February 26, 2020
  • Like
  • 0
Hia @ll

I created a custom functionality to change several records in a custom object and I'm also create one button to access it. 
My problem is that I don't know how to return to the previous page once the action is completed.
You can invoke the button in a related list view or in a list view so I don't have a defined return list. I always want to go back to the page where the action is executed.
Is it possible to get this information?  
I'm usingin lighting experience.
 
public class taskSelectClassController {
     public  Account acct{get; set;}
       public string currentRecordId {get;set;}
       public  List<Id> tasksIds{set;get;} 
       public List<task__c> updatedRecords {get;set;}

        public taskSelectClassController(ApexPages.StandardController stdController) {
           currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
                tasksIds =new List<Id>();
        
            wraptaskList = new List<wraptask>();
            //-- if task is custom object then, you need to change this query
            //for(task a: [select AccountId,task Name from task limit 10]) 
     
           for(Task__c  a: [select Lookup_Account__c,Name from Task__c Where Lookup_Account__c = null limit 10])  {               
                wraptaskList.add(new wraptask(a));
            }
        }
    
    public List<wraptask> wraptaskList {get; set;}
    public List<task__c> selectedtasks{get;set;}
  
    public void processSelected() {
    selectedtasks = new List<task__c>();
      
        for(wraptask wraptaskObj : wraptaskList) {
            if(wraptaskObj.selected == true) { 
                
                selectedtasks.add(wraptaskObj.acc);
            }
            for(task__c var : selectedtasks)
            {
                tasksIds.add(var.Id);
            }
            List<task__c>taskRecords = [SELECT Lookup_Account__c from task__c where ID IN: tasksIds];
                updatedRecords = new List<task__c>();
            for( task__c chl : taskRecords ) {
            chl.Lookup_Account__c = currentRecordId;
            updatedRecords.add(chl);
               
        }
             update updatedRecords; 
    }
 
    public class wraptask
                          {
        public task__c acc {get; set;}
        public Boolean selected {get; set;}      
        public wraptask(task__c a) {
            acc = a;
            selected = false;
        }
    }
}
Hi Salesforce Experts,

I've below JSON : 

{
  "records": [
    {
      "childprods": [
        {
          "grandchilds": [
            {
              "Name": "Apple TV 1"
            },
            {
              "Name": "Apple TV 2"
            }
          ]
        }
      ]
    }
  ]


Now I want to deserialize this JSON and convert it into wrapper, and get the value of key 'Name' whose value is 'Apple TV 2'.

I've used below code to deserialize it and convert it into wrapper: 

public class recordWrapper(){
    public class grandchild(){
        public String Name;
    }
    public class childprod(){
        public List<grandchild> grandchilds;
    }
    public class record(){
        public List<childprod> childprods; 
    }
    public List<record> records;
}

String jsonBody2 = '{"records": [{"childprods": [{"grandchilds":[{"Name": "Apple TV 1"},{"Name": "Apple TV 2"}]}]}]}';

recordWrapper deserializeResults2 = (recordWrapper) JSON.deserialize(jsonBody2, recordWrapper.class);

System.debug('--deserializeResults2--'+deserializeResults2);

Below is the value of deserializeResults2 :
deserializeResults2--recordWrapper:[records=(record:[childprods=(childprod:[grandchilds=(grandchild:[Name=Apple TV 1], grandchild:[Name=Apple TV 2])])])]

Could you please tell me how to get the Name (with value Apple TV 2) through VF as well as apex.

Thanks in advance.
 
Hi,
I have a scenario where I have few records in a custom object. The custom object is in lookup relation with Account. In the child records I want to update the lookup filed using apex class.

 I have created a custom page where I have a checkbox to select recods. The selected record should be assigned to any parent record by clicking a button. I have attached the image of my custom page for your reference.

Can someone tell me how to achieve this scenario..
  • February 26, 2020
  • Like
  • 0
I have a test class with 70+ tests in it. Every single tests needs to create an Account, a Contact, and several custom objects. All of these Accounts, Contacts, etc... are the exact same.

Since all of these records need to be inserted again in every test case, this test class takes a very long time to run. Is it possible to create the account/contacts/etc... only 1 time, and have it be accessible in every test class so I don't have to re-insert them 77 times each?
I am having an issue with my lightning component or apex class.

It is a account detail page but receiving the below error. I can't seem to find the issue with my code so i am reaching out to anyone that can help me find the issue.
User-added image

Here is my controller and Component Info.

Component
<aura:component controller="AccountDetailsCtrl" implements="flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes,force:hasRecordId" access="global">
    <aura:attribute name="acc" type="Account"></aura:attribute>
    <aura:attribute name="recordId" type="String"></aura:attribute>
    
    <aura:attribute name="data" type="Object"/>
    <aura:attribute name="columns" type="List"/>

    <aura:handler name="init" action="{!c.doInit}" value="{!this}" />
    <aura:if isTrue="{!v.acc.Division__c || v.acc.Director_of_Operations__r || v.acc.Senior_Account_Manager__r || v.acc.Regional_Field_Manager_Contact__r || v.acc.Account_Manager__r}">





        <div class="slds-box">
            <table class="slds-table slds-table_cell-buffer slds-table_bordered">
                <thead>
                    <tr class="slds-line-height_reset">
                        <th class="division" scope="col">
                            <div class="slds-truncate" title="Division">Division : {!v.acc.Division__c}</div>
                        </th>
                    </tr>
                    <tr class="slds-line-height_reset">
                        <th class="title" scope="col">
                            <div class="slds-truncate" title="Title">Title</div>
                        </th>
                        <th class="name" scope="col">
                            <div class="slds-truncate" title="Name">Name</div>
                        </th>
                        <th class="email" scope="col">
                            <div class="slds-truncate" title="Email">Email</div>
                        </th>
                        <th class="phone" scope="col">
                            <div class="slds-truncate" title="Phone">Phone</div>
                        </th>
                        <th class="mobile" scope="col">
                            <div class="slds-truncate" title="Mobile">Mobile</div>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="slds-hint-parent">
                        <td data-label="Director of Operations title">
                            <div class="slds-truncate" title="Director of Operations">Director of Operations</div>
                        </td>
                        <td data-label="Name" class="name">
                            <div class="slds-truncate" title="{!v.acc.Director_of_Operations__r.Name}">{!v.acc.Director_of_Operations__r.Name}</div>
                        </td>
                        <td data-label="Email" class="email">
                            <div class="slds-truncate" title="{!v.acc.Director_of_Operations__r.Email}">{!v.acc.Director_of_Operations__r.Email}</div>
                        </td>
                        <td data-label="Phone" class="phone">
                            <div class="slds-truncate" title="{!v.acc.Director_of_Operations__r.Phone}">{!v.acc.Director_of_Operations__r.Phone}</div>
                        </td>
                        <td data-label="Mobile" class="mobile">
                            <div class="slds-truncate" title="{!v.acc.Director_of_Operations__r.MobilePhone}">{!v.acc.Director_of_Operations__r.MobilePhone}</div>
                        </td>
                    </tr>
                    <tr class="slds-hint-parent">
                        <td data-label="Senior Account Manager title">
                            <div class="slds-truncate" title="Senior Account Manager">Senior Account Manager</div>
                        </td>
                        <td data-label="Name" class="name">
                            <div class="slds-truncate" title="{!v.acc.Senior_Account_Manager__r.Name}">{!v.acc.Senior_Account_Manager__r.Name}</div>
                        </td>
                        <td data-label="Email" class="email">
                            <div class="slds-truncate" title="{!v.acc.Senior_Account_Manager__r.Email}">{!v.acc.Senior_Account_Manager__r.Email}</div>
                        </td>
                        <td data-label="Phone" class="phone">
                            <div class="slds-truncate" title="{!v.acc.Senior_Account_Manager__r.Phone}">{!v.acc.Senior_Account_Manager__r.Phone}</div>
                        </td>
                        <td data-label="Mobile" class="mobile">
                            <div class="slds-truncate" title="{!v.acc.Senior_Account_Manager__r.MobilePhone}">{!v.acc.Senior_Account_Manager__r.MobilePhone}</div>
                        </td>
                    </tr>
                    <tr class="slds-hint-parent">
                        <td data-label="District Manager title">
                            <div class="slds-truncate" title="District Manager">District Manager</div>
                        </td>
                        <td data-label="Name" class="name">
                            <div class="slds-truncate" title="{!v.acc.Regional_Field_Manager_Contact__r.Name}">{!v.acc.Regional_Field_Manager_Contact__r.Name}</div>
                        </td>
                        <td data-label="Email" class="email">
                            <div class="slds-truncate" title="{!v.acc.Regional_Field_Manager_Contact__r.Email}">{!v.acc.Regional_Field_Manager_Contact__r.Email}</div>
                        </td>
                        <td data-label="Phone" class="phone">
                            <div class="slds-truncate" title="{!v.acc.Regional_Field_Manager_Contact__r.Phone}">{!v.acc.Regional_Field_Manager_Contact__r.Phone}</div>
                        </td>
                        <td data-label="Mobile" class="mobile">
                            <div class="slds-truncate" title="{!v.acc.Regional_Field_Manager_Contact__r.MobilePhone}">{!v.acc.Regional_Field_Manager_Contact__r.MobilePhone}</div>
                        </td>
                    </tr>
                    <tr class="slds-hint-parent">
                        <td data-label="Account Manager title">
                            <div class="slds-truncate" title="Account Manager">Account Manager</div>
                        </td>
                        <td data-label="Name" class="name">
                            <div class="slds-truncate" title="{!v.acc.Account_Manager__r.Name}">{!v.acc.Account_Manager__r.Name}</div>
                        </td>
                        <td data-label="Email" class="email">
                            <div class="slds-truncate" title="{!v.acc.Account_Manager__r.Name}">{!v.acc.Account_Manager__r.Email}</div>
                        </td>
                        <td data-label="Phone" class="phone">
                            <div class="slds-truncate" title="{!v.acc.Account_Manager__r.Name}">{!v.acc.Account_Manager__r.Phone}</div>
                        </td>
                        <td data-label="Mobile" class="mobile">
                            <div class="slds-truncate" title="{!v.acc.Account_Manager__r.Name}">{!v.acc.Account_Manager__r.MobilePhone}</div>
                        </td>
                    </tr>
                    <tr class="slds-hint-parent">
                        <td data-label="Procurement Manager title">
                            <div class="slds-truncate" title="Procurement Manager">Procurement Manager</div>
                        </td>
                        <td data-label="Name" class="name">
                            <div class="slds-truncate" title="{!v.acc.Customer_Procurement_Mangager__r.Name}">{!v.acc.Customer_Procurement_Mangager__r.Name}</div>
                        </td>
                        <td data-label="Email" class="email">
                            <div class="slds-truncate" title="{!v.acc.Customer_Procurement_Mangager__r.Name}">{!v.acc.Customer_Procurement_Mangager__r.Email}</div>
                        </td>
                        <td data-label="Phone" class="phone">
                            <div class="slds-truncate" title="{!v.acc.Customer_Procurement_Mangager__r.Name}">{!v.acc.Customer_Procurement_Mangager__r.Phone}</div>
                        </td>
                        <td data-label="Mobile" class="mobile">
                            <div class="slds-truncate" title="{!v.acc.Customer_Procurement_Mangager__r.Name}">{!v.acc.Customer_Procurement_Mangager__r.MobilePhone}</div>
                        </td>
                    </tr>
                    <tr class="slds-hint-parent">
                        <td data-label="Finance Contact title">
                            <div class="slds-truncate" title="Procurement Manager">Finance Contact</div>
                        </td>
                        <td data-label="Name" class="name">
                            <div class="slds-truncate" title="{!v.acc.Customer_Finance_Contact__r.Name}">{!v.acc.Customer_Finance_Contact__r.Name}</div>
                        </td>
                        <td data-label="Email" class="email">
                            <div class="slds-truncate" title="{!v.acc.Customer_Finance_Contact__r.Name}">{!v.acc.Customer_Finance_Contact__r.Email}</div>
                        </td>
                        <td data-label="Phone" class="phone">
                            <div class="slds-truncate" title="{!v.acc.Customer_Finance_Contact__r.Name}">{!v.acc.Customer_Finance_Contact__r.Phone}</div>
                        </td>
                        <td data-label="Mobile" class="mobile">
                            <div class="slds-truncate" title="{!v.acc.Customer_Finance_Contact__r.Name}">{!v.acc.Customer_Finance_Contact__r.MobilePhone}</div>
                        </td>
                    </tr>
                    <tr class="slds-hint-parent">
                        <td data-label="Facilities Manager title">
                            <div class="slds-truncate" title="Procurement Manager">Facilities Manager</div>
                        </td>
                        <td data-label="Name" class="name">
                            <div class="slds-truncate" title="{!v.acc.Customer_Facilities_Manager__r.Name}">{!v.acc.Customer_Facilities_Manager__r.Name}</div>
                        </td>
                        <td data-label="Email" class="email">
                            <div class="slds-truncate" title="{!v.acc.Customer_Facilities_Manager__r.Name}">{!v.acc.Customer_Facilities_Manager__r.Email}</div>
                        </td>
                        <td data-label="Phone" class="phone">
                            <div class="slds-truncate" title="{!v.acc.Customer_Facilities_Manager__r.Name}">{!v.acc.Customer_Facilities_Manager__r.Phone}</div>
                        </td>
                        <td data-label="Mobile" class="mobile">
                            <div class="slds-truncate" title="{!v.acc.Customer_Facilities_Manager__r.Name}">{!v.acc.Customer_Facilities_Manager__r.MobilePhone}</div>
                        </td>
                    </tr>


                </tbody>
            </table>
        </div>

        <!-- SITES -->
        <div style="height: 500px">
            <lightning:datatable
                    keyField="Name"
                    data="{! v.data }"
                    columns="{! v.columns }"
                    hideCheckboxColumn="true"/>
        </div>
        <!-- <div class="slds-box">
            <table class="slds-table slds-table_cell-buffer slds-table_bordered">
                <thead>
                    <tr class="slds-line-height_reset">
                        <th class="division" scope="col">
                            <div class="slds-truncate" title="Site2">Sites : </div>
                        </th>
                    </tr>
                    <tr class="slds-line-height_reset">
                        <th class="" scope="col">
                            <div class="slds-truncate" title="Site">Site</div>
                        </th>
                        <th class="name" scope="col">
                            <div class="slds-truncate" title="Name">Senior Account Manager</div>
                        </th>
                        <th class="email" scope="col">
                            <div class="slds-truncate" title="Name">Account Manager</div>
                        </th>
                        <th class="phone" scope="col">
                            <div class="slds-truncate" title="Name">Regional Field Manager</div>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <aura:iteration items="{!v.acc.Site__r}" var="item">
                        <tr class="slds-hint-parent">
                            <td data-label="Name">
                                <div class="slds-truncate" title="Name"><ui:outputText value="{!item.Name}"/></div>
                            </td>
                            <td data-label="Name" class="name">
                                <div class="slds-truncate" title="Name"><ui:outputText value="{!item.Senior_Account_Manager__r.Name}"/></div>
                            </td>
                            <td data-label="Name" class="email">
                                <div class="slds-truncate" title="Name"><ui:outputText value="{!item.Account_Manager__r.Name}"/></div>
                            </td>
                            <td data-label="Name" class="phone">
                                <div class="slds-truncate" title="Name"><ui:outputText value="{!item.Regional_Field_Manager__r.Name}"/></div>
                            </td>
                        </tr>
                    </aura:iteration>
                </tbody>
            </table>
        </div> -->



    </aura:if>
</aura:component>

Controller on the component.bundle
({
    doInit : function(component, event, helper) {

        component.set('v.columns', [
            {label: 'Site', fieldName: 'Name', type: 'text', sortable: true},
            {label: 'Senior Account Manager', fieldName: 'Senior_Account_Manager__r_Name', type: 'text'},
            {label: 'Account Manager', fieldName: 'Account_Manager__r_Name', type: 'text'},
            {label: 'Regional Field Manager', fieldName: 'Regional_Field_Manager__r_Name', type: 'text'}
        ]);

        helper.call(component, component.get('c.getAccount')).then(function(res){
            console.log(res);
            var rows = res[0].Site__r;
            /* Flatten list of rows for display in lightning datatable */
            for (var i = 0; i < rows.length; i++) { 
                var row = rows[i]; 
                //as data columns with relationship __r can not be displayed directly in data table, so generating dynamic columns 
                if (row.Senior_Account_Manager__r) { 
                     //here you assign the related data to new variables
                    if (row.Senior_Account_Manager__r) row.Senior_Account_Manager__r_Name = row.Senior_Account_Manager__r.Name; 
                    if (row.Account_Manager__r) row.Account_Manager__r_Name = row.Account_Manager__r.Name;
                    if (row.Regional_Field_Manager__r) row.Regional_Field_Manager__r_Name = row.Regional_Field_Manager__r.Name;
                } 
            }
            if(res && res.length > 0) {
                component.set('v.acc',res[0]);
                component.set('v.data', rows);
            }
        })
    }
})

Apex Class
public without sharing class AccountDetailsCtrl {

    @AuraEnabled
    public static Object getAccount(){

        return [
            SELECT Id, Division__c,
                Account_Manager__r.Name, Account_Manager__r.Email, Account_Manager__r.Phone, Account_Manager__r.MobilePhone,
                Senior_Account_Manager__r.Name, Senior_Account_Manager__r.Email, Senior_Account_Manager__r.Phone, Senior_Account_Manager__r.MobilePhone,
                Regional_Field_Manager_Contact__r.Name, Regional_Field_Manager_Contact__r.Email, Regional_Field_Manager_Contact__r.Phone, Regional_Field_Manager_Contact__r.MobilePhone,
                Director_of_Operations__r.Name, Director_of_Operations__r.Email, Director_of_Operations__r.Phone, Director_of_Operations__r.MobilePhone,

                Customer_Procurement_Mangager__r.Name, Customer_Procurement_Mangager__r.Email, Customer_Procurement_Mangager__r.Phone, Customer_Procurement_Mangager__r.MobilePhone,
                
                Customer_Finance_Contact__r.Name, Customer_Finance_Contact__r.Email, Customer_Finance_Contact__r.Phone, Customer_Finance_Contact__r.MobilePhone,
                
                Customer_Facilities_Manager__r.Name, Customer_Facilities_Manager__r.Email, Customer_Facilities_Manager__r.Phone, Customer_Facilities_Manager__r.MobilePhone,
                (SELECT Id, Name,
                    Senior_Account_Manager__r.Name, Senior_Account_Manager__r.Email, Senior_Account_Manager__r.MobilePhone, Senior_Account_Manager__r.Phone,
                    Account_Manager__r.Name, Account_Manager__r.Email, Account_Manager__r.MobilePhone, Account_Manager__r.Phone,
                    Regional_Field_Manager__r.Name, Regional_Field_Manager__r.Email, Regional_Field_Manager__r.MobilePhone, Regional_Field_Manager__r.Phone
                FROM Account.Site__r)

            FROM Account
            WHERE Id =:[SELECT AccountId FROM User WHERE Id =:UserInfo.getUserId()].AccountId
        ];
    }
}


 
  • February 24, 2020
  • Like
  • 0
User-added image

I am getting the above error when trying to push to scratch org. Can some one point out the error please?

Hi,

 

I have seven different date fields on the contact object that I want to compare in order to find the most recent and then insert that into another custom field.

 

My current approach is not working as I am using several formula fields where each one consists of an IF statement that compares the previous formula field with one of the seven date fields and returns the greatest value.

 

For example:

 

Formula Field 1 = Comparing Date Field 1 with Date Field 2

Formula Field 2 = Comparing Formula Field 1 with Date Field 3

Formula Field 3 = Comparing Formula Field 2 with Date Field 4

And so on...

 

However I am now reaching a character limit on the compiled code (I'm guessing because it is going back through all of the previous IF statements and it becomes too large).

 

I have tried using the CASE() function but I still reach character limits.

 

Unfortunately the MAX() function only works with numbers, not date fields.

 

Does anyone have any advice how I could achieve my goal of finding the most recent date from a list of 7 fields?

 

Thanks,

 

Marco