• David Zhu 🔥
  • ALL STAR
  • 5199 Points
  • Member since 2020
  • Salesforce Architect,Developer


  • Chatter
    Feed
  • 170
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 659
    Replies
Hello, I have done most of my requirement, but am getting stuck on part of it- as I will explain now. My requirement is as follows:
1. After a Lead is inserted, make an @future POST callout
2. That callout returns a request id. (It looks like this:
{
 "request_id": "69a9eb02-fc0c-11ea-afe0-8eadfccf0806",
"return_results" : "True"
}
3. I need to take that request id, and use make another POST callout, with the request id in the body of that callout. 
4. This callout will return 1 of 2 possible responses. Either it will return the full JSON response. In that case, all is good and I will then parse the results. However, the way the endpoint works is that the request sits in a queue, so I might need to keep on making this request several times until it returns the JSON. If the queue is not ready for it, then it will return a response like this:
{
"request_id": "
69a9eb02-fc0c-11ea-afe0-8eadfccf0806",
"request_status": "waiting_for_processing"

}

This is where I am getting stuck. I keep on getting stuck where it reutrns the "waiting_for_processing" response, but I have not figured out how to tell it to keep making the callout until it returns the full JSOn response. My question is: how can I tell the callout to keep trying until it returns the full JSON? Is there a way to do this with Apex? 

Here is my code now:
trigger  ReferralCreateContact on Lead (after insert) {
      if (trigger.isInsert){
     List<string> leadIds = new List<string>();
    for (lead ref : trigger.new){
      if(System.IsBatch() == false && System.isFuture() == false){ 
        if (ref.Epaces_Checked__c != true && (ref.Emed_Request_Id__c == null || ref.Emed_Request_Id__c == '')){
          lead newl = new lead();
          newl.Id = ref.id;
          leadIds.add(newl.id);
        EMedCalloutsExtension.makePostCallout1(leadIds); 
        }}}}}

public class EMedCalloutsExtension {
    static string EmedrequestId;
    static boolean firstCalloutSuccess = false;
    static string requestStatus;
    
     @future(callout = true)
public static void  makePostCallout1(list<id> refIds) {
    
  List <Lead> refs =[Select Id, firstname, lastname, gender__c, patient_dob__c, patient_ssn__c, Epaces_Checked__c, Emed_Request_Id__c from Lead where Id in :refIds]; 
     List<lead> refToUpdate = new List<Lead>();      
           for (lead ref : refs){
//REQUEST #1          
      string reqbody;
     StaticResource r =[Select Id,Body from StaticResource where Name='EMedCalloutBody' limit 1];
      reqBody=r.body.toString();         
       HttpRequest req = new HttpRequest();
           req.setHeader('Content-Type', 'application/json');
                req.setMethod('POST');
                req.setBody(reqBody);
                req.setEndpoint('callout:Emed');
                req.setTimeout(2 * 60 * 1000);
                    system.debug('ENDPOINT: ' + req.getendpoint());
                       system.debug('BODY: '+ req.getBody());
         Http http = new Http();
           HttpResponse response = http.send(req);
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
        } else {
            system.debug(response.getstatuscode());
           System.debug(response.getBody());
             string requestId = response.getbody().substringAfter('"request_id": ').substringBefore(',');
      //      ref.Emed_Request_Id__c = requestId;
            EmedrequestId = requestId;
            
         
//Request 2 TRY 1
                     
              
              string reqbodyResp;   
              StaticResource r2 =[Select Id,Body from StaticResource where Name='EmedResponseBody' limit 1];
               reqbodyResp=r2.body.toString();
              reqbodyResp=reqbodyResp.replace('{{requestId}}', EmedrequestId);
               
                  HttpRequest req2 = new HttpRequest();
           req2.setHeader('Content-Type', 'application/json');
                req2.setMethod('POST');
                req2.setBody(reqbodyResp);
                req2.setEndpoint('callout:Emed_Response');
                req2.setTimeout(2 * 60 * 1000);
            system.debug('ENDPOINT2: ' + req2.getendpoint());
            system.debug('BODY2: '+ req2.getBody());
             Http http2 = new Http();
           HttpResponse response2 = http2.send(req2);
               
        if (response2.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response2.getStatusCode() + ' ' + response2.getStatus());
        } else {
            system.debug(response2.getstatuscode());
           System.debug(response2.getBody());

      
            string reqStatus = response.getbody().substringAfter('"request_status"').substringBefore('}');
            requestStatus = reqStatus;

//Request 2 TRY 2
​​​​​​​         
            if (response.getbody().contains('"waiting_for_processing"')){
                    HttpRequest req22 = new HttpRequest();
           req22.setHeader('Content-Type', 'application/json');
                req22.setMethod('POST');
                req22.setBody(reqbodyResp);
                req22.setEndpoint('callout:Emed_Response');
                req22.setTimeout(2 * 60 * 1000);
            system.debug('ENDPOINT2: ' + req2.getendpoint());
            system.debug('BODY2: '+ req2.getBody());
             Http http22 = new Http();
           HttpResponse response22 = http22.send(req22);
               
        if (response22.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response22.getStatusCode() + ' ' + response22.getStatus());
        } else {
            system.debug(response2.getstatuscode());
           System.debug(response22.getBody());
      }}}
 
Hi,

I would like to format standard custom field 'createddate' into the below format and display in my LWC component.

 User-added image
Component:-
<lightning:input aura:id="fuploader" type="file" name="file" label="Upload File" multiple="false" required="false"/>

JS Controller:-
({
    doSave : function(component, event, helper) {
        alert('Please wait for few seconds')
       
        if (component.find("fuploader").get("v.files").length > 0 ||component.find("fuploader").get("v.files").length !== NULL) {
                
        helper.uploadHelper(component, event);
            } else{
               alert('Hello');                 
    }
    }
})
Error:- This page has an error. You might just need to refresh it. Action failed: c:InclusionForm$controller$doSave [Cannot read property 'length' of null] Failing descriptor: {c:InclusionForm$controller$doSave



Thank You
I am stuck here on how to get json string values into aura components. I am getting result as following
 {"results":[{"address_components":[{"long_name":"4700","short_name":"4700","types":["street_number"]},{"long_name":"Kingsway","short_name":"Kingsway","types":["route"]},{"long_name":"Metrotown","short_name":"Metrotown","types":["neighborhood","political"]},{"long_name":"Burnaby","short_name":"Burnaby","types":["locality","political"]},{"long_name":"Metro Vancouver","short_name":"Metro Vancouver","types":["administrative_area_level_2","political"]},{"long_name":"British Columbia","short_name":"BC","types":["administrative_area_level_1","political"]},{"long_name":"Canada","short_name":"CA","types":["country","political"]},{"long_name":"V5H 4M1","short_name":"V5H 4M1","types":["postal_code"]}],"formatted_address":"4700 Kingsway, Burnaby, BC V5H 4M1, Canada","geometry":{"location":{"lat":49.2274147,"lng":-122.9998869},"location_type":"ROOFTOP","viewport":{"northeast":{"lat":49.2287636802915,"lng":-122.9985379197085},"southwest":{"lat":49.2260657197085,"lng":-123.0012358802915}}},"place_id":"ChIJWWlMHFl2hlQR6j8qts-7x8c","plus_code":{"compound_code":"62G2+X2 Burnaby, BC, Canada","global_code":"84XV62G2+X2"},"types":["street_address"]}],"status":"OK"}
 I want to get values in separate fields street, city, postalcode, province and coutry OR just one field formatted_address in aura component.

So far I have this, in my controller


action.setCallback(this, function(response) {
                               var state = response.getState();
                               if (state === "SUCCESS") { 
                                   var res = response.getReturnValue();
                                   helper.hideSpinner(component, event, helper);
                                       
                                var frm = JSON.parse(res);
                                  var parsed = JSON.stringify(frm);
                                   console.log("PARSED: "+ parsed);
                                   component.set("v.returnAddress",parsed);}


My aura component-
<aura:iteration items="{!v.returnAddress}" var="retAdd" indexVar="index">
                                      <h2> {!retAdd}</h2>
                                     </aura:iteration>


Any help would be greatly appreciated
I have Manager.ID which pulls the 15 digit ID but I need the 18 digit manager ID.  Any ideas?
I tried a combo with CASESAFEID(Id)... Manager.CASESAFEID(Id)
 but that didn't work.
Lowly Admin here who doesn't know Apex... I need to count the number of Activities (Tasks and Events) associated with the Lead that were logged by CURRENT lead owner. I want the total to appear in a field on the Lead object called Times_contacted_by_owner. Would any of you gracious developers be willing to help me with the trigger?
Hi All,

I'm trying to use a lightning-datatable component to pull in activity history on a lead record page. I want to see activity only WHERE WhoId = currentRecord.Id OR WhoId = currentRecord.ContactId__c

I test successfully until the point where I try to access the recordId in my controller. Apparently @auraEnabled methods cannot accesss ApexPages.StandardController objects.

How do I preselect out my ActivityHistory in the data table so that I only see records based on certain crtieria for the whoId? Any advice would be most appreciated.

html:
<template>
    <lightning-card title="Sorting Data in Lightning Datatable in LWC" icon-name="standard:lead" > <br/>
        <div style="width: auto;">
            <template if:true={data}>
                <lightning-datatable data={data}
                                     columns={columns}
                                     key-field="id"
                                     sorted-by={sortBy}
                                     sorted-direction={sortDirection}
                                     onsort={handleSortdata}
                                     hide-checkbox-column="true"></lightning-datatable>
            </template>

        </div>
    </lightning-card>
</template>
apex controller
public inherited sharing class dataTableController {
    
    @AuraEnabled(Cacheable = true)
    public static List<ActivityHistory> getActivity(){
        List<Lead> leadQueryList;  
        List<ActivityHistory> activityList = new List<ActivityHistory>(); //variable to hold the list of activitiyhistories
        
        leadQueryList = [                           //query all activity history related to the lead (return list of leads w nested ah lists)
                        SELECT  Id,
                                (SELECT
                                    Id, 
                                    Subject, 
                                    ActivityDate, 
                                    OwnerId,
                                    Activity_Type__c                                                                                                                                    
                                 FROM ActivityHistories)
                        FROM Lead
                        WHERE Id = :leadId]; 
        for (Lead ld : leadQueryList) {               //loop through lead list
            if(!ld.ActivityHistories.isEmpty()){
                for (ActivityHistory h: ld.ActivityHistories){
                    activityList.add(h);
                }
            }
        }
        return activityList;
    }
}


js
import {LightningElement, wire, track, api} from 'lwc';

// importing apex class methods
import getActivity from '@salesforce/apex/dataTableController.getActivity';

// datatable columns with row actions
const columns = [
    {
        label: 'Date',
        fieldName: 'ActivityDate',
        sortable: "true"
    }, {
        label: 'Activity Type',
        fieldName: 'Activity_Type__c',
        sortable: "true"
    }, {
        label: 'Subject',
        fieldName: 'Subject',
        sortable: "true"
    }, {
        label: 'Assigned',
        fieldName: 'OwnerId',
        sortable: "true"
    },
];

export default class DataTableWithSortingInLWC extends LightningElement { 
    // reactive variable
    @track data;
    @track columns = columns;
    @track sortBy;
    @track sortDirection;
    @api recordId;

    // retrieving the data using wire service
    @wire(getActivity)
    activities(result) {
        if (result.data) {
            this.data = result.data;
            this.error = undefined;

        } else if (result.error) {
            this.error = result.error;
            this.data = undefined;
        }
    }

    handleSortdata(event) {
        // field name
        this.sortBy = event.detail.fieldName;

        // sort direction
        this.sortDirection = event.detail.sortDirection;

        // calling sortdata function to sort the data based on direction and selected field
        this.sortData(event.detail.fieldName, event.detail.sortDirection);
    }

    sortData(fieldname, direction) {
        // serialize the data before calling sort function
        let parseData = JSON.parse(JSON.stringify(this.data));

        // Return the value stored in the field
        let keyValue = (a) => {
            return a[fieldname];
        };

        // cheking reverse direction 
        let isReverse = direction === 'asc' ? 1: -1;

        // sorting data 
        parseData.sort((x, y) => {
            x = keyValue(x) ? keyValue(x) : ''; // handling null values
            y = keyValue(y) ? keyValue(y) : '';

            // sorting values based on direction
            return isReverse * ((x > y) - (y > x));
        });

        // set the sorted data to data table data
        this.data = parseData;

    }
}




User-added image

 
Hi,
In my VF page, I see the following code. 'Research' is a custom object. Where or how do I find out how they got that id for the tab?
<apex:tab label="Research" style="white-space:nowrap" name="research" id="tab17".......

 
Hello,

How can I return lat and lon from the class? I am passing Address to the getLatitude_Longitude method and would like to return the lat and lon.
 
public class GetMapLocation {
     @future (callout=true)
    static public void getLatitude_Longitude(String Address){
        
        Address = EncodingUtil.urlEncode(Address, 'UTF-8');
        
        // build callout
        Http h = new Http();        
        HttpRequest req = new HttpRequest();
        
	    String yourAPiKey = 'MyKey'; // Enter your Api key which you have created in google api console
        String key = '&key=' + yourAPiKey;
        String endPoint = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + Address;
		
        req.setEndpoint(endPoint + key);
        req.setMethod('GET');
        req.setTimeout(5000);
        System.debug('Request ' + req);
        try{
            // callout
            HttpResponse res = h.send(req);
            // parse coordinates from response
            JSONParser parser = JSON.createParser(res.getBody());
            system.debug('Response get Body ' + res.getBody());
            
            double lat = null;
            double lon = null;
            //system.debug(parser.nextToken());
            while (parser.nextToken() != null) {  
                system.debug(parser.getCurrentToken());
                system.debug(JSONToken.FIELD_NAME);
                if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) &&
                    (parser.getText() == 'location')){
                       // system.debug('a');
                        parser.nextToken(); // object start                     
                        while (parser.nextToken() != JSONToken.END_OBJECT){
                            String txt = parser.getText();
                            parser.nextToken();
                            if (txt == 'lat')
                                lat = parser.getDoubleValue();
                            else if (txt == 'lng')
                                lon = parser.getDoubleValue();
                        }
                    }
            }
            // update coordinates if we get back
            system.debug(lat);
            if (lat != null){
                system.debug(lat+' '+lon);              
            }
        }
        catch (Exception e) {
            system.debug(e);
        }
    }
}

 
I wrote an apex class to update a series of fields with the results from the SOQL query in the class. The fields I am updating are on the contact object and I am trying to match using contact ID, but am getting an error that variable ID does not exist. Any suggestions? Here is my code:
public class AttributionRollup {
    @InvocableVariable (required=true)
    public List<SObject> distinctprovider;
 
    @InvocableMethod(label='Attribution Rollup' description='upserts attribution totals into Contact records.' category='Contract Practice Junction')
    public static list<contact> attributiontoupsert(List<String> contact){
        //populate the distinctprovider list with the most recent attribution records 
               List<SObject> distinctprovider = [SELECT Contact__c, Health_Plan_Contract__c, Run_As_Of_Date__c, Max(Attributed_Lives__c)  
                                                 FROM Contract_Practice_Junction__c 
                                                 WHERE Contact__c IN:contact 
                                                 GROUP BY Run_As_Of_Date__c, Contact__c, Health_Plan_Contract__c
                                                 ORDER BY Run_As_Of_Date__c DESC
                                                 LIMIT 1];
        AggregateResult[] groupedResults = distinctprovider;

         List<Contact> ContactPlanList = new List<Contact> ();
         for (AggregateResult ar : groupedResults)  {
        
            Contact c = new Contact();
            
             Switch on String.valueOf(ar.get('Health_Plan_Contract__c')){
                 
                 when 'aetna comm ID'{
                     c.Aetna_Commercial__c =(Double)ar.get('expr0');
                     System.debug('Aetna_Commercial__c' + ar.get('expr0'));
                 }
                 
                 when 'Affinity Medicaid ID'{
                     c.Affinity_Medicaid__c =(Double)ar.get('expr0');
                     System.debug('Affinity_Medicaid__c' + ar.get('expr0'));
                 }
                 
                 when 'Emblem comm ID'{
                     c.Emblem_Commercial__c =(Double)ar.get('expr0');
                     System.debug('Emblem_Commercial__c' + ar.get('expr0'));
                 }
                 
                 when 'Emblem Medicaid ID'{
                     c.Emblem_Medicaid__c =(Double)ar.get('expr0');
                     System.debug('Emblem_Medicaid__c' + ar.get('expr0'));
                 }
                                  
                 when 'Empire comm ID'{
                     c.Empire_Commercial__c =(Double)ar.get('expr0');
                     System.debug('Empire_Commercial__c' + ar.get('expr0'));
                 }
                                  
                 when 'Fidelis Medicaid ID'{
                     c.Fidelis_Medicaid__c =(Double)ar.get('expr0');
                     System.debug('Fidelis_Medicaid__c' + ar.get('expr0'));
                 }
                                  
                 when 'Healthfirst Medicaid ID'{
                     c.HEALTHFIRST_Medicaid__c =(Double)ar.get('expr0');
                     System.debug('HEALTHFIRST_Medicaid__c' + ar.get('expr0'));
                 }
                 
                 when 'Healthfirst Medicare ID'{
                     c.HEALTHFIRST_Medicare__c =(Double)ar.get('expr0');
                     System.debug('HEALTHFIRST_Medicare__c' + ar.get('expr0'));
                 }
                 
                 when 'OSCAR Medicare ID'{
                     c.OSCAR_Medicare__c =(Double)ar.get('expr0');
                     System.debug('OSCAR_Medicare__c' + ar.get('expr0'));
                 }
                 
                 when 'Wellcare Medicare ID'{
                     c.Wellcare_Medicare__c =(Double)ar.get('expr0');
                     System.debug('Wellcare_Medicare__c' + ar.get('expr0'));
                 }
                 
             }
                        
            //c.Run_Date__c =Date.valueOf(ar.get('Run_As_Of_Date__c'));
            //System.debug('Run_Date__c' + ar.get('Run_As_Of_Date__c'));
            
            ContactPlanList.add(c);
        }        
     
        Schema.SObjectField f = Contact.ID;
        
        Database.UpsertResult[] results = database.upsert(ContactPlanList,f,false);
        
        for (Database.UpsertResult result : results) {
            if (!result.isSuccess()) {
                Database.Error[] errs = result.getErrors();
                for(Database.Error err : errs)
                    System.debug(err.getStatusCode() + ' - ' + err.getMessage());
            }
        }
       System.debug('distinctprovider'+distinctprovider) ;       
        return ContactPlanList;
    }
}
I'm making a contact search page. The search criteria are Name, Phone Number and Email. I'm trying to attempt the following logic.
  • SearchContacts is pressed
  • Checks for Blank Fields
  • Validate input(Name,Phone,Email)
  • Search Contacts for matches
  • Generate Contact table with results
My current problem is that I have 3 Input Validation methods and not sure how to call their results into my "Search Contacts" function. Could someone provide me a solution on how to do this?


Here are the validation functions: 

/* Name Input Validation Regex*/
   public static Boolean ValidationName (String name)
            {
                Boolean NameIsValid = false;
                
              
                String nameRegex = '/^[a-zA-Z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*(__[cC])?$/';
                Pattern PatternName = Pattern.compile(nameRegex);
                Matcher nameMatcher = PatternName.matcher(name);
                
                if (!nameMatcher.matches()) 
                    
                NameIsValid = true;
                return NameIsValid; 
            }
    
     
    /* Phone Input Validation Regex*/
    public static Boolean ValidationPhone (String phone)
            {
                Boolean PhoneIsValid = false;
                
               
                String phoneRegex = '//^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$//';
                Pattern PatternPhone = Pattern.compile(phoneRegex);
                Matcher phoneMatcher = PatternPhone.matcher(phone);
                
                if (!phoneMatcher.matches()) 
                   
                PhoneIsValid = true;
                return PhoneIsValid;        
            }          
    
   
     /* Email Input Validation Regex*/
     public static Boolean ValidationEmail (String email)
            {
                Boolean EmailIsValid = false;
                
               
                String emailRegex = '/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+ (\\.\\w{2,3})+$//';
                Pattern PatternEmail = Pattern.compile(emailRegex);
                Matcher emailMatcher = PatternEmail.matcher(email);
                
                if (!emailMatcher.matches()) 
                    
                EmailIsValid = true;
                return EmailIsValid;    
            } 


And here is the method I want to call those results into
public PageReference searchContacts()
        {
                           
            
            
              /* Checks if input fields are empty*/
            if (name == '' || phone == '' || email == '')
                {
                    Error_FieldsEmpty = true;   
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'One or more of your fields are blank. Please enter your information in the remainding fields to proceed'));
                }         
            else 
            {
                /* Check Validations*/
                
                
                
                
            }
I have a trigger that is designed to write unique values of a Picklist from a child object (VIP_Type__c) to the associated Account record. I am having trouble figuring out how to convert the picklist value to a string value to check if the Account field contains the picklist value. The line of code I have is:
if(!a.VIP_Types__r.contains(vip.VIP_Type__c))

Where vip.VIP_Type__c is the picklist field and VIP_Types__r is the text field on the Account.  I am getting an error:

"Method does not exist or incorrect signature: void contains(String) from the type List<VIP_Type__c>"

Any ideas?  My full trigger is below:
 
trigger UpdateAcctVIP on VIP_Type__c (after insert, after update, after delete){
        
        Set<Id> acctIds = new Set<ID>();
        
        // Get all the Account Ids in the Set
        for(VIP_Type__c vip : Trigger.new){
            acctIds.add(vip.Account__c);
        }
        // QUery the Accounts
        List<Account> acct = new List<Account>();
        // Use the VIP Types to get all the related Types for the Account
        acct = [SELECT Id, VIP_Types__c
                FROM Account
                WHERE Id in :acctIds];
        
        // Iterate over each Account and VIP record
        for(Account a : acct){
                if(a.Id !=NULL){
                    for(VIP_Type__c vip: a.VIP_Types__r){
                        if(!a.VIP_Types__r.contains(vip.VIP_Type__c)){ // Check if the Type is already in the Account Field. if not add it otherwise skip
                            a.VIP_Types__c += vip.VIP_Type__c + ';';
                        }
                    }
                }
        }
        // Update the Account
        update acct;
    }

 
HI,

I am facing Too manu email Invocations in batch calss. Can you please guide me where i did a mistake.
 
global class GD_LeadEscalation implements Database.Batchable<sObject>,Database.Stateful {
    
    global final String escalationQuery = 'Select Id,ownerId,Name,GD_Assigned_To_Email__c,GD_Lead_Status__c,GD_Escalated__c,GD_Stop_Escalation__c'
        + ' from GD_Lead__c where GD_Stop_Escalation__c = false and (GD_Lead_Status__c != \'Converted\' OR GD_Lead_Status__c != \'Unqualified\')';
   
    contact con = [select id, Email from contact where email <> null limit 1];
    EmailTemplate template = [select id from EmailTemplate where DeveloperName='GD_Lead_Escalation_Template' limit 1];
    boolean lev1 = false;boolean lev2 = false;boolean lev3 = false;
    list<GD_Lead__c> LeadEscList = new List<GD_Lead__c>();
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(escalationQuery); 
    }
    
    global void execute(Database.BatchableContext BC,List<GD_Lead__c> scope){
        for(GD_Lead_Escalation_Setup__mdt monitor : [select id,GD_Escalation_Emails__c,GD_Escalation_Days__c,GD_Escalation_Days1__c,GD_Level_Of_Escalation__c from GD_Lead_Escalation_Setup__mdt]){
            if(monitor.GD_Level_Of_Escalation__c == 'Level 1'){
                for(GD_Lead__c leadRecord : scope){
                    if(leadRecord.GD_Escalated__c == Decimal.valueOf(monitor.GD_Escalation_Days__c)){
                        leadRecord.GD_Escalation_Level__c = 'Level 1';
                        leadRecord.GD_EscalatedFlag__c = true;
                        lev1 = true;
                        LeadEscList.add(leadRecord);
                    }
                }
            }
            
            if(monitor.GD_Level_Of_Escalation__c == 'Level 2'){
                for(GD_Lead__c leadRecord : scope){
                    if(leadRecord.GD_Escalated__c == Decimal.valueOf(monitor.GD_Escalation_Days__c)){
                        leadRecord.GD_Escalation_Level__c = 'Level 2';
                        lev2 = true;
                        LeadEscList.add(leadRecord);
                    }
                }
            }
            
            if(monitor.GD_Level_Of_Escalation__c == 'Level 3'){
                for(GD_Lead__c leadRecord : scope){
                    if(leadRecord.GD_Escalated__c == Decimal.valueOf(monitor.GD_Escalation_Days__c)){
                        leadRecord.GD_Escalation_Level__c = 'Level 3';
                        lev3 = true;
                        LeadEscList.add(leadRecord);
                    }
                }
            }
        }
        system.debug('LeadEscList ' + LeadEscList.size());
        if(LeadEscList.size() > 0 ){update LeadEscList;}
    } 
    
    global void finish(Database.BatchableContext BC){   
        
        list<string> cCEmails_lev1 = new list<string>();
        list<string> cCEmails_lev2 = new list<string>();
        list<string> cCEmails_lev3 = new list<string>();
        
        EmailTemplate template = [select id from EmailTemplate where DeveloperName='GD_Lead_Escalation_Template' limit 1];       
        for(GD_Lead__c leadRecord : LeadEscList){
            List<Messaging.SingleEmailMessage> lstMsgs = new List<Messaging.SingleEmailMessage>();
            Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
           
            for(user u: [select id,name, manager.email, manager.GD_No_Escalation__c, manager.manager.email, manager.manager.GD_No_Escalation__c, manager.manager.manager.email, manager.manager.manager.GD_No_Escalation__c from user where id=: leadRecord.OwnerId]){
                if(lev1 = true){
                    if(u.manager.email != null && u.manager.email != '' && u.manager.GD_No_Escalation__c == false /*&& u!=null && !u.isEmpty()*/){
                        string mngrEmail_1 = u.manager.email;
                        cCEmails_lev1.add(mngrEmail_1);
                    }
                }
                if(lev2 = true){
                    if(u.manager.manager.email != null && u.manager.manager.email != '' && u.manager.manager.GD_No_Escalation__c == false ){
                        string mngrEmail_1 = u.manager.email;
                        string mngrEmail_2 = u.manager.manager.email;
                        cCEmails_lev2.add(mngrEmail_1);
                        cCEmails_lev2.add(mngrEmail_2);
                        
                    }
                }
                
                if(lev3 = true){
                    if(u.manager.manager.manager.email != null && u.manager.manager.manager.email != '' && u.manager.manager.manager.GD_No_Escalation__c == false ){
                        string mngrEmail_1 = u.manager.email;
                        string mngrEmail_2 = u.manager.manager.email;
                        string mngrEmail_3 = u.manager.manager.manager.email;
                        cCEmails_lev3.add(mngrEmail_1);
                        cCEmails_lev3.add(mngrEmail_2);
                        cCEmails_lev3.add(mngrEmail_3);
                        
                    }
                }
                
            }
            msg.setTemplateId(template.id);
            msg.setWhatId(leadRecord.id);
            msg.setTargetObjectId(con.id); 
            msg.setSaveAsActivity(false);
            String[] repEamail = new String[] {leadRecord.GD_Assigned_To_Email__c};
            msg.setToAddresses(repEamail);
            if(lev1 = true){msg.setCcAddresses(cCEmails_lev1);}
            if(lev2 = true){msg.setCcAddresses(cCEmails_lev2);}
            if(lev3 = true){msg.setCcAddresses(cCEmails_lev3);}
            lstMsgs.add(msg);
            Savepoint sp = Database.setSavepoint();
            Messaging.sendEmail(lstMsgs);
            Database.rollback(sp);
            List<Messaging.SingleEmailMessage> lstMsgsToSend = new List<Messaging.SingleEmailMessage>();
            for (Messaging.SingleEmailMessage email : lstMsgs) {
                Messaging.SingleEmailMessage emailToSend = new Messaging.SingleEmailMessage();
                emailToSend.setToAddresses(email.getToAddresses());
                emailToSend.setCcAddresses(email.getccAddresses());
                emailToSend.setPlainTextBody(email.getPlainTextBody());
                emailToSend.setHTMLBody(email.getHTMLBody());
                emailToSend.setSubject(email.getSubject());
                lstMsgsToSend.add(emailToSend);
            }
            Messaging.sendEmail(lstMsgsToSend);
        }
    }
}

Thanks & Regards,
Soundar.
I'm trying to generate a VF page with HTML that I get in my http callout response. What am I doing wrong? I am seeing this problem:
"Unknown constructor: 'SeekExension.SeekExtension()'

VF page:
<apex:page  controller="SeekExtension" contenttype="html" lightningStylesheets="true">
    <slds/>
 <apex:outputtext value="{!htmlString}" escape="false"/>
</apex:page>

Controller:
public class SeekExtension {
  public final Lead referral;
    public string respbody;

        Public SeekExtension(ApexPages.StandardController stdController){
      //  this.referral = (Lead)stdController.getRecord();
            referral =[Select Id, Name from Lead where Id = :ApexPages.currentPage().getParameters().get('id')];   
         
 }
    
    @future(callout = true)
 public static void  makePostCallout(id refId) { 
     string reqbody;
    String htmlString;
      
   Lead ref =[Select Id, firstname, lastname, gender__c, patient_dob__c, patient_ssn__c from Lead where Id = :refId]; 

     StaticResource r =[Select Id,Body from StaticResource where Name='Seek_Callout_Body' limit 1];
      reqBody=r.body.toString();

       HttpRequest req = new HttpRequest();
          // req.setHeader('Content-Length','0');
                req.setHeader('Content-Type','text/xml');
                req.setMethod('POST');
                req.setBody(reqBody);
                req.setEndpoint('callout:Seek');
                req.setTimeout(2 * 60 * 1000);
    system.debug('FULL REQUEST: ' + req);
           system.debug('BODY: '+ req.getBody());

         Http http = new Http();
           HttpResponse response = http.send(req);
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
        }
  
 htmlString =  response.getBody().substringAfter('~~~');
           system.debug(htmlString);
     
     XMLparse(response.getBody());
     
     // generatePdf(ref.id);

      //  return null;
    }        
Hello, I have been stuck on a callout I'm trying to make. When I did it from POSTMAN it worked successfully (i received a 200 response code), however it is not going through from Salesforce. Can anybody tell me if I'm either missing any steps or doing Named Credentials wrong? Please keep in mind that for this callout, I do not need user name or password, rather the external system vallidates the system based on certain information from the body of the callout itself.) 

