• Amil_Abdallah
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
The Topic Catalog Component proves that it is possible to create a component that lists out just the nav topics. How do we replicate this?
  • April 03, 2018
  • Like
  • 0
I was attempting to complete the following trail: https://trailhead.salesforce.com/projects/workshop-lightning-programmatic/steps/programmatic-step-3
and while I was able to pass the challenge, I am not satisified with the fact that I can't replicate the appearance of the Other Properties visualforce page inside of the lightning record view. I believe they are missing code from the base file they had inteded us to modify.  If you look at the original page before enabling it for lightning, you can see the table has 6 columns.  The final result only shows 5.  The original table had the column for Broker, but that looks to magically have been removed in their screenshot after enabling the page for lighting.  It also seems the Property Name column has been renamed to just Name, and it also looks like the column was made into an outputlink so that by clicking the property name will take you to the associated record page. I modified my visualforce page code to match the appearance as best i could:

<apex:page standardController="Property__c" extensions="GetPropertiesApexController" lightningStylesheets="true">
    <apex:slds rendered="{! !isClassic}" />
    <apex:form>
        <apex:pageBlock >
          <apex:pageBlockTable value="{! properties }" var="ct" id="leads_list">
                <apex:column headerValue="Name">
                    <apex:outputLink value="{!ct.Id}">{!ct.Name}</apex:outputLink>
                </apex:column>
                <apex:column value="{! ct.beds__c}" />
                <apex:column value="{! ct.baths__c}" />
                <apex:column value="{! ct.price__c}" />
                <apex:column value="{! ct.status__c}" />
            </apex:pageBlockTable>
       </apex:pageBlock>
    </apex:form>
</apex:page>


While the following code produces the solution, it still does not match the visual appearance shown in their image.  This is what my table looks like:  https://ibb.co/hNi6wH 

Am I missing something? I think the table looks ugly when compared to how clean their table looks. Any assistance is greatly
I was recently introduced to a Stamp/StampAssignment objects as per this Spring '17 release notes document (http://releasenotes.docs.salesforce.com/en-us/spring17/release-notes/rn_networks_profiles_specialty.htm?edition=&impact) I used the workbench to insert a Stamp record and a related Stamp Assignment record for myself.  I went to view my profile and I am not seeing the Stamp label text show up under my profile photo.  Has anyone used this with successful results?
The Topic Catalog Component proves that it is possible to create a component that lists out just the nav topics. How do we replicate this?
  • April 03, 2018
  • Like
  • 0
I was recently introduced to a Stamp/StampAssignment objects as per this Spring '17 release notes document (http://releasenotes.docs.salesforce.com/en-us/spring17/release-notes/rn_networks_profiles_specialty.htm?edition=&impact) I used the workbench to insert a Stamp record and a related Stamp Assignment record for myself.  I went to view my profile and I am not seeing the Stamp label text show up under my profile photo.  Has anyone used this with successful results?
I have a Case beforeInsert trigger that calls AddEntitlement method (code below).  Works fine except if case is created in the Community by a customer.  Our Customer Community is using Napili template and Lightning, would that have anything to do with it?
 
