• Spencer Berk
  • NEWBIE
  • 50 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 13
    Replies
How do I add a test class in this Apex class to increase my code coverage? When I try and deploy this apex class, I recieve a "Code Coverage error" with only 74% coverage.
public class NapiliCommunityController2 {
    @AuraEnabled
    public static User getLoggedInUser(){
        return [SELECT Id, Contact.AccountId FROM User WHERE Id =: UserInfo.getUserId() LIMIT 1];
    }
}

 
How do I make this custom component pull fields from the Contact of the signed in community user instead of their Account?

I've tried changing some of the vairables but can't seem to get it to work, so here is the original component code.

Apex class:
public class AccountDisplayController {
	@AuraEnabled
    public static string getAccountId(){
        User currentUser = [Select id,Contact.AccountId from USER where Id =: userInfo.getUserId()];
        return string.valueOf(currentUser.Contact.AccountId);        
    }
}

cmp:
<aura:component controller="AccountDisplayController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="recordId" type="string" default = '0010r00000BtdLoAAJ'/>
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    
    	<aura:if isTrue="{! not( empty( v.recordId ) ) }">
            <div class="billingtitle"><h1>Billing Information</h1></div>
            <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="Account">
                
                <div class="slds-grid">
                    <div class="slds-col slds-size_1-of-2">
                        <lightning:outputField fieldName="Agreement_Date__c"/>
                        <lightning:outputField fieldName="Renewal_Date__c"/>
                    </div>
                    <div class="slds-col slds-size_1-of-2">
                        <lightning:outputField fieldName="Number_of_Seats_Purchased__c"/>
                        <lightning:outputField fieldName=""/>
                    </div>
                </div>
            </lightning:recordViewForm>
        </aura:if>
    
</aura:component>

Helper:
({
	getAccountId : function(component, event, helper) {
		var getAccountIdAction = component.get("c.getAccountId");
        getAccountIdAction.setCallback(this, function(response){
            if(response.getState() === 'SUCCESS'){
                component.set("v.recordId", response.getReturnValue());
            } else {
                alert('Something went wrong!!!');
            }
            
        });
        $A.enqueueAction(getAccountIdAction);
	}
})

 
I have a Visual Force page pulled into a Lightning Component. I have then placed the Lightning Component in a Screen flow. This flow works when I debug but when I place the flow on a public community page, the Screen with the Lightning Component recieves a "Content is blocked" error message. Any ideas on why this works when I debug but not on my public community page?

VF Page:
<apex:page >
    <!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->
</apex:page>

Lightning Component:
<aura:component implements="forceCommunity:availableForAllPageTypes,lightning:availableForFlowScreens" access="global">
    <iframe src="https://myfinancialcoach--community--c.visualforce.com/apex/CalendlyTEST" width="100%" height="500px;" frameBorder="0"/>
</aura:component>

 
Calendly provides code to Inline Embed their Calendly Widget directly into a website. I would like to Embed the Widget into a custom screen component I can then add to my Flow. I am not a dev so I don't know if this is even possible?

Calendly provided Inline Embed code:
<!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->

Any help/suggestions or resources on how to do this would be appreciated.
Thanks,
Spencer
 
I would like to add this Calendly Widget code to build a custom Screen Flow Component. I am not a dev and currently don't have access to one. What aura:attribute type would I use or what other suggestions/resources/examples could I use to build this component?

Widget code provided by Calendly:
<!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->

Custom Component code:
<aura:component implements="lightning:availableForFlowScreens" access="global">
    <aura:attribute name="calendly-inline-widget" type="" access="global" />
 
<!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->
    
</aura:component>

Calendly Widget looks like this:
User-added image
 
I have a Two-Column screen flow on a public community page. My first screen is acting very strange. When I have a DisplayText element placed in the second column "Test Text", I get the below invalid input error. When I remove the Display Text screen component, my flow is able to continue. Once it gets to the create record action, I get the below flow error email. It's showing that my fields are mapped incorrectly, as if I am typing in the phone number into the First Name field and email in to the phone number field.

Any ideas on what is causing this?

Input Flow Error with 2nd column DisplayText screen element:
User-added image

