• MilesS
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 3
    Replies
I'm trying to create a lwc that updates a field.  I'm able to pull the record information in, however I can either save or refresh the record.  Once the record is saved I'd like to go back to view mode.  What am I missing?  Thank you in advance!  

Component
<aura:component controller="apexCls_fiberPortalPageReferences" implements="forceCommunity:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:themeLayout,flexipage:availableForAllPageTypes,force:appHostable,force:lightningQuickAction" access="global">
    <aura:attribute name="recordId" type="string"/> 
    <aura:attribute name="su" type="Site_Survey__c"/>
    
    <aura:attribute name="updateAction" type="String" default="UNSAVED" />
    <aura:handler name="init" value="{!this}" action="{!c.doInitAction}" />
    
    <br/>Update Action: {!v.updateAction}<br/><br/>
    <aura:if isTrue="{!v.updateAction=='UNSAVED'}">
        <lightning:recordEditForm recordId="{!v.recordId}" objectApiName="Site_Survey__c">
            <lightning:messages />
            <lightning:outputField fieldName="Question__c" />
            <lightning:inputField fieldName="Completed_Detail__c" />
            <lightning:button class="button" type="submit" label="Save" onclick="{!c.save}" />
        </lightning:recordEditForm>
        <aura:set attribute="else">
            Question: {!v.su.Question__c}<br/>
            Completed Detail: {!v.su.Completed_Detail__c}<br/><br/>
            <lightning:button class="button" label="Edit" onclick="{!c.handleClick2}"/>
        </aura:set>
    </aura:if>    
</aura:component>

Controller
({
    doInitAction : function(component, event, helper) {
		var action = component.get("c.SiteSurvey_Detail");
        action.setParams({ "SiteSurveyRecordId": component.get("v.recordId") });
        action.setCallback( this, function(response) {
			var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.su", response.getReturnValue());
                console.log(response.getReturnValue());
            }
        });
        $A.enqueueAction(action);      

    },
    print : function(component, event, helper) {
        window.print();
    },

    save : function(cmp,event,helper) {
        
        cmp.find("edit").get("e.recordSave").fire();
        cmp.set("v.updateAction", "SAVED");
        
    },
    
    handleClick2 : function(cmp, event) {
        var attributeValue = cmp.get("v.updateAction");
        console.log("current text: " + attributeValue);
        
        var target = event.getSource();
        cmp.set("v.updateAction", "UNSAVED");
    }
})


 
  • March 18, 2022
  • Like
  • 0
Our Finance & Ops team wants the Sales BD to complete a form anytime they change the stage to closed.  I want a form to popup anytime a user changes the stage to closed.  What is the best way to go about doing this?

 - Trigger:  How do you redirect to a URL or VF/LWC?  Can I redirect the user to a lightning page with the specific fields?
 - Flow: This doesn't look like it has the ability to open anything from the trigger version.
 - Process Builder: It looks like only Auto Launched flows can be called

Please let me know if you have any suggestions, thank you!
  • September 30, 2021
  • Like
  • 0
How to I run a class when a communities page is opened for the active recod?  I want to replace the hard coded values with what is on the Invoice Item record that the user will be viewing.  I'm not sure where the .js goes (helper, controller, or Render).  Any suggestions/solutions are truely appreciated and thank you in advance.

I have looked at this, but it doesn't seem to be the same setup as the aura lwc. https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex_wire_method


Component
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
	<p class="h1">Invoice Detail</p>
    <table>
        <colgroup>
            <col span="1" style="width:60%"/>
            <col span="1" style="width:40%" />
        </colgroup>
        <tbody class="invGroup">
        <td>
            <table>
                <thead class="columnHeader">
                    <th><div class="slds-truncate" title="Statement Date">Statement Date</div></th>
                    <th>Status</th>
                    <th>Invoice #</th>
                </thead>
                <tbody>
                    <tr class="columndetail">
                        <td>{!v.recordId}</td>
                        <td>Open Invoice</td>
                        <td>{!v.Invoice_number__c}</td>
                    </tr>
				</tbody>
            </table>
    	</td>
        <td>
            <table>
                <thead>
                    <th class="column4" style="color:rgb(0,160,221);font-weight: bold;">Description</th>
                    <th class="column5" style="color:rgb(0,160,221);font-weight: bold;">Amount</th>
                </thead>
                <tbody class="columndetail">
                    <tr>
                        <td>Dark Fiber</td>
                        <td>$4,899.00</td>
                    </tr>
                    <tr>
                        <td>State Sales Tax</td>
                        <td>$100.00</td>
                    </tr>
                    <tr>
                        <td>City Tax</td>
                        <td>$100.00</td>
                    </tr>
                    <tr>
                        <td>Regulatory Fee</td>
                        <td>$1.00</td>
                    </tr>
                    <tr class="subTotal">
                        <td>Sub-Total</td>
                        <td>$5,100.00</td>
                    </tr>
                </tbody>
            </table>
		</td>
        </tbody>
	</table>
