• St2018
  • NEWBIE
  • 40 Points
  • Member since 2017
  • Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 8
    Replies
I have flow. The conditions the flow should run on is when the picklist field  called status = Completed and the field trackUrl is not blank/null
Then the flow will fire off an email alert. This is my formula in the flow.
 
ISPICKVAL({!$Record.Status},"Completed" ) && NOT(ISBLANK({!$Record.Shipment__r.TrackingUrl}))


When I test it  regardless if a value is present or not in the trackUrl field the flow still send an email. Which i don't want.  It should only work when it has correct status and a value exist in trackUrl field.

Second part  is I would like to display the trackUrl value in the email template. While testing the value is not displaying in the visualforce email template. Can someone help?

What i have in my VF template

{!relatedTo.Shipment__r.TrackingUrl}


 
I want to export records and related records  to then import into another org.  Is it possible to use Salesforce dx or another tool to find  the relationships between all objects that are multiple levels deep? How can I do this?
I'm looking to automate different processes in our org. Is there an appexchange  app?  Or can provide some strategies  on how we can automate  repeatable tasks  and/or processes if we know what needs to prefilled in? 
I've looked into email logs, test deliverablity,  white list salesforce ip ranges and  checked users emails. We are using process builder to invoke an apex class that sends single email message alerts to receipents depending on what stage the opportunity is in   We tested in sandboxes and we don't experience this issue  just only in production org. Reached out to salesforce support and they werent any help.What can I do to determing root cause ?
  • April 22, 2019
  • Like
  • 0
list<Opportunity> oppList = SATestUtil.createOpportunity(10);
        
        for(Opportunity opp : oppList ){
           opp.Type = 'New';
           opp.StageName = 'Executed'; 
           opp.Tenant_Construction = date.today();
           opp.Source_System_Id__c = 'test';
        }
    	update oppList;

 I am migrating records and I've wrote a batch class.In my query I have a where condition to filter the migrated records. how can i test for that in my test class?   the where condition is Source_System_Id__c != null;  I get an error System.DmlException: Update failed. First exception on row 1 with id 0061k000005ySO5AAM; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>: []
  • March 21, 2019
  • Like
  • 0
Im not sure how to get started unit test this method below.
private static double setAfterSave(Opportunity deal) { 
        double returnValue;
        if(deal.Restaurant__c) {            
          returnValue = deal.HVAC__c == null ? 0 : deal.HVAC__c;
        } else {
           returnValue = deal.HVAC__c == null ? 0 : deal.HVAC__c;
        }
        return returnValue;
    }
  • March 05, 2019
  • Like
  • 0