Flow Error: 
CREATE RECORDS: Create_Account
Create one Account record where:
AccountSource = Website
Active__c = true
BillingCity = {!City} (null)
BillingCountry = {!Country} (null)
BillingPostalCode = {!ZipCode} (null)
BillingState = {!State} (null)
BillingStreet = {!Street} (null)
Email__c = {!Email} (Bourne)
Name = {!First_Name} {!Last_Name} (555-555-5555 Jason)
OwnerId = 0051U000001PgX0
Phone = {!Phone} (jasonbournejason@gmail.com)
RecordTypeId = 0121U0000003lg4
Result
Failed to create record.

Create Record (Account) Action field mapping:
User-added image
I am recieving this flow error when trying to create a User record: 
Error Occurred: This error occurred when the flow tried to create records: INVALID_FIELD_FOR_INSERT_UPDATE: User: bad field names on insert/update call: ProfileId

I am pulling the 15 Character Profileid text from the URL while viewing the specific profile in setup.

Any suggestions on what I am doing wrong?
User-added image
User-added image
How would I split this Contacts Related List custom component list into Contacts with a specific RecordTypeId, then a white space breaker within the component, then Contacts with another specific RecordTypeId listed after the white space breaker?
*I had this component made a while back.
User-added image
<aura:component controller="DisplayAccountRelatesContactsController" implements="forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="contacts" type="List" default="[]"/>
    <aura:attribute name="contactCount" type="Integer" default="0"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    
    <aura:if isTrue="{!not(empty(v.contacts))}">
        <div class="slds-card ">
            <lightning:layout multipleRows="true">
                <lightning:layoutItem padding="around-small" size="8">
                	<lightning:icon iconName="standard:contact" alternativeText="Contact" />
                    <lightning:formattedUrl label="{!' Contacts ('+v.contactCount+')'}" value="https://myfinancialcoach.force.com/serviceportal/s/account-contacts-related-list" style="font-weight:bold;" />
                </lightning:layoutItem>
            </lightning:layout>   
            <div style="height: 200px;overflow:auto;">
                <table class="slds-table slds-table_cell-buffer slds-table_bordered">
                	<thead>
                    	<tr>
                        	<th>Contact Name</th>
                            <th>Seat Status</th>
                            <th>Email</th>
                            <th>Tracker Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <aura:iteration items="{!v.contacts}" var="contact">
                            <tr>
                                <td>
                                	<lightning:formattedUrl value="{!contact.Id}" label="{!contact.Name}" target="" />
                                </td>
                                <td>
                                    <lightning:formattedText value="{!contact.Seat_Status__c}" />
                                </td>
                                <td>
                                    <lightning:formattedText value="{!contact.Email}" />
                                </td>
                                 <td>
                                    <lightning:formattedText value="{!contact.Tracker_Status__c}" />
                                </td>
                            </tr>
                        </aura:iteration>
                    </tbody>
                </table>
            </div>
        </div>
    </aura:if>
</aura:component>

 
I am trying to create a recurring task every 3 months (90 days). I want this Task to be created 90 days from when the criteria is met (hence my Recurrence Start Date) and continue to recur 90 days after each task is completed. I would like the max future end date.

I can't seem to get it to work and am having difficultly understanding the meaning of some of the field values and the difference between repeat and recurring tasks.

Here is what I have for my Task field values:
User-added image

Any help with my field values to complete my requirements and explaining the difference between Repeat and Recurring tasks would be helpful. Thanks
The Tracker Status (Tracker_Status__c) field values are not displaying in my component. All other works display fine. The Tracker Status field value is visible for the Community Plus profiles and is visible after clicking the Contact and viewing the Contact page but won't display in my component as seen below. Any suggestions?
<aura:component controller="DisplayAccountRelatesContactsController" implements="forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="contacts" type="List" default="[]"/>
    <aura:attribute name="contactCount" type="Integer" default="0"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    
    <aura:if isTrue="{!not(empty(v.contacts))}">
        <div class="slds-card ">
            <lightning:layout multipleRows="true">
                <lightning:layoutItem padding="around-small" size="8">
                	<lightning:icon iconName="standard:contact" alternativeText="Contact" />
                    <lightning:formattedUrl label="{!' Contacts ('+v.contactCount+')'}" value="https://myfinancialcoach.force.com/serviceportal/s/account-contacts-related-list" style="font-weight:bold;" />
                </lightning:layoutItem>
            </lightning:layout>   
            <div style="height: 200px;overflow:auto;">
                <table class="slds-table slds-table_cell-buffer slds-table_bordered">
                	<thead>
                    	<tr>
                        	<th>Contact Name</th>
                            <th>Seat Status</th>
                            <th>Email</th>
                            <th>Tracker Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <aura:iteration items="{!v.contacts}" var="contact">
                            <tr>
                                <td>
                                	<lightning:formattedUrl value="{!contact.Id}" label="{!contact.Name}" target="" />
                                </td>
                                <td>
                                    <lightning:formattedText value="{!contact.Seat_Status__c}" />
                                </td>
                                <td>
                                    <lightning:formattedText value="{!contact.Email}" />
                                </td>
                                 <td>
                                    <lightning:formattedText value="{!contact.Martial_Status__c}" />
                                </td>
                            </tr>
                        </aura:iteration>
                    </tbody>
                </table>
            </div>
        </div>
    </aura:if>
