• Chance Allred
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
We use Dates and then Time Windows for our company vs actual times, however for an integration I need to give it a Date/Time value to work properly. I'm creating two Date/Time formulas to hold a Start Date/Time and End Date/Time that it needs.

For whatever reason, my formula isn't working. I have no syntax errors and the formula saves fine, but no values are populating. I thought it was maybe resorting to the NULL value, but I added another Date/Time value rather than null, and it still isn't populating.

Any help is appreciated.
IF(TEXT(Appointment_Time__c)="9-1 (Morning)",
DATETIMEVALUE(
TEXT(YEAR(Appointment_Date__c))
+"-"+
TEXT(MONTH(Appointment_Date__c))
+"-"+
TEXT(DAY(Appointment_Date__c))
+" "+
"9:00:00"
),
IF(TEXT(Appointment_Time__c)="1-5 (Afternoon)",
DATETIMEVALUE(
TEXT(YEAR(Appointment_Date__c))
+"-"+
TEXT(MONTH(Appointment_Date__c))
+"-"+
TEXT(DAY(Appointment_Date__c))
+" "+
"13:00:00"
),
IF(TEXT(Appointment_Time__c)="5-7 (Evening)",
DATETIMEVALUE(
TEXT(YEAR(Appointment_Date__c))
+"-"+
TEXT(MONTH(Appointment_Date__c))
+"-"+
TEXT(DAY(Appointment_Date__c))
+" "+
"17:00:00"
), NULL)))

 
Hello, I am fairly new and am experimenting with Apex & Visualforce.

I managed to figure out how to display a list of all the users in my org, but I can't figure out how to display a specific user.

Apex Class:
public class UserResultsController {
    
    public List<String>getListOfUsers(){
		List<string> ourUsers = new list<string>();
			
        	for(User a:[SELECT Name FROM User]){
				ourUsers.add(a.Name);
			}
        
		return ourUsers;
	}
 
}
Apex Page:
<apex:page controller="UserResultsController" >
    
   <apex:repeat value="{!ListOfUsers}" var="usl"> 
       <apex:outputText value="{!usl}"/> <br/> 
   </apex:repeat>
        
</apex:page>

Is there a way to either populate the data about a specific user using their User Id or doing a query for a specific user?

I know I can display the current logged in user data by using: {!$User.FirstName} for instance, but I want to display a specific user, not the current logged in user.

Help is greatly appreciated. 
Hello all,

I am having some trouble with an Apex Trigger test class I'm writing. I am using a developer sandbox and am getting the following error:
System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: a0D6A0000015UKi: []

What I am trying to do is update a Lookup field that looks up to a Rate Sheet based on certain criteria. (Rate_Sheet__c = API Name)

I wrote the trigger and had no errors that I could see but when writing the test class it kept giving me the Insufficient Access error. Not really sure what the problem is. Under sharing settings, my org wide defaults gives public read/write access to all objects needed.

Please see the following Apex Trigger and Test Class code:
trigger UpdateRatesheetLookup on Quote (before insert, before update) {

    for (Quote quo : Trigger.new) {
       
        if (quo.TotalPrice < 3000 && quo.Buyout_Type__c == 'FMV') {
            // Sets Rate Sheet Lookup
            quo.Rate_Sheet__c = 'a0D6A0000015UKi';
            
        } else if (quo.TotalPrice < 10000 && quo.Buyout_Type__c == 'FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKj';
            
        } else if (quo.TotalPrice >= 10000 && quo.Buyout_Type__c == 'FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKk';
            
        } else if (quo.TotalPrice < 3000 && quo.Buyout_Type__c == 'Promo FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKl';
            
        } else if (quo.TotalPrice < 10000 && quo.Buyout_Type__c == 'Promo FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKm';
            
        } else if (quo.TotalPrice >= 10000 && quo.Buyout_Type__c == 'Promo FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKn';
            
        } else if (quo.TotalPrice < 3000 && quo.Buyout_Type__c == '$1-out') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKo';
            
        } else if (quo.TotalPrice < 10000 && quo.Buyout_Type__c == '$1-out') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKp';
            
        } else if (quo.TotalPrice >= 10000 && quo.Buyout_Type__c == '$1-out') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKq';
            
        } else {
            quo.Rate_Sheet__c = Null;
        }
    }
}

// Problem is happening at insertion of the myQuote instance.
@isTest
private class UpdateRateSheetLookupTest {
    
    @isTest static void updateQuote() {
        
        // Create an Account & Set Required Fields
        Account myAccount = new Account();
        myAccount.Name    = 'Sample Account';
        insert myAccount;
        
        // Create an Opportunity on the Account & Set Required Fields
        Opportunity myOpportunity = new Opportunity();
        myOpportunity.Name        = 'Sample Opportunity';
        myOpportunity.CloseDate   = Date.today();
        myOpportunity.StageName   = 'Proposal';
        myOpportunity.AccountId   = myAccount.Id; // Relates to id of account above.
        insert myOpportunity;
            
        // Fire the UpdateRatesheetLookup Trigger
        // Create a Quote associated with Opportunity & Set Required Fields
        Quote myQuote          = new Quote();
        myQuote.Name           = 'Sample';
        myQuote.OpportunityId  = myOpportunity.Id; // Relates to id of opportunity above.
        //myQuote.TotalPrice   = 2500;
        myQuote.Buyout_Type__c = 'FMV';
       	insert myQuote; // FLAG: PROBLEM HERE
        
        // Update the Quote
        myQuote.Description = 'Test';
       	update myQuote;
    }
}

Any help with this would be greatly appreciated. 
Thanks in advance!
 