It is happening on the MAP_Line_Item_Forecast__c  I dont understand why I get this error. I am new to Apex. Here is the code below
public List<MAP_Line_item_Forecast__c> queryLineItems(Set<Id> dealIds, Set<Id> leaseIds, Set<Id> actualsWithoutLeaseIds, Set<String> buildingUnitsForSpecs) { 
      system.debug('buildingUnitsForSpecs: ' + buildingUnitsForSpecs);
        return [select Id, BuildingUnit__c, Building__c, DBA__c,
            Lead_Id__c, Latest_Amendment_Deal__c, Is_Perm_Activity__c, Square_Footage__c, Category_Code__c, 
            LOB__c, Lob__r.Lob_Name__c, Lob__r.Business_Group__c, lob__r.Parent_LOB__c, lob__r.parent_lob__r.id,
            Lease_Id__c, Lease_Id__r.RecordTypeId, Lease_Id__r.RecordType.Name, 
            Deal_Id__r.Atm__c, Deal_Id__r.Kiosk__c, Deal_Id__r.Antenna__c, Deal_Id__r.RecordTypeId,Deal_Id__r.RecordType.Name, deal_id__r.StageName,
            Start_Date__c, End_Date__c, Date_of_Possession__c, Unit__c, MAP_Line_Item_Source__c, Company__c,
            isActive__c, // necessary so we can check the field as line items are updated for overlap 
            (select Id, Year__c,
                Jan__c, Feb__c, Mar__c, Apr__c, May__c, Jun__c, Jul__c, Aug__c, Sep__c, Oct__c, Nov__c, Dec__c,
                Jan_Actual__c, Feb_Actual__c, Mar_Actual__c, Apr_Actual__c, May_Actual__c, Jun_Actual__c, Jul_Actual__c, Aug_Actual__c, Sep_Actual__c, Oct_Actual__c, Nov_Actual__c, Dec_Actual__c 
                from MAP_Monthly_Forecast_Stats__r) 
            from MAP_Line_Item_Forecast__c 
            where isActive__c = true and ( 
                ( Deal_Id__c in :dealIds ) 
                or ( Lease_Id__c in :leaseIds )
                or ( Actual_Id__c in :actualsWithoutLeaseIds )
                //or ( Latest_Amendment_Deal__c in :amendedDealIds ) 
                or ( MAP_Line_Item_Source__c = :MAP_Constants.MAP_LINE_ITEM_SOURCE_SPEC_DEAL and BuildingUnit__c in :buildingUnitsForSpecs)
            )];
  }

 
  • January 17, 2019
  • Like
  • 0
lI am receiving too many soql queries: 101.
Need elp on how I  can redo this bit of code to reduce the number of queries to stop the receiving the error.
private Id hasTemplateBuilding(Apttus__APTS_Agreement__c agreement) {
        if(agreement != null) {
            List<Template_Assignment__c> building = [SELECT Template__c FROM Template_Assignment__c WHERE Building__c =: agreement.Building__c];
            if(building.size() == 1) {
                return building[0].Template__c;
            } else {
                return null;
            }
        } else {
            return null;
        }
    }
  • October 13, 2018
  • Like
  • 0
I want to compare code changes in all classes in my dev and qa org.
Im having trouble writing unit test for my method. I've gone through apex testing on trailhead but I don't fully  grasp  how to get started. Its still a confusing topic for me.  Below is the method I would like to write unit test for. An example of how I can test my method  or something similar to code would be helpful.   What my  method does is  onclick of custom button  it will check if the fields are blank if it is blank it will display a message to user that the field is required. Im really stuck on how to get started writing a unit test for this. 
 
WebService static String validationsl(String objId){ 
Opportunity OppSubmit =[select id,Final_Space__c,Date_of_Possession__c,Store_Opening_Projected__c,recordtype.name from opportunity where id =:objId];
jsonResult finalResult=new jsonResult();
finalResult.Message = '';
finalResult.status = true;
   try{
               
            if(OppSubmit.recordtype.name=='Permanent'){
                if(OppSubmit.Final_Space__c == null){
                     getJoinText('"Final Space" is required', finalResult);
                }
                if(OppSubmit.Date_of_Possession__c == null){
                    getJoinText('"Date of Possession (Mutually Agreed)." is required', finalResult);
                }
                if(OppSubmit.Store_Opening_Projected__c == null){
                    getJoinText('"Store Opening (Projected)." is required', finalResult);
                } 
            }
			return JSON.serialize(finalResult);
       
     }catch(exception ex){
 			System.debug('An Exception occured submitting deal for approval :'+ex.getTypeName()+'\t:'+ex.getMessage());
            finalResult.Message +='\n'+ ex.getTypeName()+' : '+ex.getMessage();
            return JSON.serialize(finalResult);      
    }
    
}

 
My company is experiencing governor limits.How can I identify where and what things are hitting governors limits in our org so that I can help resolve or provide better feedback about how to solve our governor limits problem?
If a user selects A or B from selectlist I want to insert some text into an inputfield.If selected value is something else I want to clear the text. Then if  value is A or C and user starts to type text in the inputfield  I want to clear the typed in text again  if the user decides to change selectlist value from A to C.
  • April 20, 2018
  • Like
  • 0
