• Aparna Hegde 1
  • NEWBIE
  • 95 Points
  • Member since 2017

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 21
    Replies
A portion of my visual workflow is creating a new account. Since the Account will always be a "Partner" account record type - I hardcoded the record type ID into the Assignment element, but when executing the flow, it assigns the account record to the wrong record type? Any ideas?
User-added image
User-added image
Hi,

I know for custom report links you can insert a parameter for a Contact Id from the Contact page, but can you do something similar if the report does not relate to the Contact? For instance, I have a report of Opportunities, which has a lookup to Contact. I want to use this report, but insert a parameter for the Contact Id. I have a custom field on Opportunity to get the Contact Id, but the paramter ain't working, which makes sense because there's only the custom field I have on opportunity and NOT the actual Contact.Id. Anybody know of any solutions?

/00Oi0000005wvrc?pv0={!Contact.Id}
Hello, our Organization-wide default settings for accounts and leads is private. I would like to create a solution where if the Account Name matches the Lead Company name, then the Account Owner can edit that lead record. I've tried using code that I found on this forum to update a custom checkbox field if the Account Name and Lead Company match. The issue I'm running into is when I create the Lead sharing rule in settings, I can't specify record access by user, but rather only by group. Is there a way to specify it by Account owner? Thank you

trigger LeadMatch on Lead (before insert,before update) {
    
    List<Account> accList = [Select Id,Name from Account];
    
    for(Lead lead : trigger.new){
        lead.LeadAccountMatch__c = false;
        for(Account acc: accList){
            if(lead.Company == acc.Name && lead.OwnerId != acc.OwnerId){
                lead.LeadAccountMatch__c = true;
                break;
            }
        }        
    }
  • January 29, 2018
  • Like
  • 0
Hi All,

I am getting an error Unknown constructor 'GetLawyers.GetLawyers()' for the below code. Could you please let me know what's causing this issue and how can i fix it?

VF Page:

<apex:page controller="GetLawyers" lightningStylesheets="true">  
    <apex:pageblock title="Available Lawyers">
    <apex:pageblocktable value="{!LawyersL3}" var ="Lawyer">
    <apex:column>
        <apex:facet name="header">Lawyer Name</apex:facet>
        <apex:outputText value="{!Lawyer.Lawyer__r.Name}"/>
                </apex:column>
    </apex:pageBlockTable> 
    </apex:pageblock>
</apex:page>


Apex Class:
public with sharing class GetLawyers {
    List<Lawyer_Data__c> LawyersL3 {get; set;}
              public GetLawyers(string PG, String State, String Skill, decimal ClientLat, decimal ClientLong, string classification){
      
       // Level 1 filtering
       set<Id> Filter1 = new set<Id>();
       List<User> LawyersL1 = new List<User>([select Id from user where Type__c='Lawyer']);
        system.debug('Result of Level 1 filtering'+ LawyersL1);
       for(User L:LawyersL1){
            Filter1.add(L.Id);
        }
        // Level 2 filtering
        set<Id> Filter2 = new set<Id>();
        set<Id> Filter3 = new set<Id>();
         set<Id> Filter4 = new set<Id>();
        List<Lawyer_Data__c> LawyersL2 =new List<Lawyer_Data__c>([select Id,Lawyer__c,SG_Office__c from Lawyer_Data__c where Practice_Group__c=:PG and State__c=:state and     
                                                       Injury_Classification__c INCLUDES(:classification) and Lawyer__c IN :Filter1]);
       system.debug('Result of Level 2 filtering'+ LawyersL2);
        for(Lawyer_Data__c LD:LawyersL2){
            Filter2.add(LD.Lawyer__c);
            Filter3.add(LD.SG_Office__c);
            Filter4.add(LD.Id);
        }
    
        // Distance Calculation
        Location ClientLocation = Location.newInstance(ClientLat,ClientLong);
        Map<Id, Double> DistanceTable = new Map<Id, Double>();
        List<SG_Office__c> Offices=new List<SG_Office__c>([select Id,name,Geolocation__Latitude__s,Geolocation__Longitude__s FROM SG_Office__c where Id IN:Filter3]);
           system.debug('Result of Distance Calculation'+ Offices);
        for(SG_Office__c SGO:Offices){
            Location SG_Office = Location.newInstance(SGO.Geolocation__Latitude__s, SGO.Geolocation__Longitude__s);
            Double Dist2ClientLoc = SG_Office.getDistance(ClientLocation, 'km');
            DistanceTable.put(SGO.Id,Dist2ClientLoc);
        }
       
        
                  for(Lawyer_Data__c LD1:LawyersL2){            
             LD1.distance__c = DistanceTable.get(LD1.SG_Office__c);  
                     }
        //update LawyersL2;
         system.debug('Display all the lawyers with distance'+LawyersL2);
        
        // Select the top 3 lawyers sorted by distance
             LawyersL3= [select Lawyer__r.Name, SG_Office__r.Name,Distance__c from Lawyer_Data__c where ID IN:Filter4 order by Distance__c];
        
            system.debug('Display all the lawyers sorted'+LawyersL3);
               
    }
      
}

Cheers,
Aparna
I have this requirement to be able to book appointments.

I have a list of 50 offices and people with one/more skills work at every office.

Based on the account address and skill required, I need to be able to view the calendars of everyone working in the nearest office catering services for the requested skill and book appointments based on availability of both client and service provider

Most of the apps I saw on app exchange are for sales agents to go to the customer and not for customers coming over to the office. The field service OOTB feature supports a part of the requirement. Is there any way I can achieve this through apps or configuration? Is visualforce/apex the only resort?
I am after building a visualforce page that will display doctor details as rows and days as columns. Each intesecting box should show the appointments booked for the doctor for the day. I should also have the flexibility to double click and enter an event for the doctor. Has anyone implemented such a thing? 
I would like to have a custom field/s on account that will hold the closest office(all offices address entered in custom object) from the account.  Eg If an account's address is having Street A, Suburb B, Postcode C. Then the custom field on account should scan through the list of addresses in the custom object and return the closest. Will something like this help? https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_system_Address.htm
Thanks!
Hi All,

I am getting an error Unknown constructor 'GetLawyers.GetLawyers()' for the below code. Could you please let me know what's causing this issue and how can i fix it?

VF Page:

<apex:page controller="GetLawyers" lightningStylesheets="true">  
    <apex:pageblock title="Available Lawyers">
    <apex:pageblocktable value="{!LawyersL3}" var ="Lawyer">
    <apex:column>
        <apex:facet name="header">Lawyer Name</apex:facet>
        <apex:outputText value="{!Lawyer.Lawyer__r.Name}"/>
                </apex:column>
    </apex:pageBlockTable> 
    </apex:pageblock>
</apex:page>


Apex Class:
public with sharing class GetLawyers {
    List<Lawyer_Data__c> LawyersL3 {get; set;}
              public GetLawyers(string PG, String State, String Skill, decimal ClientLat, decimal ClientLong, string classification){
      
       // Level 1 filtering
       set<Id> Filter1 = new set<Id>();
       List<User> LawyersL1 = new List<User>([select Id from user where Type__c='Lawyer']);
        system.debug('Result of Level 1 filtering'+ LawyersL1);
       for(User L:LawyersL1){
            Filter1.add(L.Id);
        }
        // Level 2 filtering
        set<Id> Filter2 = new set<Id>();
        set<Id> Filter3 = new set<Id>();
         set<Id> Filter4 = new set<Id>();
        List<Lawyer_Data__c> LawyersL2 =new List<Lawyer_Data__c>([select Id,Lawyer__c,SG_Office__c from Lawyer_Data__c where Practice_Group__c=:PG and State__c=:state and     
                                                       Injury_Classification__c INCLUDES(:classification) and Lawyer__c IN :Filter1]);
       system.debug('Result of Level 2 filtering'+ LawyersL2);
        for(Lawyer_Data__c LD:LawyersL2){
            Filter2.add(LD.Lawyer__c);
            Filter3.add(LD.SG_Office__c);
            Filter4.add(LD.Id);
        }
    
        // Distance Calculation
        Location ClientLocation = Location.newInstance(ClientLat,ClientLong);
        Map<Id, Double> DistanceTable = new Map<Id, Double>();
        List<SG_Office__c> Offices=new List<SG_Office__c>([select Id,name,Geolocation__Latitude__s,Geolocation__Longitude__s FROM SG_Office__c where Id IN:Filter3]);
           system.debug('Result of Distance Calculation'+ Offices);
        for(SG_Office__c SGO:Offices){
            Location SG_Office = Location.newInstance(SGO.Geolocation__Latitude__s, SGO.Geolocation__Longitude__s);
            Double Dist2ClientLoc = SG_Office.getDistance(ClientLocation, 'km');
            DistanceTable.put(SGO.Id,Dist2ClientLoc);
        }
       
        
                  for(Lawyer_Data__c LD1:LawyersL2){            
             LD1.distance__c = DistanceTable.get(LD1.SG_Office__c);  
                     }
        //update LawyersL2;
         system.debug('Display all the lawyers with distance'+LawyersL2);
        
        // Select the top 3 lawyers sorted by distance
             LawyersL3= [select Lawyer__r.Name, SG_Office__r.Name,Distance__c from Lawyer_Data__c where ID IN:Filter4 order by Distance__c];
        
            system.debug('Display all the lawyers sorted'+LawyersL3);
               
    }
      
}

Cheers,
Aparna
Hello, 

I have a couple of objects named Listing and Transaction. I have another object called Market. Each listing and transaction record belongs to the same Market. So for example, when we carete a listing we add the Market by using a lookup field in the listing object. When this listing becomes a transaction (listings and transactions are related), then the transaction needs to have the field for the Market that corresponds to the same as the listing. I can do a process builder or a simple formula. However, the fields limitation in SF won't allow me to use a lookup field or a formula field as we are maxed out. Any workarounds suggested for this? 

Thanks ,

Karla
Lowly Admin here who doesn't know a bit of code...I have a custom object Location__c and I need to count the number of Products (Standard object called Product2) associated with that Location. I want the total to appear in a field on the Location object called Current_Lot_Inventory. Would any of you gracious developers be willing to help me out with the Apex needed?
A method in an existing test class is thtrowing this error when I run the test: System.LimitException:
Too many DML rows: 10001
Stack TraceClass.ContractSnapshotCreateDelete.processDelete: line 64, column 1
Class.Lead_Note_test.myUnitTest4: line 251, column 1

This is the failing unit test within the apex class and below that is lines 60-70 of the refernced class. We've just created 1000's of contract and contract snapshot records so I think thats why its failing. Im just not sure how to fix it. Please help!
 
static testMethod void myUnitTest4() {
// ****Contract Snapshot Create/Delete
    account a = new account(Name='Test');
    insert a;
    a.Name='Test4';
    update a;
    contract c = new contract(accountId=a.id, startdate=date.today(), contractterm=1, status='Draft', active__c=true);
    insert c;
    ContractSnapshotCreateDelete controller = new ContractSnapshotCreateDelete();
    contract_snapshot__c cs = new contract_snapshot__c();
    cs.account__c           = a.id;
    cs.contract__c          = c.id;
    cs.YYYYMM__c            = '201706';
    insert cs;
                                 controller = new ContractSnapshotCreateDelete();
    controller.YYYYMM       = '201706';
    controller.create       = true;
    controller.processCreate();
    controller.deletex      = true;
    controller.processDelete();    
    
}

Below are lines 60-76 of ContractSnapshotCreateDelete Class

ContractSnapshotCreate/Delete 
   

public PageReference processDelete() {
        if(deletex){
            list<Contract_Snapshot__c> listContract_Snapshot = [SELECT Id, YYYYMM__c FROM Contract_Snapshot__c Order By YYYYMM__c desc LIMIT 10000];
            if(listContract_Snapshot.size()>0)      
           Delete listContract_Snapshot; 
                if(listContract_Snapshot.size() == 10000){
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'First 10000 records deleted, please click delete again');
                    ApexPages.addMessage(myMsg);                  
                } else {
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO, string.ValueOf(listContract_Snapshot.size()) + ' records deleted.');
                    ApexPages.addMessage(myMsg);              
                }
            }
        }        
        deletex = null;
        return null;
    }