</aura:component>
Style (CSS)
.THIS .invGroup{
	vertical-align: top;
    border-style: solid solid solid solid;
    border-width: 1px;
}
.THIS .columnHeader{
	font-family: Century Gothic, sans-serif;
    font-size: 15px;
    text-align:left;
   	vertical-align: top;
    color:rgb(0,160,221);font-weight: bold;
}
.THIS .columndetail{
	font-family: Century Gothic, sans-serif;
    font-size: 15px;
    text-align:left;
    vertical-align: top;
    color:rgb(52,62,72);
}
.THIS .subTotal{
    font-family: Century Gothic, sans-serif;
    font-size: 15px;
    text-align:left;
    color:rgb(52,62,72);
    font-weight: bold;
    border-style: solid none none none;
    border-width: 1px;
}
.THIS .h1{
    font-family: Century Gothic, sans-serif;
    font-size: 30px;
    text-align:left;
    color:rgb(0,160,221);
    font-weight: bold;
}

APEX Class
public class apexCls_InvoiceDetails {
    @AuraEnabled(cacheable=true)
	public static List<Invoice_Item__c> InvoiceDetails(string RecordId){
    	Invoice_Item__c[] returnInvItmList = new List<Invoice_Item__c>();
    	for(Invoice_Item__c InvItem :  [SELECT Account_number__c,Account_Name__c,Billing_Street_Address__c,Billing_City_State_Zip__c,
                                               Invoice_number__c,Status__c,Statement_Date__c,Due_Date__c,
                                               Description__c,Amount__c
                                        FROM Invoice_Item__c
                                        WHERE Id=:RecordId]){                                          
			if(InvItem.status__c != 'Paid'){
            	returnInvItmList.add(InvItem);
        	}
		}
        system.debug('Final Return List: '+returnInvItmList); 
        return returnInvItmList;
    }
}


 
  • September 14, 2021
  • Like
  • 0
I'm trying to use a communities theme lightning component that I just built on trailhead on a record detail page.  However when I try to display the record detail it is smashed/smushed/pushed/forced to the left of the screen.  Will you help me add this to the lightning component so that fields will take up as much space availble?  Thank you in advance!


https://trailhead.salesforce.com/content/learn/projects/communities_theme_layout
User-added image
Component
<aura:component implements="forceCommunity:themeLayout" >
    <aura:attribute name="search" type="Aura.Component[]"/>
    <aura:attribute name="sidebarFooter" type="Aura.Component[]"/>
    <div class="slds-grid slds-grid--align-center">
        <div class="slds-col" >
            <div class="slds-border_right">
                <div class="slds-grid slds-grid--vertical">
                    <div class="slds-col">
                        <div class="logoContainer"></div>
                    </div>
                    <div class="slds-col" >
                        <c:verticalNav></c:verticalNav>
                    </div>
                    <div class="slds-col">
                        {!v.sidebarFooter}
                    </div>
                </div>
            </div>
        </div>
        <div style="width:2%;">
        </div>
        <div class="slds-col content" style="width:80%;">
            {!v.body}
        </div>
    </div>
</aura:component>

Style
.THIS .logoContainer {
background-image: t('url(' + brandLogoImage  + ')');
background-position: center;
background-repeat: no-repeat;
background-size: contain;
z-index: 99;
cursor: pointer;
position: relative;
max-width: 10000px;
max-height: 52px;
display: block;
outline: 0;
height: 50px;
margin-top: 10px;
}
.THIS .slds-col content{
    width: 100%;
}

 
I am unable to login to my sandbox so that I can authorize it for visual studio & CLI.  
 - Visual Studio: ctrl+shift+p > SFDX: Authorize an Org > Project Default > "Enter"
 - CLI: sfdx force:auth:web:login -d -a DevHub