</aura:component>
User-added image
 
I have the following component for my Community dispaying specific fields pulled from the user's Account object. How can I style the lightning:outputFields? I have wrapped the lightning:outputFields in a Div wrapper and tried to style that but doesn't work. Any suggestions?
<aura:component controller="AccountDisplayController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="accountId" type="string" default = '0010r00000BtdLoAAJ'/>
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    
    <aura:if isTrue="{! not( empty( v.accountId ) ) }">
        <div class="billingtitle"><h1>Billing Information</h1></div>
        <lightning:recordViewForm recordId="{!v.accountId}" objectApiName="Account">
            
            <div class="slds-grid">
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Agreement_Date__c"/>
                    <lightning:outputField fieldName="Renewal_Date__c"/>
                </div>
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Product_Service1__c"/>
                    <lightning:outputField fieldName="Number_of_Seats_Purchased__c"/>
                </div>
            </div>
        </lightning:recordViewForm>
    </aura:if>
</aura:component>

 
This component redirects a community user to the user's Account Detail page in a community. How would I change the code to redirect to a custom object (Billing__c) Detail page? I've tried changing the recordId path to LoggedInUser.Contact.AccountId.Billing__c with no luck. My path might be wrong. I am not a developer so any advice would be greatly appreciated.
({
    redirectToAccount: function(component, event, helper) {
        var loggedInUser;
        var state;
        var navEvt;
        
        var action = component.get("c.getLoggedInUser");
        action.setCallback(this, function(response) {
            state = response.getState();
            if (state === "SUCCESS") {
                loggedInUser = response.getReturnValue();
                navEvt = $A.get("e.force:navigateToSObject");
                navEvt.setParams({
                    "recordId": loggedInUser.Contact.AccountId,
                    "slideDevName": "detail"
                });
                navEvt.fire();
            }
        });
        $A.enqueueAction(action);
    }
})

 
I am trying to create a recordViewForm component in my Salesforce Community that displays specific fields (read only) from the loggedin user's Account record. I am not a developer so any help would be greatly appreciated.
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
     
    <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="Account">
        <div class="slds-grid">
            <div class="slds-col slds-size_1-of-2">
            	<lightning:outputField fields="Agreement_Date__c"/>
            </div>
            <div class="slds-col slds-size_1-of-2">
            	<lightning:outputField fields="Renewal_Date__c"/>
            </div>
        </div>
    </lightning:recordViewForm>
</aura:component>

This is the error I receive when clicking on the community page with this component, in the Community Building:
User-added image
 
How do I make this custom component pull fields from the Contact of the signed in community user instead of their Account?

I've tried changing some of the vairables but can't seem to get it to work, so here is the original component code.

Apex class:
public class AccountDisplayController {
	@AuraEnabled
    public static string getAccountId(){
        User currentUser = [Select id,Contact.AccountId from USER where Id =: userInfo.getUserId()];
        return string.valueOf(currentUser.Contact.AccountId);        
    }
}

cmp:
<aura:component controller="AccountDisplayController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="recordId" type="string" default = '0010r00000BtdLoAAJ'/>
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    
    	<aura:if isTrue="{! not( empty( v.recordId ) ) }">
            <div class="billingtitle"><h1>Billing Information</h1></div>
            <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="Account">
                
                <div class="slds-grid">
                    <div class="slds-col slds-size_1-of-2">
                        <lightning:outputField fieldName="Agreement_Date__c"/>
                        <lightning:outputField fieldName="Renewal_Date__c"/>
                    </div>
                    <div class="slds-col slds-size_1-of-2">
                        <lightning:outputField fieldName="Number_of_Seats_Purchased__c"/>
                        <lightning:outputField fieldName=""/>
                    </div>
                </div>
            </lightning:recordViewForm>
        </aura:if>
    