We use Dates and then Time Windows for our company vs actual times, however for an integration I need to give it a Date/Time value to work properly. I'm creating two Date/Time formulas to hold a Start Date/Time and End Date/Time that it needs.

For whatever reason, my formula isn't working. I have no syntax errors and the formula saves fine, but no values are populating. I thought it was maybe resorting to the NULL value, but I added another Date/Time value rather than null, and it still isn't populating.

Any help is appreciated.
IF(TEXT(Appointment_Time__c)="9-1 (Morning)",
DATETIMEVALUE(
TEXT(YEAR(Appointment_Date__c))
+"-"+
TEXT(MONTH(Appointment_Date__c))
+"-"+
TEXT(DAY(Appointment_Date__c))
+" "+
"9:00:00"
),
IF(TEXT(Appointment_Time__c)="1-5 (Afternoon)",
DATETIMEVALUE(
TEXT(YEAR(Appointment_Date__c))
+"-"+
TEXT(MONTH(Appointment_Date__c))
+"-"+
TEXT(DAY(Appointment_Date__c))
+" "+
"13:00:00"
),
IF(TEXT(Appointment_Time__c)="5-7 (Evening)",
DATETIMEVALUE(
TEXT(YEAR(Appointment_Date__c))
+"-"+
TEXT(MONTH(Appointment_Date__c))
+"-"+
TEXT(DAY(Appointment_Date__c))
+" "+
"17:00:00"
), NULL)))

 
Hello, I am fairly new and am experimenting with Apex & Visualforce.

I managed to figure out how to display a list of all the users in my org, but I can't figure out how to display a specific user.

Apex Class:
public class UserResultsController {
    
    public List<String>getListOfUsers(){
		List<string> ourUsers = new list<string>();
			
        	for(User a:[SELECT Name FROM User]){
				ourUsers.add(a.Name);
			}
        
		return ourUsers;
	}
 
}
Apex Page:
<apex:page controller="UserResultsController" >
    
   <apex:repeat value="{!ListOfUsers}" var="usl"> 
       <apex:outputText value="{!usl}"/> <br/> 
   </apex:repeat>
        
</apex:page>

Is there a way to either populate the data about a specific user using their User Id or doing a query for a specific user?

I know I can display the current logged in user data by using: {!$User.FirstName} for instance, but I want to display a specific user, not the current logged in user.

Help is greatly appreciated. 
Hello all,

I am having some trouble with an Apex Trigger test class I'm writing. I am using a developer sandbox and am getting the following error:
System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: a0D6A0000015UKi: []

What I am trying to do is update a Lookup field that looks up to a Rate Sheet based on certain criteria. (Rate_Sheet__c = API Name)

I wrote the trigger and had no errors that I could see but when writing the test class it kept giving me the Insufficient Access error. Not really sure what the problem is. Under sharing settings, my org wide defaults gives public read/write access to all objects needed.

Please see the following Apex Trigger and Test Class code:
trigger UpdateRatesheetLookup on Quote (before insert, before update) {

    for (Quote quo : Trigger.new) {
       
        if (quo.TotalPrice < 3000 && quo.Buyout_Type__c == 'FMV') {
            // Sets Rate Sheet Lookup
            quo.Rate_Sheet__c = 'a0D6A0000015UKi';
            
        } else if (quo.TotalPrice < 10000 && quo.Buyout_Type__c == 'FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKj';
            
        } else if (quo.TotalPrice >= 10000 && quo.Buyout_Type__c == 'FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKk';
            
        } else if (quo.TotalPrice < 3000 && quo.Buyout_Type__c == 'Promo FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKl';
            
        } else if (quo.TotalPrice < 10000 && quo.Buyout_Type__c == 'Promo FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKm';
            
        } else if (quo.TotalPrice >= 10000 && quo.Buyout_Type__c == 'Promo FMV') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKn';
            
        } else if (quo.TotalPrice < 3000 && quo.Buyout_Type__c == '$1-out') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKo';
            
        } else if (quo.TotalPrice < 10000 && quo.Buyout_Type__c == '$1-out') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKp';
            
        } else if (quo.TotalPrice >= 10000 && quo.Buyout_Type__c == '$1-out') {
            quo.Rate_Sheet__c = 'a0D6A0000015UKq';
            
        } else {
            quo.Rate_Sheet__c = Null;
        }
    }
}

// Problem is happening at insertion of the myQuote instance.
@isTest
private class UpdateRateSheetLookupTest {
    
    @isTest static void updateQuote() {
        
        // Create an Account & Set Required Fields
        Account myAccount = new Account();
        myAccount.Name    = 'Sample Account';
        insert myAccount;
        
        // Create an Opportunity on the Account & Set Required Fields
        Opportunity myOpportunity = new Opportunity();
        myOpportunity.Name        = 'Sample Opportunity';
        myOpportunity.CloseDate   = Date.today();
        myOpportunity.StageName   = 'Proposal';
        myOpportunity.AccountId   = myAccount.Id; // Relates to id of account above.
        insert myOpportunity;
            
        // Fire the UpdateRatesheetLookup Trigger
        // Create a Quote associated with Opportunity & Set Required Fields
        Quote myQuote          = new Quote();
        myQuote.Name           = 'Sample';
        myQuote.OpportunityId  = myOpportunity.Id; // Relates to id of opportunity above.
        //myQuote.TotalPrice   = 2500;
        myQuote.Buyout_Type__c = 'FMV';
       	insert myQuote; // FLAG: PROBLEM HERE
        
        // Update the Quote
        myQuote.Description = 'Test';
       	update myQuote;
    }
}

Any help with this would be greatly appreciated. 
Thanks in advance!