public static void AddEntitlement(list<Case> triggerCases){
		//find accounts with 2 entitlements
        list<Account> lstSpecialAcct = [SELECT Id, Name FROM Account WHERE Name = 'One' OR Name = 'Two' OR Name = 'Three'];

        map<string, Account> mapSpecialAccts = new map<string, Account>();
        for(Account a : lstSpecialAcct) {
            mapSpecialAccts.put(a.id, a);
        }
        
        list<Id> lstAccountIDs = new list<Id>();
        
        for(Case c : triggerCases) {
        //for(Case c : (List<Case>) Trigger.new) {
            if(c.AccountId != null && c.IsClosed == False && c.EntitlementId == null) {
                lstAccountIDs.add(c.AccountId);
            }
        }
        if(lstAccountIDs.size()>0) {
            list<Entitlement> lstEntitlements = [SELECT ID, Name, Status, BusinessHoursId, AccountId, StartDate, EndDate FROM Entitlement WHERE AccountID IN : lstAccountIDs AND Status = 'Active' ORDER BY Name];

            if(lstEntitlements.isEmpty()==false) {
				list<Entitlement> lstAssignedEnts = new list<Entitlement>();
				for(Case c : (List<Case>) Trigger.new) {
					if(c.EntitlementId == null && c.AccountId != null && c.IsClosed == false) {
                        lstAssignedEnts.clear();
						for(Entitlement e : lstEntitlements) {
							if(e.AccountId == c.AccountId) {
								lstAssignedEnts.add(e);
							}
						}
                        
                        if(lstAssignedEnts.isEmpty() == true){
                            system.debug('AddEntitlement Method - 0 Entitlements');
                            system.debug('  AccountId: ' + c.AccountId);
                            system.debug('  CaseId: ' + c.Id);
                            system.debug('  CaseNumber: ' + c.CaseNumber);
                        }

						if(lstAssignedEnts.size() == 1) {
                            system.debug('AddEntitlement Method - 1 Entitlement');
							c.EntitlementId = lstAssignedEnts.get(0).id;
                            c.BusinessHoursId = lstAssignedEnts.get(0).BusinessHoursId;
						}

						if(lstAssignedEnts.size() == 2 && mapSpecialAccts.containsKey(c.AccountId)) {
                             system.debug('AddEntitlement Method - 2 Entitlements');

							if(mapSpecialAccts.get(c.AccountId).Name == 'One') {
								//Category = Mobile gets Mobile Entitlement else gets Legacy entitlement
								system.debug('AddEntitlement Method - One');
                                if(c.Category__c == 'Mobile'){
                                    system.debug('AddEntitlement Method - One - Mobile is 1: ' +  lstAssignedEnts.get(1).Name);
                                 	c.EntitlementId = lstAssignedEnts.get(1).Id;
                                    c.BusinessHoursId = lstAssignedEnts.get(1).BusinessHoursID;
                            	}
                                else {
                                    system.debug('AddEntitlement Method - One - Legacy is 0: ' +  lstAssignedEnts.get(0).Name);
                                    c.EntitlementId = lstAssignedEnts.get(0).Id;
                                    c.BusinessHoursId = lstAssignedEnts.get(0).BusinessHoursID;
                                }
                            }	

                           	if(mapSpecialAccts.get(c.AccountId).Name == 'Two') {
                            	//Severity = Sev 2 and Priority = Critical gets Bespoke else gets Legacy Entitlement
                            	system.debug('AddEntitlement Method - Two');
                                if(c.Severity__c == 'Severity 2' && c.Priority == 'Critical'){
                                    system.debug('AddEntitlement Method - Two - Bespoke is 0: ' +  lstAssignedEnts.get(0).Name);
                                 	c.EntitlementId = lstAssignedEnts.get(0).Id;
                                    c.BusinessHoursId = lstAssignedEnts.get(0).BusinessHoursID;
                            	}
                                else {
                                    system.debug('AddEntitlement Method - Two - Legacy is 1: ' +  lstAssignedEnts.get(1).Name);
                                 	c.EntitlementId = lstAssignedEnts.get(1).Id;
                                    c.BusinessHoursId = lstAssignedEnts.get(1).BusinessHoursID;
                                }
                            }

                           	if(mapSpecialAccts.get(c.AccountId).Name == 'Three') {
                            	//needs a validation rule?? (ignores new cases(isNew?), only on updates)
                            	system.debug('AddEntitlement Method - Three');
                           	}
                            
                        }
					}
				}
            }
        }
    }

 
i have trigger i tried to write trigger iam stuck with how to installlize values into lookup field

trigger:
trigger updatecompany on Expense_Report__c(after insert){
        map<Id,Region__c> mapIds = new map<Id,Region__c>();
               for(Expense_Report__c er : trigger.new){
                    if(er.Company__c != null || er.Company__c != ''){
                        Region__c reg = new Region__c(id= er.Region__c);                     
                        reg.Company__c= er.Company__c;
                        mapIds.put(er.Company__c,reg);
                    }
            }
    if(!mapIds.isEmpty()){
        update mapIds.values();
    }
}


and test class

@isTest
public with sharing class updatecompanyTestClass {
    public static testmethod void updatecompanyTest(){        
        List<Expense_Report__c> PERlist = new List<Expense_Report__c>();                
        Expense_Report__c PERObj = new Expense_Report__c(Name='Travel',Region__c='Russia',Company__c='Genpact');
        insert PERObj;                
        test.starttest();
            update PERObj;
        test.stopTest();
             system.assertEquals(PERObj.Company__c, PERObj.Company__c);
    }
}

FATAL_ERROR System.StringException: Invalid id: Russia      here region (Russia) is lookup field and 
FATAL_ERROR System.StringException: Invalid id: XYZ          here Comany(XYZ) is lookup field

Iam facing above issues, please help me out
HI,

Iam afraid as a begginer.
on a account table i have custom field termEndDate__c which was a formula field of type date,so when termEndDate__c is set to less than 90 days on a particular account, i have to send an email with the account name,and this has to done on monthly basis as a schedule and we need to include account name in the email,and has to check all the accounts in my salesforce org should send an email which accounts are less than 90 days. is it possible.please help me out

 
Can anyone see why this code in an apex class called by a before update trigger would not work correctly?  
The FX_Rate__c object has records current through today and 3 years back for both GBP and EUR.  Yet the Date__c value that it populates is randomly 2 years prior to the selected date. (e.g.objOpp.FX_Rate_Date__c selected is 2017-04-30 yet the Date__c that gets populated is 2015-06-05.)
Code sample below:
list<FX_Rate__c> fxRate = [Select Id, FX_Rate__c,Currency_Code__c, Date__c from FX_Rate__c WHERE Currency_Code__c IN('GBP','EUR') ORDER BY Date__c DESC NULLS LAST];
            for (Opportunity objOpp :oppList)
            {
              if (objOpp.Ticket_Currency__c != 'USD')
             {
                        Date fxDate = objOpp.FX_Rate_Date__c;
                       if (fxRate.size() > 0)
                        {
                            for (FX_Rate__c rate :fxRate)
                            {                                
                                if(fxDate.isSameDay(rate.Date__c)  && objOpp.Ticket_Currency__c  == rate.Currency_Code__c)
                                {
                                    objOpp.FX_Rate__c = rate.Id;
                                    objOpp.FX_Rate_Date__c = fxDate;                                                                     
                                       break;                                       
                                }
                                fxDate = fxDate.addDays(-1);
                            }
                        }