Here's my code, named credentials, and static resource:

Code:

    public final Lead referral;
    public String requestLabel;
    public String result {get;set;}
    public List<Object> seekData {get;set;}
    public string reqbody;
 StaticResource r =[Select Id,Body from StaticResource where Name='Seek_Callout_Body' limit 1];
      reqBody=r.body.toString();
       HttpRequest req = new HttpRequest();
         //  req.setHeader('Content-Length','0');
                req.setHeader('Content-Type','text/xml');
                req.setMethod('POST');
                req.setBody(reqBody);
                req.setEndpoint('callout:Seek');
                req.setCompressed(true);
    system.debug('FULL REQUEST: ' + req);

         Http http = new Http();
           HttpResponse response = http.send(req);
        // Parse the JSON response
        if (response.getStatusCode() != 201) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
        }
User-added image

Static resource is .txt file of this:

User-added image

 
I tried executing the following Rest API on the Salesforce workbench -
in REST Explorer

/services/data/v48.0/query/?q=SELECT+Total_Cost__c+from+DBA_Invoice__c+where+Name="I-525"

I get the following response-

MALFORMED_QUERY
message: from DBA_Invoice__c where Name="I-525" ^ ERROR at Row:1:Column:52 line 1:52 no viable alternative at character '"'
errorCode: MALFORMED_QUERY