A portion of my visual workflow is creating a new account. Since the Account will always be a "Partner" account record type - I hardcoded the record type ID into the Assignment element, but when executing the flow, it assigns the account record to the wrong record type? Any ideas?
User-added image
User-added image
I've built a flow that triggers from a button on the opportunity, asks a few questions about the specifics of the demo, then creates a task that includes the answers to those questions. The flow I built successfully asks the questions and creates the task record but isn't populating the answers from the flow screen. This is the first flow I've built without the benefit of Trailhead or an internet resource to QA my work so I'm a bit lost as to why it's not including the demo detail on the task record.   My flow includes a record lookup of the opportunity, a screen that asks the questions the sales engineers need to scope priority, creates a record, and thanks the sales person with a link to the newly creates Sales Engineer task.
Hi there. My sales engineering team asked for some help prioritizing their demo queue. I've built a flow that triggers from a button on the opportunity, asks a few questions about the specifics of the demo, then creates a task that includes the answers to those questions. The flow I built successfully asks the questions and creates the task record but isn't populating the answers from the flow screen. This is the first flow I've built without the benefit of Trailhead or an internet resource to QA my work so I'm a bit lost as to why it's not including the demo detail on the task record. 

My flow includes a record lookup of the opportunity, a screen that asks the questions the sales engineers need to scope priority, creates a record, and thanks the sales person with a link to the newly creates Sales Engineer task. 
User-added image
User-added imageUser-added image
User-added imageUser-added image
Hi,