Do I need a different type of sandbox/what am I missing?  I know my credentials work because I logged in the normal way succesfully.

User-added image
User-added image
  • March 04, 2021
  • Like
  • 0
Hey,  I am having an issue with a visualforce page.  I can't see to get the list to load.  I have checked my permissions & don't have any issues with my code.  I have also tried different variations of the list name (Rent_Schedules__r,Rent_Schedule__r,Rent_Schedules__c,Rent_Schedule__c).  I believe the correcet sintax is Rent_Schedules__r.  Do you have any idea of what could be the issue?

Error Message: 'Rent_Schedule__r' is not a valid child relationship name for entity Opportunity
<apex:page standardController="Opportunity">
    <apex:relatedList list="Rent_Schedules__r" pageSize="50" rendered="{!$ObjectType.Rent_Schedules__c.accessible}"/>
</apex:page>
User-added imageUser-added image
 
  • February 11, 2021
  • Like
  • 0
Hey,

I am trying to bulkify some code on Salesforce for the new "Content" objects.  I want to either count or add a link to the opportunity when a new document/file is inserted or deleted if the phrase “RFAssessment” is contained in the Title.  I have successfully built a trigger & class to take care of this, but the SOQL & DML statements are currently within my for loop.  My knowledge of code is a 101 class to C++, python & GTSOOI (Google the sh!t out of it).  If I should be looking at a different trigger object or if someone could show me how every content object is related (because ContentDocumentLink & ContentDocument seem to be left out of most descriptions) I will be extremely grateful!


The following bit of code produces an error...
trigger ContentDocLink_TEST on ContentDocumentLink (before insert) {
    List<ContentDocumentLink> CDL = [SELECT Id,LinkedEntityId,ContentDocumentId,
                                     	(SELECT Id,Title FROM ContentDocument)
                                     FROM ContentDocumentLink 
                                     WHERE Id IN :Trigger.newMap.keySet()];
}



!!!!!ERROR MESSAGE!!!!!
(SELECT Id,Title FROM ContentDocument)
                              ^ERROR at Row:2:Column:61
Didn't understand relationship 'ContentDocument' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."


The following code works, but at a cost of 5 SOQL quieres per file.  Not good for bulk uploading.

 
  • November 20, 2019
  • Like
  • 0
I am unable to login to my sandbox so that I can authorize it for visual studio & CLI.  
 - Visual Studio: ctrl+shift+p > SFDX: Authorize an Org > Project Default > "Enter"
 - CLI: sfdx force:auth:web:login -d -a DevHub

Do I need a different type of sandbox/what am I missing?  I know my credentials work because I logged in the normal way succesfully.

User-added image
User-added image
  • March 04, 2021
  • Like
  • 0
Hey,

I am trying to bulkify some code on Salesforce for the new "Content" objects.  I want to either count or add a link to the opportunity when a new document/file is inserted or deleted if the phrase “RFAssessment” is contained in the Title.  I have successfully built a trigger & class to take care of this, but the SOQL & DML statements are currently within my for loop.  My knowledge of code is a 101 class to C++, python & GTSOOI (Google the sh!t out of it).  If I should be looking at a different trigger object or if someone could show me how every content object is related (because ContentDocumentLink & ContentDocument seem to be left out of most descriptions) I will be extremely grateful!


The following bit of code produces an error...
trigger ContentDocLink_TEST on ContentDocumentLink (before insert) {
    List<ContentDocumentLink> CDL = [SELECT Id,LinkedEntityId,ContentDocumentId,
                                     	(SELECT Id,Title FROM ContentDocument)
                                     FROM ContentDocumentLink 
                                     WHERE Id IN :Trigger.newMap.keySet()];
}



!!!!!ERROR MESSAGE!!!!!
(SELECT Id,Title FROM ContentDocument)
                              ^ERROR at Row:2:Column:61
Didn't understand relationship 'ContentDocument' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."


The following code works, but at a cost of 5 SOQL quieres per file.  Not good for bulk uploading.

 
  • November 20, 2019
  • Like
  • 0