I can't remember if the best practice is  to comment out unused code applied to only Apex or  javascript as well.
  • April 04, 2018
  • Like
  • 0
On my visualforce page I have this.
<apex:inputTextarea value="{!emp.Job_description__c}" styleClass="form-control"/>

In my controller I have this
if (String.isBlank(emp.Job_description__c)) {
                    emp.Job_description__c.addError(System.Label.ValidationEmploymentDescription);
                    doNotsubmit = true;
                }
This works for other fields on my visualforce page except for this one. 
I have a pageMessage on my page and it has the error message above in a box but not under the field.
The message should be displayed under the field and also above in the pageMessage.
  • November 16, 2017
  • Like
  • 0
I want to export records and related records  to then import into another org.  Is it possible to use Salesforce dx or another tool to find  the relationships between all objects that are multiple levels deep? How can I do this?
I've looked into email logs, test deliverablity,  white list salesforce ip ranges and  checked users emails. We are using process builder to invoke an apex class that sends single email message alerts to receipents depending on what stage the opportunity is in   We tested in sandboxes and we don't experience this issue  just only in production org. Reached out to salesforce support and they werent any help.What can I do to determing root cause ?
  • April 22, 2019
  • Like
  • 0
Im not sure how to get started unit test this method below.
private static double setAfterSave(Opportunity deal) { 
        double returnValue;
        if(deal.Restaurant__c) {            
          returnValue = deal.HVAC__c == null ? 0 : deal.HVAC__c;
        } else {
           returnValue = deal.HVAC__c == null ? 0 : deal.HVAC__c;
        }
        return returnValue;
    }
  • March 05, 2019
  • Like
  • 0
Im having trouble writing unit test for my method. I've gone through apex testing on trailhead but I don't fully  grasp  how to get started. Its still a confusing topic for me.  Below is the method I would like to write unit test for. An example of how I can test my method  or something similar to code would be helpful.   What my  method does is  onclick of custom button  it will check if the fields are blank if it is blank it will display a message to user that the field is required. Im really stuck on how to get started writing a unit test for this. 
 
WebService static String validationsl(String objId){ 
Opportunity OppSubmit =[select id,Final_Space__c,Date_of_Possession__c,Store_Opening_Projected__c,recordtype.name from opportunity where id =:objId];
jsonResult finalResult=new jsonResult();
finalResult.Message = '';
finalResult.status = true;
   try{
               
            if(OppSubmit.recordtype.name=='Permanent'){
                if(OppSubmit.Final_Space__c == null){
                     getJoinText('"Final Space" is required', finalResult);
                }
                if(OppSubmit.Date_of_Possession__c == null){
                    getJoinText('"Date of Possession (Mutually Agreed)." is required', finalResult);
                }
                if(OppSubmit.Store_Opening_Projected__c == null){
                    getJoinText('"Store Opening (Projected)." is required', finalResult);
                } 
            }
			return JSON.serialize(finalResult);
       
     }catch(exception ex){
 			System.debug('An Exception occured submitting deal for approval :'+ex.getTypeName()+'\t:'+ex.getMessage());
            finalResult.Message +='\n'+ ex.getTypeName()+' : '+ex.getMessage();
            return JSON.serialize(finalResult);      
    }
    
}

 
On my visualforce page I have this.
<apex:inputTextarea value="{!emp.Job_description__c}" styleClass="form-control"/>

In my controller I have this
if (String.isBlank(emp.Job_description__c)) {
                    emp.Job_description__c.addError(System.Label.ValidationEmploymentDescription);
                    doNotsubmit = true;
                }
This works for other fields on my visualforce page except for this one. 
I have a pageMessage on my page and it has the error message above in a box but not under the field.
The message should be displayed under the field and also above in the pageMessage.
  • November 16, 2017
  • Like
  • 0