I know for custom report links you can insert a parameter for a Contact Id from the Contact page, but can you do something similar if the report does not relate to the Contact? For instance, I have a report of Opportunities, which has a lookup to Contact. I want to use this report, but insert a parameter for the Contact Id. I have a custom field on Opportunity to get the Contact Id, but the paramter ain't working, which makes sense because there's only the custom field I have on opportunity and NOT the actual Contact.Id. Anybody know of any solutions?

/00Oi0000005wvrc?pv0={!Contact.Id}
Hello, our Organization-wide default settings for accounts and leads is private. I would like to create a solution where if the Account Name matches the Lead Company name, then the Account Owner can edit that lead record. I've tried using code that I found on this forum to update a custom checkbox field if the Account Name and Lead Company match. The issue I'm running into is when I create the Lead sharing rule in settings, I can't specify record access by user, but rather only by group. Is there a way to specify it by Account owner? Thank you

trigger LeadMatch on Lead (before insert,before update) {
    
    List<Account> accList = [Select Id,Name from Account];
    
    for(Lead lead : trigger.new){
        lead.LeadAccountMatch__c = false;
        for(Account acc: accList){
            if(lead.Company == acc.Name && lead.OwnerId != acc.OwnerId){
                lead.LeadAccountMatch__c = true;
                break;
            }
        }        
    }
  • January 29, 2018
  • Like
  • 0
Hi,

I have a visualforce page, through which I am creating a Parent and child record (master-detail relationship). Once the child is created, based on some criteria the child record updates the parent. 

In afterInsert of the child object, I have a SOQL query on Parent object and it returns 0 records.
Following is the code that I am using:

Set<Id> setParentIds = new Set<Id>();

for(){
setParentIds.add(child.Parent__c)
}
System.debug(setParentIds); - Works fine and displays Ids of parent Object

List<parent__c> = [Select Id, field__c From parent Where Id IN:setParentIds] - This will get 0 records. 

This is totally weird, I am getting Ids in 'setParentIds' Set and when I Query why would the Query show 0 records? Any thoughts! What am I missing here! 
I have a Lead with LastName as 'Lead'. It is added to a Campaign with name 'test'. The following Query isn't working.
SELECT Id, Campaign__c.Name from Lead where LastName='Lead'
I have this requirement to be able to book appointments.

I have a list of 50 offices and people with one/more skills work at every office.

Based on the account address and skill required, I need to be able to view the calendars of everyone working in the nearest office catering services for the requested skill and book appointments based on availability of both client and service provider

Most of the apps I saw on app exchange are for sales agents to go to the customer and not for customers coming over to the office. The field service OOTB feature supports a part of the requirement. Is there any way I can achieve this through apps or configuration? Is visualforce/apex the only resort?
Is it possible to send a contact email using Process Builder without using a Flow to grab the contacts email address?
Hi,

I have a custom object which has a status field picklist. This custom object contains records about role applications and is therefore linked to a contact record. I'm trying to determine If I can setup a workflow rule on this custom object, based on the criteria of the status field, in order to update the Profile picklist on the User object.

First I''m trying to determine if this is even possible - that is to update a user record in the User Object via workflow from a custom object? I've read mixed answers to this question. If it is possible, would you be able to make any recommendations for the simplest solution to implement?

The problem I'm facing is that a custom activate button on our custom object, produces a javascript error because the user's commuinity login profile has not been definined first in the User object.

As we have different user types, it is not a good idea for us to set a default global profile type on the user object, so a workflow rule is required.

I hope that all makes sense. Please let me know if you want me to make anything clearer.

Many thanks.