• TNieman
  • NEWBIE
  • 30 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 15
    Replies
I have checked the box for "Let dashboard viewers choose whom they view the dashboard as" in the dashboard properties.

I am the System Administrator and I can change the running user, but logging in as another Manager for the dashboard folder, it does not allow changing the running user.

What permissions are needed to do this in Lightning?
I was going to create an Idea for this but found someone already had  -  please vote  - https://trailblazer.salesforce.com/ideaView?id=0873A0000015C1RQAU
Just recently someone stated that the Create Case global action I created was not working.  I am the System Admin, I went and tried it and it is not working for me either.  Previously clicking the Global Action button (the + in the top right corner) would pop open a list of Global Actions.  Now nothing is happening

Any ideas what happened or where to look?
We have a Component in our list called Report Chart in a section called Analytics.  I would like to use that as a child compent inside a component I am building and want to pass it the report to run.

Is this possible?  I can't seem to find the Report Chart component in Dev Console
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 a VF page that pulls 4 fields from a case field set, 3 of them properly pull the existing value, the 4th (textarea) doesn't.  It will save what you put in it, but it doesn't display the existing value

Here is the VF page
<apex:page standardController="Case" extensions="ResolvedCase" showHeader="true" sidebar="false" tabStyle="Case">
    <apex:sectionHeader title="Case" subtitle="Resolve Case" />
    
    <apex:form id="caseResovleCaseForm" >
        <apex:pageBlock >
            <apex:pageBlockSection title="Case Resolution"  collapsible="false" columns="1">
                <apex:repeat value="{!$ObjectType.Case.FieldSets.ResolveCase}" var="r">
                    <apex:inputField value="{!Case[r.fieldPath]}" required="{!OR(r.required, r.dbrequired)}" rendered="{!NOT(CONTAINS(r.fieldPath,'Description'))}"/>
                    <apex:inputTextarea value="{!Case[r.fieldPath]}" required="{!OR(r.required, r.dbrequired)}" rendered="{!(CONTAINS(r.fieldPath,'Description'))}" cols="100" rows="5" />
                </apex:repeat>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Resolve Case" action="{!save}"/> 
                <apex:commandButton value="Cancel" action="{!cancel}"/> 
            </apex:pageBlockButtons>
        </apex:pageBlock>
     </apex:form>
</apex:page>

Here is the field set
Field set used on page

Here are the preexisting values (also Status = Resolved)
User-added image

I also have an Action to do the same thing on the  Feed, and it works fine there.

Here is the action page (Resolution Description is populated)
User-added image 

Here is the VF page (Resolution Description not populated)
User-added image

Any help would be greatly appreciated.

Tom
I need a new Case Insert Trigger code and we already have 
trigger CaseAfter on Case (after delete, after insert, after undelete, after update)

I only need "after insert" with some specific conditions (a particular account type to add a predefined Case Team) .  Should I created a new trigger or update the exisiting and a separate processing for the specific "after insert" I need?

Tom
I have successfully created a small banner on the top of the Case layout with a simply VF page 
 
<apex:page StandardController="Case" showHeader="false" standardStylesheets="false" sidebar="false">
    <body style="background-color:lightblue;">
        <div align="center">
            <h2>HCM Parent Case - {!Case.CaseNumber}</h2>
        </div> 
    </body>  
</apex:page>
Sample rendered
User-added image


I would like to create a new page that changes the background color based on Severity__c field. See below
//for Severity__c = 'Severity 1'
      	<body style="background-color:red;">
    	    	<div align="center">
        	    	<h2><b>Severity 1 Case</b></h2>
       		</div> 
	</body> 

//for Severity__c = 'Severity 2'
      	<body style="background-color:yellow;">
    	    	<div align="center">
        	    	<h2><b>Severity 2 Case</b></h2>
       		</div> 
	</body> 

//for everything else display nothing
I'm not sure how to accomplish this.  If it is not possible to have the "everything else" be empty, I could add the 2 remaining values of Severity__c as different colors
 
Just recently someone stated that the Create Case global action I created was not working.  I am the System Admin, I went and tried it and it is not working for me either.  Previously clicking the Global Action button (the + in the top right corner) would pop open a list of Global Actions.  Now nothing is happening

Any ideas what happened or where to look?
I am looking to create a custom button in Lightning, so when it is clicked it will auto populate an email template that will be sent to a speific email address not associated with the contact. 

Can this be done?

Looking for some expert advice. Thank you!
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 need a new Case Insert Trigger code and we already have 
trigger CaseAfter on Case (after delete, after insert, after undelete, after update)

I only need "after insert" with some specific conditions (a particular account type to add a predefined Case Team) .  Should I created a new trigger or update the exisiting and a separate processing for the specific "after insert" I need?

Tom
I have successfully created a small banner on the top of the Case layout with a simply VF page 
 
<apex:page StandardController="Case" showHeader="false" standardStylesheets="false" sidebar="false">
    <body style="background-color:lightblue;">
        <div align="center">
            <h2>HCM Parent Case - {!Case.CaseNumber}</h2>
        </div> 
    </body>  
</apex:page>
Sample rendered
User-added image


I would like to create a new page that changes the background color based on Severity__c field. See below
//for Severity__c = 'Severity 1'
      	<body style="background-color:red;">
    	    	<div align="center">
        	    	<h2><b>Severity 1 Case</b></h2>
       		</div> 
	</body> 

//for Severity__c = 'Severity 2'
      	<body style="background-color:yellow;">
    	    	<div align="center">
        	    	<h2><b>Severity 2 Case</b></h2>
       		</div> 
	</body> 

//for everything else display nothing
I'm not sure how to accomplish this.  If it is not possible to have the "everything else" be empty, I could add the 2 remaining values of Severity__c as different colors
 
I am new to coding as well as to the Lightning Experience. I am trying to create a Custom Lightning Component for a specific Related List so I can create a tab for it on the Lightning App Builder. For example, when viewing an account, I would like to create a custom tab titled "Contacts" that will show me the related contacts for that account. vs. having all the related lists under the "Related" tab. I would also like to do this for other related lists (including custom object related lists), but if provided with assistance for the Custom Lightning Component for the Contacts I can figure it out. Thanks!

1.Create a field for business days using a number formula field. Use the following formula to calculate minus weekends.

 

CASE( 
MOD(DATEVALUE(CreatedDate) - DATE(1900, 1, 7), 7), 
0, (TODAY() - DATEVALUE(CreatedDate)) - 1 - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2, 
1, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2, 
2, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2, 
3, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2, 
4, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2, 
5, (TODAY() - DATEVALUE(CreatedDate)) - 2 - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2, 
6, (TODAY() - DATEVALUE(CreatedDate)) - 2 - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2, 
null)

 

 

2.Create a date/time field for the current date/time 

 

3.Create workflow rule to update this field every time it is edited with formula below

 

Now()

 

 

4.Create a number formula field to calculate the age difference of the case today. I used the formula

 

VALUE( MID( TEXT( NOW__c ), 12, 2 ) ) - VALUE( MID( TEXT( CreatedDate ), 12, 2 ) )

 

 

5.Create a number formula field for the business hours of the company ie. 8 hrs

 

 

 

6.Create a number formula field to calculate the total age of the case in business hours

 

(business_days__c * business_hours ) + age_difference_of_case

 

Is it possible to use a trigger to automate the creation of Campaign Member Status? For example, when a campaign of certain type is created, I would like to automatically add 'Show', 'No show' i nthe list of Campaign Member Status. Is it possible?

Thanks

Pierre