</aura:component>

Helper:
({
	getAccountId : function(component, event, helper) {
		var getAccountIdAction = component.get("c.getAccountId");
        getAccountIdAction.setCallback(this, function(response){
            if(response.getState() === 'SUCCESS'){
                component.set("v.recordId", response.getReturnValue());
            } else {
                alert('Something went wrong!!!');
            }
            
        });
        $A.enqueueAction(getAccountIdAction);
	}
})

 
I have a Visual Force page pulled into a Lightning Component. I have then placed the Lightning Component in a Screen flow. This flow works when I debug but when I place the flow on a public community page, the Screen with the Lightning Component recieves a "Content is blocked" error message. Any ideas on why this works when I debug but not on my public community page?

VF Page:
<apex:page >
    <!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->
</apex:page>

Lightning Component:
<aura:component implements="forceCommunity:availableForAllPageTypes,lightning:availableForFlowScreens" access="global">
    <iframe src="https://myfinancialcoach--community--c.visualforce.com/apex/CalendlyTEST" width="100%" height="500px;" frameBorder="0"/>
</aura:component>

 
Calendly provides code to Inline Embed their Calendly Widget directly into a website. I would like to Embed the Widget into a custom screen component I can then add to my Flow. I am not a dev so I don't know if this is even possible?

Calendly provided Inline Embed code:
<!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->

Any help/suggestions or resources on how to do this would be appreciated.
Thanks,
Spencer
 
I would like to add this Calendly Widget code to build a custom Screen Flow Component. I am not a dev and currently don't have access to one. What aura:attribute type would I use or what other suggestions/resources/examples could I use to build this component?

Widget code provided by Calendly:
<!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->

Custom Component code:
<aura:component implements="lightning:availableForFlowScreens" access="global">
    <aura:attribute name="calendly-inline-widget" type="" access="global" />
 
<!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-url="https://calendly.com/testfinancialplanning/my-financial-coach-consultation-meeting" style="min-width:320px;height:630px;"></div>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<!-- Calendly inline widget end -->
    
</aura:component>

Calendly Widget looks like this:
User-added image
 
I am recieving this flow error when trying to create a User record: 
Error Occurred: This error occurred when the flow tried to create records: INVALID_FIELD_FOR_INSERT_UPDATE: User: bad field names on insert/update call: ProfileId

I am pulling the 15 Character Profileid text from the URL while viewing the specific profile in setup.

Any suggestions on what I am doing wrong?
User-added image
User-added image
I have the following component for my Community dispaying specific fields pulled from the user's Account object. How can I style the lightning:outputFields? I have wrapped the lightning:outputFields in a Div wrapper and tried to style that but doesn't work. Any suggestions?
<aura:component controller="AccountDisplayController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="accountId" type="string" default = '0010r00000BtdLoAAJ'/>
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    
    <aura:if isTrue="{! not( empty( v.accountId ) ) }">
        <div class="billingtitle"><h1>Billing Information</h1></div>
        <lightning:recordViewForm recordId="{!v.accountId}" objectApiName="Account">
            
            <div class="slds-grid">
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Agreement_Date__c"/>
                    <lightning:outputField fieldName="Renewal_Date__c"/>
                </div>
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Product_Service1__c"/>
                    <lightning:outputField fieldName="Number_of_Seats_Purchased__c"/>
                </div>
            </div>
        </lightning:recordViewForm>
    </aura:if>
</aura:component>

 
This component redirects a community user to the user's Account Detail page in a community. How would I change the code to redirect to a custom object (Billing__c) Detail page? I've tried changing the recordId path to LoggedInUser.Contact.AccountId.Billing__c with no luck. My path might be wrong. I am not a developer so any advice would be greatly appreciated.
({
    redirectToAccount: function(component, event, helper) {
        var loggedInUser;
        var state;
        var navEvt;
        
        var action = component.get("c.getLoggedInUser");
        action.setCallback(this, function(response) {
            state = response.getState();
            if (state === "SUCCESS") {
                loggedInUser = response.getReturnValue();
                navEvt = $A.get("e.force:navigateToSObject");
                navEvt.setParams({
                    "recordId": loggedInUser.Contact.AccountId,
                    "slideDevName": "detail"
                });
                navEvt.fire();
            }
        });
        $A.enqueueAction(action);
    }
})