• Callum Whitehouse
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 12
    Replies
For communities, I'm trying to show certain elements based on their profile. To get the profile of a logged in user I was planning on using a contact ID field. Here is the code:
SELECT BiRetix_Toolkit__c, AesthetiCare_Cleansers_Toolkit__c, EDS_Toolkit__c, Endocare_CELLPRO_Toolkit__c, Endocare_Concentrates_Toolkit__c,Endocare_Growth_Factor_Facials__c, Endocare_Tensage_Toolkit__c, Endocare_C_Ferulic_Toolkit__c, ENDYMED_Toolkit__c, G_T_Peels_Toolkit__c, Heliocare_360_Toolkit__c, NeoRettin_Toolkit__c, NeoRetin_Rejuvemax_Toolkit__c, Retriderm_Toolkit__c 
FROM Contact 
WHERE Contact_ID__c 
IN (SELECT ContactId FROM User WHERE username=:UserInfo.getUsername())
However this gives an error:
The left operand field in the where expression for outer query should be an id field, cannot use: 'Contact_ID__c'

Can anyone help me resolve this issue please?
 
I've tried to complete the Trailhead for Apex test classes however I've not been able to apply the knowledge to our specific scenario. For our Salesforce Community, external users will have access to some or all of our marketing toolkits. This access is dependent on whether they have a certain field checked as true in their profile (e.g. BiRetix_Toolkit__c).

Apex class to test:

public class FileRepositoryController {
    @AuraEnabled
    
       public static List<Contact> getItems() {
        List<Contact> TK = [SELECT BiRetix_Toolkit__c, AesthetiCare_Cleansers_Toolkit__c, 
                            EDS_Toolkit__c, Endocare_CELLPRO_Toolkit__c, Endocare_Concentrates_Toolkit__c,
                            Endocare_Growth_Factor_Facials__c, Endocare_Tensage_Toolkit__c, Endocare_C_Ferulic_Toolkit__c,
                            ENDYMED_Toolkit__c, G_T_Peels_Toolkit__c, Heliocare_360_Toolkit__c, NeoRettin_Toolkit__c, 
                            NeoRetin_Rejuvemax_Toolkit__c, Retriderm_Toolkit__c FROM Contact WHERE AccountId IN 
                            (SELECT AccountId FROM User WHERE username=:UserInfo.getUsername())];
        return TK;
    }
}

Would someone be able to assist in helping me write a correct test class please?
I'm trying to display 'True' if the field 'Heliocare_360_Toolkit__c' is checked, however it only shows false even when the profile has this field checked. 

<aura:component implements="forceCommunity:availableForAllPageTypes">
    <aura:attribute name="title" type="String" default="Marketing Toolkit Repository"/>
     <aura:attribute name="contact" type="Contact"/>
    <lightning:card>
        <aura:set attribute="title">
            {! v.title }
        </aura:set>
            <aura:if isTrue="{!v.contact.Heliocare_360_Toolkit__c}">
                True    
                <aura:set attribute="else">
                  False
                </aura:set>
              </aura:if>
                   
        
    </lightning:card>
</aura:component>

Can anyone see if I've made any obvious errors please?
For communities, I'm trying to show certain elements based on their profile. To get the profile of a logged in user I was planning on using a contact ID field. Here is the code:
SELECT BiRetix_Toolkit__c, AesthetiCare_Cleansers_Toolkit__c, EDS_Toolkit__c, Endocare_CELLPRO_Toolkit__c, Endocare_Concentrates_Toolkit__c,Endocare_Growth_Factor_Facials__c, Endocare_Tensage_Toolkit__c, Endocare_C_Ferulic_Toolkit__c, ENDYMED_Toolkit__c, G_T_Peels_Toolkit__c, Heliocare_360_Toolkit__c, NeoRettin_Toolkit__c, NeoRetin_Rejuvemax_Toolkit__c, Retriderm_Toolkit__c 
FROM Contact 
WHERE Contact_ID__c 
IN (SELECT ContactId FROM User WHERE username=:UserInfo.getUsername())
However this gives an error:
The left operand field in the where expression for outer query should be an id field, cannot use: 'Contact_ID__c'

Can anyone help me resolve this issue please?
 
I've tried to complete the Trailhead for Apex test classes however I've not been able to apply the knowledge to our specific scenario. For our Salesforce Community, external users will have access to some or all of our marketing toolkits. This access is dependent on whether they have a certain field checked as true in their profile (e.g. BiRetix_Toolkit__c).

Apex class to test:

public class FileRepositoryController {
    @AuraEnabled
    
       public static List<Contact> getItems() {
        List<Contact> TK = [SELECT BiRetix_Toolkit__c, AesthetiCare_Cleansers_Toolkit__c, 
                            EDS_Toolkit__c, Endocare_CELLPRO_Toolkit__c, Endocare_Concentrates_Toolkit__c,
                            Endocare_Growth_Factor_Facials__c, Endocare_Tensage_Toolkit__c, Endocare_C_Ferulic_Toolkit__c,
                            ENDYMED_Toolkit__c, G_T_Peels_Toolkit__c, Heliocare_360_Toolkit__c, NeoRettin_Toolkit__c, 
                            NeoRetin_Rejuvemax_Toolkit__c, Retriderm_Toolkit__c FROM Contact WHERE AccountId IN 
                            (SELECT AccountId FROM User WHERE username=:UserInfo.getUsername())];
        return TK;
    }
}

Would someone be able to assist in helping me write a correct test class please?
I'm trying to display 'True' if the field 'Heliocare_360_Toolkit__c' is checked, however it only shows false even when the profile has this field checked. 

<aura:component implements="forceCommunity:availableForAllPageTypes">
    <aura:attribute name="title" type="String" default="Marketing Toolkit Repository"/>
     <aura:attribute name="contact" type="Contact"/>
    <lightning:card>
        <aura:set attribute="title">
            {! v.title }
        </aura:set>
            <aura:if isTrue="{!v.contact.Heliocare_360_Toolkit__c}">
                True    
                <aura:set attribute="else">
                  False
                </aura:set>
              </aura:if>
                   
        
    </lightning:card>
</aura:component>

Can anyone see if I've made any obvious errors please?