However, it works without the where clause. 

Could you please tell me how do specify the value in the where clause?
Hi,

I am trying to create a summary record on a related object using a SOQL totals query and an apex trigger. I am running into 2 issues I am having trouble referencing the summed fields from within my totals query and my trigger doesn't seem to be doing the upsert based on the external ID field Rollup_ID__c which matches in both objects. Here is my Trigger: 
trigger MeasureUpsert on Contract_Practice_Junction__c (after insert) 

    //Run totals query to aggregate all Contract_Practice_Junction__c records to get the sum of all numerators and denominators
    for (Contract_Practice_Junction__c measure : [SELECT Rollup_ID__c, rate_type__c, Health_Plan_Contract__c, Measure__c, Run_As_Of_Date__c, 
                                                  sum(Count_in_Denominator__c), sum(Count_in_Numerator__c)
                                                  FROM Contract_Practice_Junction__c GROUP BY Rollup_ID__c, rate_type__c, Health_Plan_Contract__c, Measure__c, Run_As_Of_Date__c])
    //use a for loop to run through all the aggregate records and upsert values to the 
    {
        //for each measure in the for loop, upsert a new Contract_Quality_Performance__c record with the values of the totals query using Rollup_ID__c as the external ID
        Contract_Quality_Performance__c CQP = new Contract_Quality_Performance__c();
            CQP.Rollup_ID__c            = measure.Rollup_ID__c;
            CQP.Rate_Type__c            = measure.rate_type__c;
            CQP.Measure__c              = measure.Measure__c;
            CQP.Health_Plan_Contract__c = measure.Health_Plan_Contract__c;
            CQP.Run_Date__c                = measure.Run_As_Of_Date__c;
            CQP.Denominator__c            = measure.sum(Count_in_Denominator__c);
            CQP.Numerator__c            = measure.sum(Count_in_Numerator__c);
            upsert CQP;
    }
}

Thank you in advance for any help/suggestions. 
Hello all,

I have a requirement to notify an external system after every dml event for Leads, Accounts, Contacts and AccountContacRelations. The external system does not want to consume any SFDC api so it is up to my SFDC system to send all the notifications for each dml event on the said objects. I have triggers that call a method that creates the JSON package to send to the external system and initially was sending them through a future call, the callout is bulkified so at least a large number of any of the objects will be handled.

There is a problem here though, first many updates to different objects can potentially go over the maximum number of queued future calls. Second, i cant ensure the order of execution, so for example on a lead convert there will be a lead update notification, an account insert notification, a contact insert and an accountContacRelation insert notification. Plus since i have to update record types on a couple of these records, that causes extra dmls and extra notifications. Since the order of execution of the future methods cant be guaranteed, this has caused incorrect sequence of callouts to the external system.

I am unsure how to successfully approach this? I would much rather send one large JSON package with all the notifications included, but then how do i add the trigger.new records from all the triggers to a list<object> then call the callout method since i dont know which will be the last trigger to run or related class executed from those triggers? 

Alternatively, is there a way to run the callouts synchronously? Any help/feedback will be greatly appreciated.

 
Hello All,
I am using an aura compone to override a new button.  But the cancel does not have any effect and the window does not close after save.
If I stick the aura in a quick action it works but not when I use it to override the 'new' button.  Any thoughts? 
This is probably a fairly simple question but, I am still fairly new. How do I check an object within an object? I am making a trigger on the Account object and one of the requirements is to check the contacts email and phone and compair it with the accounts email and phone. How exactly do I check this information while setting the trigger to account?

snippit of the code:

public with sharing class AccountTriggerHandler {
    public static void afterupdate(Map<Id, Account> oldRecs, list <Account> newrecs){        
        //Checks for changes in account
        Integer task =0;
        for (account a: newrecs){
            if (a.Email__c == (a.Contact__c).Email__c)
            {a.EmailCheck__c = true;
             task++;}
            if (a.Phone == (a.Contact__c).Phone)
            {a.PhoneCheck__c = true;
            task++;}
Hi there,
We have a open CTI managed package installed in our testing org. We have use the softphone to pickup the call, phone number/callerID are displayed on the soft phone layout.
There is a requirement that when call comes in, we need to retrieve the phone number and call ID, put them into a screen flow. The call center reps use the flow to create a case.

I found this post and it seems it does what I need.  Basically it uses sforce.opencti.searchAndScreenPop to open the flow,
https://salesforce.stackexchange.com/questions/234922/using-flowargs-from-open-cti-searchandscreenpop

In the soft phone layout, screen pop setting can hook the flow, but it does not give me chances to pass flowArgs.
Where should I call the flow using code in the post?

Thanks,
David


 
I was asked what the disadvantage of using AFTER trigger in an interview for the following scenarios.
1.Object A and B have lookup relationship. Object A is parent object.
2. When owner of A is changed, all B records' owner must be changed to the same one on parent record A.

Q: What trigger is to be used? I said after update trigger.
Q: Can you put the logic in before Trigger? I said, it is workable but not recommened. Before trigger updates the values of the record (A) iselft and After trigger updates the values of object records related to record A.
Q: What is the disadvantage of using After Trigger in this scenario?

As far as I know, SFDC does not recommend putting the logic in before trigger in this scenario. 

Can someone help me explain the disadvantage?
 
Hello I have the below code but i cannot use the if statement basically when I use the if statement it no longers see the labelsIds (list variable) if I declare it in the method then it sees it as null so this does not work either.

It's all related to variable scope. 

I sure this is easy to fix but cannot work it out.
 
public static void trelloCreateNew(String ticketId, String incomingListId, String incomingLabelsID){
        listId = incomingListId;
        System.debug('Incoming Label IDs = ' +incomingLabelsID);

        //If (null == incomingLabelsID){
        List<String> labelIds = incomingLabelsID.split('; ');
        System.debug('labelids = ' +labelIds);
        //}else{
        //    list<string> labelIds = null;
        //} <--- this commented out code breaks if used

    	// Get the ticket details
    	ticket = [
                SELECT Id, Name, Trello_Card_Title__c, Trello_Card_Description__c, Trello_Card_URL__C, Trello_Card_Raised__C 
                FROM Ticketing__c 
                WHERE Id = :ticketId
        ];
        String fullticketURL = URL.getSalesforceBaseUrl().toExternalForm() +
         '/' + ticket.id;

        //Debug statements not needed in Live
    	System.debug('The ticket id = '+ticket.Id 
                     +'\n The Ticket number is '+ ticket.Name 
                     + '\n The Trello card title is '+ ticket.trello_card_title__C
                     + '\n The trello card description is ' + ticket.Trello_Card_Description__c
                     + '\n The Ticket Full URL is ' +fullticketURL);
    
    
    	endpointURL = getEnpointURL('NEWCARD');

        String requestbody;
        System.debug('labelids='+labelIds);
        if (labelIds.size() >= 1) {  <- USED HERE
            requestBody = '{"desc":'
            + Json.serialize(ticket.Trello_Card_Description__c)
            + ',"idLabels":' 
            +  Json.serialize(labelIds)             
            +'}';    
        } else {
            requestBody = '{"desc":'
            + Json.serialize(ticket.Trello_Card_Description__c)       
            +'}';    
        }

Cheers in advance for the help as always !!!
Hello Community,

We recently created an apex class which API's into another system and uses the login credentials. Salesforce logs for API is exposing our password so I want to know if it is possible to redact a specific variable assignment from an Apex code?

Thank you so much for your time. 
Hello Everyone,

I modified a rollup trigger I found online for our use case. Below trigger rolls up the count of subscriptions on Account. We have around 1.5 million subscriptions and an account can have up to 30,000 subscription records. It works fine when I manually update a child record. However, it's throwing an error,1. When I update "Update_for_Sub_Trigger__c" field using data loader in 10k records batch, it's throwing "system.limitexception: Apex CPU time limit exceeded" 2. When I update fields that are not referenced in the trigger update section of the code (using a dataloader), it's throwing error- "system.limitexception: too many soql queries: 101". I am a novice Apex developer and not able to understand the reason for these errors.  Can someone let me know if I am coding it the wrong way? Thank you!

trigger SubscriptionCount on Subscription__c (after insert, after update, after undelete, after delete) {
   
    List <Subscription__C> newSubscriptionList = new List<Subscription__C>();
    Set<Id> accountIdsSet = new Set<Id>();
   
    if ( Trigger.isDelete ) {
        newSubscriptionList = Trigger.Old;
    } else {
        newSubscriptionList = Trigger.New;
    }      
    for ( Subscription__C Sub : newSubscriptionList ) {
        if ( Trigger.isUpdate ) {
            Subscription__C oldSub = (Subscription__C)Trigger.oldMap.get(Sub.Id); // Map<Id, sObject>
           
            if (( oldSub.Account__c != Sub.Account__c )|| ( oldSub.Update_for_Sub_Trigger__c != Sub.Update_for_Sub_Trigger__c)){
                accountIdsSet.add(oldSub.Account__c);
                accountIdsSet.add(Sub.Account__c);
            }
        }
        else {
           
            if (Sub.Account__c != null ){
                accountIdsSet.add(Sub.Account__c);
            }
        }
       
           
       
               
        List<Account> accountList = [Select Id,  Total_Subscriptions__c, (Select Id From Subscriptions__r)
                                     From Account Where Id IN : accountIdsSet];
       
        for (Account acc : accountList) {
            List<Subscription__C> relatedSub = acc.Subscriptions__r;
            if ( relatedSub != null ){
                acc.Total_Subscriptions__c = relatedSub.size();
            } else {
                acc.Total_Subscriptions__c = 0;
            }
        }
       
        if(accountList.size() > 0){
           
            update accountList;
        }
       
       
    }
}
 
HTML
<template>
   
   <lightning:card>
    <lightning-button variant="brand"
    label="New Entry"
    title="Open Modal"
    onclick={openModal}
    class="slds-var-m-left_x-small"></lightning-button>
       
    <!-- modal start -->        
 <template if:true={bShowModal}>
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
       <div class="slds-modal__container">
          <!-- modal header start -->
          <header class="slds-modal__header">
             <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeModal}>
                <lightning-icon icon-name="utility:close"
                   alternative-text="close"
                   variant="inverse"
                   size="small" ></lightning-icon>
                <span class="slds-assistive-text">Close</span>
             </button>
             <h2 id="modal-heading-02" class="slds-text-heading_medium slds-hyphenate">Quotation</h2>
          </header>
          <!-- modal body start -->
          <lightning-card>
          <p class="slds-var-p-horizontal_small">
 
 
            <lightning-input label="Date" name="datefld" type="date" value={fDate} onchange={handledChange} ></lightning-input>
            <lightning-input label="Quotation Name" name="enquiry" type="textarea" value={enq} onchange={handledChange} ></lightning-input>
  
            <lightning-record-edit-form object-api-name="Price__c">
               <lightning-input-field field-name="Project__c" onchange={projectChange}>
               </lightning-input-field>
               </lightning-record-edit-form>
        <lightning-record-edit-form object-api-name="Price__c">
        <lightning-input-field field-name="Unit__c"  onchange={unitChange} value ={unitVal}>
        </lightning-input-field>
        </lightning-record-edit-form>
    
     
   <lightning-input label="Unit Rate" name="rate" type="Double" value={rNumber} onchange={handledChange}></lightning-input>
    <lightning-input label="Additional cost" name="cost" type="Double" value={cNumber} onchange={handledChange}></lightning-input>
    <lightning-input label="Discount" name="dis" type="Double" value={dNumber} onchange={handledChange}></lightning-input>
    <lightning-input label="Agreement cost" name="agree" type="Double" value={aNumber} onchange={handledChange}></lightning-input>
    <lightning-input label="Remarks" name = "remark" type="textarea" value={resultsum} onchange={handledChange}></lightning-input> 
   
     <lightning-button label="Save" variant="brand" onclick={handleClick}></lightning-button>
    
    
           </p>
          
           </lightning-card>
          <!-- modal footer start-->
        
       </div>
    </section>
 
 </template>
 <!-- modal end -->
   
    <div if:true={accList}>
        <lightning-datatable data={accList} columns={columns} key-field="Id" >
        </lightning-datatable>
      </div>
    <div if:true={error}>
        {error}
    </div>
  
   </lightning:card>
 
</template>

JS



import { LightningElement , wire, track} from 'lwc';
import getAccountList from '@salesforce/apex/PriceFetch.getAccountList';
import calculate2Numbers from '@salesforce/apex/PriceFetch.calculate2Numbers';
import sentMail from '@salesforce/apex/PriceFetch.sentMail';
import getUnit from '@salesforce/apex/PriceFetch.getUnit';
import priceMail from '@salesforce/apex/PriceFetch.priceMail';
import newPrice from '@salesforce/apex/PriceFetch.newPrice';
import { refreshApex } from '@salesforce/apex';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class PriceScreen extends LightningElement {
    datefld;
    enquiry;
    projSelected;
    unitSelected;
    rate;
    cost;
    dis;
    agree;
    remark;
    recp;
    
    @track aNumber;
    @track unitVal;
    @track disName;
    @track finalCost;
    @track bShowModal = false;
       @track Name;
    @track columns = [
        {  
            label: "Name",  
            fieldName: "recordLink",
            type: "url",  
            typeAttributes: { label: { fieldName: "Name" },  target: "_self" }  
           },
             ];
 
    wiredDataResult;
    @track error;
    @track accList ;
  
    @wire(getAccountList)
    wiredAccounts({
        error,
        data
    }) {
        if (data) {
            var tempOppList = [];  
            for (var i = 0; i < data.length; i++) {  
                
             let tempRecord = Object.assign({}, data[i]); //cloning object  
             tempRecord.Name = tempRecord.Name;
             tempRecord.recordLink = "/" + tempRecord.Id;  
            
             tempOppList.push(tempRecord);  
            }  
            console.log('hHIIII' + data)
            this.accList = tempOppList;
            this.wiredDataResult = tempOppList;
        } else if (error) {
            this.error = error;
        }
    }
 
     
 
    handledChange(event){
      if(event.target.name==='datefld'){
 
            this.datefld = event.target.value;
        }
        else if(event.target.name==='enquiry'){
         this.enquiry = event.target.value;    
 
       }
        else if(event.target.name==='rate'){
        this.rate = event.target.value;    
          }
       else if(event.target.name==='cost'){
          this.cost = event.target.value;    
       }
       else if(event.target.name==='dis'){
        this.dis = event.target.value;    
        calculate2Numbers({ unitRate: this.rate,addtnlCost:this.cost,     discount:this.dis })
 
        .then(result => {
         this.aNumber = result;
 
           // this.error = undefined;
 
 
        })
 
 
        .catch(error => {
 
 
            this.aNumber = undefined;
 
 
            //this.error = error;
 
 
        });
 
 
    }
    else if(event.target.name==='agree'){
 
 
        console.log('handle Change'+event.target.value)
 
 
        this.agree = event.target.value;    
 
 
    }
    else if(event.target.name==='remark'){
 
 
        console.log('handle Change'+event.target.value)
 
 
        this.remark = event.target.value;    
 
 
    }
    }
 
   
    
    projectChange(event) {
       
        alert("PROJECT" + event.detail.value[0]);
       this.projSelected = event.detail.value[0];
 
       getUnit({ projId:this.projSelected })
 
       .then(result => {
 
        this.unitVal = result;
              })
 
       .catch(error => {
        this.unitVal = undefined;
 
 
       });
 
   
    }
    unitChange(event) {
        this.unitSelected = event.detail.value[0];
    }
 
   
 
   handleClick(event) {
    this.bShowModal = false;
    
  
    newPrice({ entryDate: this.datefld, enqName : this.enquiry, proj:this.projSelected, unit:this.unitSelected,
        unitRate:this.rate, addtnlCost:this.cost, discount:this.dis, agreeCost:this.agree,rem:this.remark })
      
 
   .then(result => {
    const evt = new ShowToastEvent({
        title: 'Saved succesfully',
        variant: 'success',
    });
    this.dispatchEvent(evt);
    console.log("Opps updated!" + result)
       return refreshApex(this.wiredDataResult); //HERE I AM CALLING REFRESHING THE DATATABLE, BUT ITS NOT GETTING REFRESHED
     
   })
 
   .catch(error => {
        this.error = error;
        alert("FAILURE" + error);
         //this.error = error;
   });
    }
 
 /* javaScipt functions start */ 
    openModal() {    
        // to open modal window set 'bShowModal' tarck value as true
        this.bShowModal = true;
    }
    closeModal() {    
        // to open modal window set 'bShowModal' tarck value as true
        this.bShowModal = false;
    }
  
     
}

APEX CONTROLLER

public with sharing class PriceFetch {
    @AuraEnabled(cacheable=true)
    public static List<Price__c> getAccountList() {
        System.debug('HII');
        return [SELECT Id,  Name
            FROM Price__c ];
    }
    @AuraEnabled(cacheable=true)
    public static Double calculate2Numbers(Double unitRate,Double addtnlCost, Double discount){
     
        return ((unitRate+addtnlCost)-discount);
    }
    @AuraEnabled(cacheable = true)
    public static List<Unit__c> getUnit(Id projId) {
      
        return [SELECT Id,  Name FROM Unit__c where Project__c = :projId ];
    }
    @AuraEnabled
    public static Boolean newPrice(Date entryDate, String enqName, Id proj, Id unit,Double unitRate,Double addtnlCost, Double discount,Double agreeCost, String rem ){
     
       Price__c price = new Price__c();
       price.Date__c = entryDate;
       price.Name = enqName;
       price.Project__c = proj;
       price.Unit__c = unit;
       price.Unit_Rate__c = unitRate;
       price.Additional_cost__c = addtnlCost;
       price.Discount__c = discount;
       price.Agreement_cost__c = agreeCost;
       price.Remarks__c = rem;
       try {
        insert price;
        return true;
           
       } catch (Exception e) {
           throw new AuraHandledException('exceptionText' + e.getMessage());
         
       }
      
    }


 
}
In the js file, there is a method handleClick(), inside that method, I am trying to refresh the lightning:datatable after saving some data into it, but its not getting refreshed. Is there any mistake in my code?
Hello, I have done most of my requirement, but am getting stuck on part of it- as I will explain now. My requirement is as follows:
1. After a Lead is inserted, make an @future POST callout
2. That callout returns a request id. (It looks like this:
{
 "request_id": "69a9eb02-fc0c-11ea-afe0-8eadfccf0806",
"return_results" : "True"
}
3. I need to take that request id, and use make another POST callout, with the request id in the body of that callout. 
4. This callout will return 1 of 2 possible responses. Either it will return the full JSON response. In that case, all is good and I will then parse the results. However, the way the endpoint works is that the request sits in a queue, so I might need to keep on making this request several times until it returns the JSON. If the queue is not ready for it, then it will return a response like this:
{
"request_id": "
69a9eb02-fc0c-11ea-afe0-8eadfccf0806",
"request_status": "waiting_for_processing"

}

This is where I am getting stuck. I keep on getting stuck where it reutrns the "waiting_for_processing" response, but I have not figured out how to tell it to keep making the callout until it returns the full JSOn response. My question is: how can I tell the callout to keep trying until it returns the full JSON? Is there a way to do this with Apex? 

Here is my code now:
trigger  ReferralCreateContact on Lead (after insert) {
      if (trigger.isInsert){
     List<string> leadIds = new List<string>();
    for (lead ref : trigger.new){
      if(System.IsBatch() == false && System.isFuture() == false){ 
        if (ref.Epaces_Checked__c != true && (ref.Emed_Request_Id__c == null || ref.Emed_Request_Id__c == '')){
          lead newl = new lead();
          newl.Id = ref.id;
          leadIds.add(newl.id);
        EMedCalloutsExtension.makePostCallout1(leadIds); 
        }}}}}

public class EMedCalloutsExtension {
    static string EmedrequestId;
    static boolean firstCalloutSuccess = false;
    static string requestStatus;
    
     @future(callout = true)
public static void  makePostCallout1(list<id> refIds) {
    
  List <Lead> refs =[Select Id, firstname, lastname, gender__c, patient_dob__c, patient_ssn__c, Epaces_Checked__c, Emed_Request_Id__c from Lead where Id in :refIds]; 
     List<lead> refToUpdate = new List<Lead>();      
           for (lead ref : refs){
//REQUEST #1          
      string reqbody;
     StaticResource r =[Select Id,Body from StaticResource where Name='EMedCalloutBody' limit 1];
      reqBody=r.body.toString();         
       HttpRequest req = new HttpRequest();
           req.setHeader('Content-Type', 'application/json');
                req.setMethod('POST');
                req.setBody(reqBody);
                req.setEndpoint('callout:Emed');
                req.setTimeout(2 * 60 * 1000);
                    system.debug('ENDPOINT: ' + req.getendpoint());
                       system.debug('BODY: '+ req.getBody());
         Http http = new Http();
           HttpResponse response = http.send(req);
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
        } else {
            system.debug(response.getstatuscode());
           System.debug(response.getBody());
             string requestId = response.getbody().substringAfter('"request_id": ').substringBefore(',');
      //      ref.Emed_Request_Id__c = requestId;
            EmedrequestId = requestId;
            
         
//Request 2 TRY 1
                     
              
              string reqbodyResp;   
              StaticResource r2 =[Select Id,Body from StaticResource where Name='EmedResponseBody' limit 1];
               reqbodyResp=r2.body.toString();
              reqbodyResp=reqbodyResp.replace('{{requestId}}', EmedrequestId);
               
                  HttpRequest req2 = new HttpRequest();
           req2.setHeader('Content-Type', 'application/json');
                req2.setMethod('POST');
                req2.setBody(reqbodyResp);
                req2.setEndpoint('callout:Emed_Response');
                req2.setTimeout(2 * 60 * 1000);
            system.debug('ENDPOINT2: ' + req2.getendpoint());
            system.debug('BODY2: '+ req2.getBody());
             Http http2 = new Http();
           HttpResponse response2 = http2.send(req2);
               
        if (response2.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response2.getStatusCode() + ' ' + response2.getStatus());
        } else {
            system.debug(response2.getstatuscode());
           System.debug(response2.getBody());

      
            string reqStatus = response.getbody().substringAfter('"request_status"').substringBefore('}');
            requestStatus = reqStatus;

//Request 2 TRY 2
​​​​​​​         
            if (response.getbody().contains('"waiting_for_processing"')){
                    HttpRequest req22 = new HttpRequest();
           req22.setHeader('Content-Type', 'application/json');
                req22.setMethod('POST');
                req22.setBody(reqbodyResp);
                req22.setEndpoint('callout:Emed_Response');
                req22.setTimeout(2 * 60 * 1000);
            system.debug('ENDPOINT2: ' + req2.getendpoint());
            system.debug('BODY2: '+ req2.getBody());
             Http http22 = new Http();
           HttpResponse response22 = http22.send(req22);
               
        if (response22.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response22.getStatusCode() + ' ' + response22.getStatus());
        } else {
            system.debug(response2.getstatuscode());
           System.debug(response22.getBody());
      }}}
 
Hi Everyone,

I am getting the following error when trying to callout an external service using trigger and future method and update the object.
trigger TriggerAfterInsertUpdate on CustomObject __c(after insert, after update ) {
if(Trigger.isAfter){
         if(updation.isfutureupdate!=true)
            {
               id lst;
                for(CustomObject e :Trigger.new)
                {
                   // lst=e.Id;
                    system.debug('$$$$$$$$$$$'+e.Id);
                    handler.dofuture(e.Id);
                }
                
                
            }
public with sharing class handler {
@future(callout=true)
    public static void dofuture(Id recordId){
        CustomObject __C  cust = [SELECT Id, Name, , IsChecked,
            Day_H__c, Month_H__c, Year_H__c,  Day_G__c, Month_G__c, Year_G__c FROM CustomObject__c
            WHERE Id = :recordId];
        List<String> hDate = verifyfields(cust ,cust .Day_G__c,cust .Month_G__c,cust .Year_G__c,cust .IsChecked);
                     cust .Year_H__c = hDate[0];
                    cust .Month_H__c = hDate[1];
                    cust .Day_H__c = hDate[2];
        List<CustomObject__c> dec1 = new List<CustomObject__c>();
        dec1.add(cust );
        update dec1;
        updation.isfutureupdate = true;
    }
    public static List<string> verifyfields(SObject sobj, String dayG, String monthG, String yearG, Boolean IsChecked){
        String urlPrefix = 'urlpath'
        String retUrl = urlPrefix;
        retUrl += '&gy=' + yearGregorian;
        retUrl += '&gm=' + monthGregorian;
        retUrl += '&gd=' + dayGregorian;
        retUrl += '&gs=' + (afterSunset ? '1' : '0');
        Http h = new Http();
            
            // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint 
            HttpRequest req = new HttpRequest();
            req.setEndpoint(retUrl);
            req.setMethod('GET');
            
            // Send the request, and return a response 
            HttpResponse res = h.send(req);
                                              
                                          
            if(res.getStatusCode() != 200) {
        System.debug('The status code returned was not expected: ' +
            res.getStatusCode() + ' ' + res.getStatus());
     }else {
        System.debug('********response********'+res.getBody());
     } 
       List<String> ret = new String[3];
        JSONParser parser = System.Json.createParser(res.getBody());
                                                          
        while (parser.nextToken() != null) {
            system.debug('inside while'+JSONToken.FIELD_NAME);
            if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
                if (parser.getText() == 'hy') {
                    // Get the value. 
                    parser.nextToken();
                    ret[0] = parser.getText();
                    System.debug('Year='+ret[0]);
                }
                else if (parser.getText() == 'hm') {
                    // Get the value. 
                    parser.nextToken();
                    ret[1] = parser.getText();
                    if (ret[1].equals('xxx') || ret[1].equals('yyy'))
                        ret[1] = 'yyy';
                    else if (ret[1].equals('zzz'))
                        ret[1] = 'zzz';

                    System.debug('Month='+ret[1]);
                }
                else if (parser.getText() == 'hd') {
                    // Get the value. 
                    parser.nextToken();
                    ret[2] = parser.getText();
                    System.debug('Day='+ret[2]);
                }
            }
        }
        return ret;        
     
                                          
                                      }
    
}
getting the following error:
EXCEPTION_THROWN [25]|System.DmlException: Update failed. First exception on row 0 with id a010U000006kjnSQAQ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TriggerAfterInsertUpdate : execution of AfterUpdate

Please can anyone help me to fix this issue?
Thanks,
Sirisha
 
Hi guys 
i am getting the error Failed to save CampingListForm.cmp: No EVENT named markup://c:addItemEvent found : [markup://c:CampingListForm]: Source . while saving the code in developer console . i do not know where i am doing the mistake
below is my code.


<aura:component >
    <aura:registerEvent name="addItem" type="c:addItemEvent"/>
    
    <aura:attribute name="newItem" type="Camping_Item__c"
     default="{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 1,
                    'Price__c': 0,
                    'Packed__c': false }"/>
        <!-- CREATE NEW ITEM FORM -->
    <form class="slsd-form--stacked">
            <lightning:input aura:id="campingform" label="Camping Name"
                                     name="campingname"
                                     value="{!v.newItem.Name}"
                                     required="true"/> 
                    <lightning:input type="number" aura:id="campingform" label="Quantity"
                                     name="campingQuantity"
                                     min="1"                                    
                                     step="1"
                                     value="{!v.newItem.Quantity__c}"
                                     messageWhenRangeUnderflow="Enter an Quantity that's at least 1."/>
                      <lightning:input type="number" aura:id="campingform" label="Price"
                                     name="campingPrice"
                                     min="0.1"
                                     formatter="currency"
                                     step="0.1"
                                     value="{!v.newItem.Price__c}"
                                     messageWhenRangeUnderflow="Enter an Price that's at least 0.1."/>
                    <lightning:input type="checkbox" aura:id="campingform" label="Packed ?"  
                                     name="campingPacked"
                                     checked="{!v.newItem.Packed__c}"/>
                    <lightning:button label="Create Camping" 
                                      class="slds-m-top--medium"
                                      variant="brand"
                                      onclick="{!c.clickCreateItem}"/>
        </form>
    <!-- / CREATE NEW ITEM FORM -->
</aura:component>
  • September 15, 2020
  • Like
  • 0
Hi,

I would like to format standard custom field 'createddate' into the below format and display in my LWC component.

 User-added image
Component:-
<lightning:input aura:id="fuploader" type="file" name="file" label="Upload File" multiple="false" required="false"/>

JS Controller:-
({
    doSave : function(component, event, helper) {
        alert('Please wait for few seconds')
       
        if (component.find("fuploader").get("v.files").length > 0 ||component.find("fuploader").get("v.files").length !== NULL) {
                
        helper.uploadHelper(component, event);
            } else{
               alert('Hello');                 
    }
    }
})
Error:- This page has an error. You might just need to refresh it. Action failed: c:InclusionForm$controller$doSave [Cannot read property 'length' of null] Failing descriptor: {c:InclusionForm$controller$doSave



Thank You
I have translated record type label name in translation workbench but not able to retrieve it in package xml. record type is not coming in below xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>CustomObjectTranslation</name>
    </types>
    <version>49.0</version>
</Package>


How can I retrieve record type label translated values in package xml
 
  • September 14, 2020
  • Like
  • 0
Hi , I have this handler methods on after update trigger, why do I get CPU time limit exceed exception


trigger AccountTrigger on Account (before update, after insert, after update ) 
{
   
    if( AccountTriggerHandler.runFlag )
      {
        AccountTriggerHandler.runFlag = false;
       
        if( Trigger.isUpdate && Trigger.isAfter )
        {
            AccountTriggerHandler.handleAfterUpdate( Trigger.newMap, Trigger.oldMap );
            AccountTriggerHandler.forceSync(Trigger.new,Trigger.oldMap);
            
        }
        
        AccountTriggerHandler.runFlag = true;
    }

}










public class AccountTriggerHandler 
{
    public static boolean runFlag = true;
    
     public static void  forceSync(List<Account> acc, Map<id,Account> oldaccounts)
     {
        Set<Id> accIds = new Set<Id>();
        MAP<Id,Guarantor__c> guarantorMap = new MAP<Id,Guarantor__c>();
        List<Security_Holder__c> sclisttoUpdate= new List<Security_Holder__c>();
        List<Certificate__c> certlisttoUpdate= new List<Certificate__c>();
        
 
         
        for ( Account a:acc )
         {
           Account oldAcc = oldaccounts.get(a.Id);
           if((a.Last_Updated_Date_Non_Integration_User__c != null) && (a.lastmodifieddate != oldAcc.lastmodifieddate)) 
           {
             accIds.add(a.id);
            } 
         }
         
        if(accIds.size()> 0) 
        {
        for (Account accs: [
             select id,
             (SELECT id,Force_Sync__c FROM Guarantors__r),  (SELECT id,Force_Sync__c FROM GuaranteeProviders__r) , (SELECT id,Force_Sync__c FROM Certificates__r), (SELECT id,Force_Sync__c FROM Security_Holders__r)
             from Account 
             where (Id in :accIds )]) {
           
            if(accs.Guarantors__r.size() > 0)
            {
            for(Guarantor__c gc:accs.Guarantors__r)
            { gc.Force_Sync__c = true;
              guarantorMap.put(gc.id,  gc);
            }
            }
        
           if(accs.GuaranteeProviders__r.size() > 0)
            {
            for(Guarantor__c gcs:accs.GuaranteeProviders__r)
            { gcs.Force_Sync__c = true;
              guarantorMap.put(gcs.id,  gcs);
            }
            }
             
            if(accs.Security_Holders__r.size() > 0)
            {   
              for(Security_Holder__c sc:accs.Security_Holders__r)
            { sc.Force_Sync__c = true;
              sclisttoUpdate.add(sc);
            }
            }
             
              if(accs.Certificates__r.size() > 0)
            { 
             for(Certificate__c cr:accs.Certificates__r)
            { cr.Force_Sync__c = true;
              certlisttoUpdate.add(cr);
            } 
            }
         }
        }
        if (!guarantorMap.isEmpty()) {
             Database.update(guarantorMap.values(), false);
           }
            
             
            
        if (!sclisttoUpdate.isEmpty()) {
            Database.update(sclisttoUpdate, false); 
           } 
         
         if (!certlisttoUpdate.isEmpty()) {
            Database.update(certlisttoUpdate, false); 
        }  
    }  
    
   
  
  // Thayalan finish
    public static void handleAfterInsert( List<Account> insertedAccounts )
    {
        updateNonIntegrationAuditFields( insertedAccounts );
    }
    
    public static void handleAfterUpdate( Map<Id, Account> updatedAccounts, Map<Id, Account> oldAccounts )
    {
        updateNonIntegrationAuditFields( updatedAccounts.values() );
        updatePendingApplicationFields( updatedAccounts , oldAccounts);
    }
    
    private static void updateNonIntegrationAuditFields( List<Account> accounts )
    {
        Set<Id> userIds = new Set<Id>();
        for( Account a: accounts )
        {
            userIds.add( a.LastModifiedById );
        }
        
        Map<ID, User> users = new Map<Id, User>([Select Id, Integration_User__c from User
                           where id in: userIds
                           and Integration_User__c = false]);
        
        List<Account> accountsToUpdate = new List<Account>();
        for( Account a: accounts )
        {
            if( users.containsKey( a.LastModifiedById ) )
            {
                Account b = new Account( Id=a.Id );
                b.Last_Updated_by_Non_Integration_User__c = a.LastModifiedDate;
                b.Last_Updated_Date_Non_Integration_User__c = a.LastModifiedById;
                accountsToUpdate.add(b);
            }        
        }
        
        if( accountsToUpdate.size() > 0 )
        {
            update accountsToUpdate;
        }

    }
}
I am stuck here on how to get json string values into aura components. I am getting result as following
 {"results":[{"address_components":[{"long_name":"4700","short_name":"4700","types":["street_number"]},{"long_name":"Kingsway","short_name":"Kingsway","types":["route"]},{"long_name":"Metrotown","short_name":"Metrotown","types":["neighborhood","political"]},{"long_name":"Burnaby","short_name":"Burnaby","types":["locality","political"]},{"long_name":"Metro Vancouver","short_name":"Metro Vancouver","types":["administrative_area_level_2","political"]},{"long_name":"British Columbia","short_name":"BC","types":["administrative_area_level_1","political"]},{"long_name":"Canada","short_name":"CA","types":["country","political"]},{"long_name":"V5H 4M1","short_name":"V5H 4M1","types":["postal_code"]}],"formatted_address":"4700 Kingsway, Burnaby, BC V5H 4M1, Canada","geometry":{"location":{"lat":49.2274147,"lng":-122.9998869},"location_type":"ROOFTOP","viewport":{"northeast":{"lat":49.2287636802915,"lng":-122.9985379197085},"southwest":{"lat":49.2260657197085,"lng":-123.0012358802915}}},"place_id":"ChIJWWlMHFl2hlQR6j8qts-7x8c","plus_code":{"compound_code":"62G2+X2 Burnaby, BC, Canada","global_code":"84XV62G2+X2"},"types":["street_address"]}],"status":"OK"}
 I want to get values in separate fields street, city, postalcode, province and coutry OR just one field formatted_address in aura component.

So far I have this, in my controller


action.setCallback(this, function(response) {
                               var state = response.getState();
                               if (state === "SUCCESS") { 
                                   var res = response.getReturnValue();
                                   helper.hideSpinner(component, event, helper);
                                       
                                var frm = JSON.parse(res);
                                  var parsed = JSON.stringify(frm);
                                   console.log("PARSED: "+ parsed);
                                   component.set("v.returnAddress",parsed);}


My aura component-
<aura:iteration items="{!v.returnAddress}" var="retAdd" indexVar="index">
                                      <h2> {!retAdd}</h2>
                                     </aura:iteration>


Any help would be greatly appreciated
I have Manager.ID which pulls the 15 digit ID but I need the 18 digit manager ID.  Any ideas?
I tried a combo with CASESAFEID(Id)... Manager.CASESAFEID(Id)
 but that didn't work.
Lowly Admin here who doesn't know Apex... I need to count the number of Activities (Tasks and Events) associated with the Lead that were logged by CURRENT lead owner. I want the total to appear in a field on the Lead object called Times_contacted_by_owner. Would any of you gracious developers be willing to help me with the trigger?
Hi All,

I'm trying to use a lightning-datatable component to pull in activity history on a lead record page. I want to see activity only WHERE WhoId = currentRecord.Id OR WhoId = currentRecord.ContactId__c

I test successfully until the point where I try to access the recordId in my controller. Apparently @auraEnabled methods cannot accesss ApexPages.StandardController objects.

How do I preselect out my ActivityHistory in the data table so that I only see records based on certain crtieria for the whoId? Any advice would be most appreciated.

html:
<template>
    <lightning-card title="Sorting Data in Lightning Datatable in LWC" icon-name="standard:lead" > <br/>
        <div style="width: auto;">
            <template if:true={data}>
                <lightning-datatable data={data}
                                     columns={columns}
                                     key-field="id"
                                     sorted-by={sortBy}
                                     sorted-direction={sortDirection}
                                     onsort={handleSortdata}
                                     hide-checkbox-column="true"></lightning-datatable>
            </template>

        </div>
    </lightning-card>
</template>
apex controller
public inherited sharing class dataTableController {
    
    @AuraEnabled(Cacheable = true)
    public static List<ActivityHistory> getActivity(){
        List<Lead> leadQueryList;  
        List<ActivityHistory> activityList = new List<ActivityHistory>(); //variable to hold the list of activitiyhistories
        
        leadQueryList = [                           //query all activity history related to the lead (return list of leads w nested ah lists)
                        SELECT  Id,
                                (SELECT
                                    Id, 
                                    Subject, 
                                    ActivityDate, 
                                    OwnerId,
                                    Activity_Type__c                                                                                                                                    
                                 FROM ActivityHistories)
                        FROM Lead
                        WHERE Id = :leadId]; 
        for (Lead ld : leadQueryList) {               //loop through lead list
            if(!ld.ActivityHistories.isEmpty()){
                for (ActivityHistory h: ld.ActivityHistories){
                    activityList.add(h);
                }
            }
        }
        return activityList;
    }
}


js
import {LightningElement, wire, track, api} from 'lwc';

// importing apex class methods
import getActivity from '@salesforce/apex/dataTableController.getActivity';

// datatable columns with row actions
const columns = [
    {
        label: 'Date',
        fieldName: 'ActivityDate',
        sortable: "true"
    }, {
        label: 'Activity Type',
        fieldName: 'Activity_Type__c',
        sortable: "true"
    }, {
        label: 'Subject',
        fieldName: 'Subject',
        sortable: "true"
    }, {
        label: 'Assigned',
        fieldName: 'OwnerId',
        sortable: "true"
    },
];

export default class DataTableWithSortingInLWC extends LightningElement { 
    // reactive variable
    @track data;
    @track columns = columns;
    @track sortBy;
    @track sortDirection;
    @api recordId;

    // retrieving the data using wire service
    @wire(getActivity)
    activities(result) {
        if (result.data) {
            this.data = result.data;
            this.error = undefined;

        } else if (result.error) {
            this.error = result.error;
            this.data = undefined;
        }
    }

    handleSortdata(event) {
        // field name
        this.sortBy = event.detail.fieldName;

        // sort direction
        this.sortDirection = event.detail.sortDirection;

        // calling sortdata function to sort the data based on direction and selected field
        this.sortData(event.detail.fieldName, event.detail.sortDirection);
    }

    sortData(fieldname, direction) {
        // serialize the data before calling sort function
        let parseData = JSON.parse(JSON.stringify(this.data));

        // Return the value stored in the field
        let keyValue = (a) => {
            return a[fieldname];
        };

        // cheking reverse direction 
        let isReverse = direction === 'asc' ? 1: -1;

        // sorting data 
        parseData.sort((x, y) => {
            x = keyValue(x) ? keyValue(x) : ''; // handling null values
            y = keyValue(y) ? keyValue(y) : '';

            // sorting values based on direction
            return isReverse * ((x > y) - (y > x));
        });

        // set the sorted data to data table data
        this.data = parseData;

    }
}




User-added image

 
Hi, we've installed an Open CTI Integration app (Aircall) but would like to be able to screenpop an Account page based on the Dialled Number when it cannot identify the Caller.

Presumably we can somehow use the "Pop to flow" option in the Softphone Layout in Call Center, but there is nothing we can find that tells us how we can pull in any variables from the call into the Flow, so we can only create a "dumb" Screen Flow starting from zero. Ideally we want to:
- Grab the Dialled Number
- Do a Lookup on Accounts to find a Record with that Phone Number
- Screenpop that Account

Does anybody know how we can do this? Using Flow, or any other means?

Thanks!