• fredka
  • NEWBIE
  • 270 Points
  • Member since 2008

  • Chatter
    Feed
  • 9
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 113
    Questions
  • 238
    Replies
I have taken an example to create a PDF from an LWC.  From an LWC component I am calling an Aura enabled class.  That class passes the HTML using a variable to a visualforce page that renders as a PDF.

In my own development org, I am getting the expected results.  However, when I use the exact same code in another sandbox, I am getting a null PDF.  I put a debug in the controller for the visualforce page.  The debug does not post in the code that is not working. Therefore, it seems that my pagereference is not working.

As I mentioned, the exact code is working in my development org, just not in the sandbox that I copy it to.  Any suggestions on why that woudl happen?  thanks!!!
I have been working on this for a while and keep hitting walls.  I would like to create/save/email a list on a lighting web component as a PDF.  I started by trying to use my VF page that renders as PDF but could not pass the data.  I'm told that it will not work.  I moved on to jspdf but found that I could not customize the table as much as I wanted.   The last think I tried was to use jspdf-autotable.  However, I keep getting an error " [t.autoTable is not a function] "   Does anyone have any insight or maybe even an example they could share?  thanks!!
This morning I am getting the followng warning:

[LWC warning]: Property "_def" of [object:vm undefined (0)] is set to a non-trackable object, which means changes into that object cannot be observed.

It pops up no matter where I navigate in my org.  Last night, everything was fine and I was not receiving it.  

I'm a javascript novice and I've had a difficult time understanding the issue.  Any help would be greatly apprecaited!

Thanks!

Fred
I am opening a second component and passing an attribute using the pageReference.state.  I can see the attribute is populated when I do a console.log.  However, the following lightning:datatable is not displaying any of the groupstructure attributes values.  Here is my component:
 
<aura:component implements="lightning:isUrlAddressable" access="global" >
    
    <!-- handlers-->
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>

    
	<!-- Main attribute uses to display all of the group structures as PDF -->
    <aura:attribute name="groupstructures" type="Group_Structure__c[]"/>
    <aura:attribute name="columns" type="List"/>
    
    <!--Attributes for Sorting table -->
    <aura:attribute name="sortedBy"
                type="String" />
	<aura:attribute name="sortedDirection"
                type="Boolean"
                default="true" 
                    />

    <!-- Button to print PDF -->
    <ui:button label="Print"  press="{!c.PrintTable}"/>
    <!-- the container element determine the height of the datatable -->
    
    <div style="height: 300px">
        <lightning:datatable aura:id="gstable"
                
                data="{! v.groupstructures }"
                columns="{! v.columns }"
                sortedBy="{!v.sortedBy}"
            	sortedDirection="{!v.sortedDirection}"
            	onsort="{!c.updateColumnSorting}"
            	hideCheckboxColumn="true"            />
    </div>

</aura:component>
Here is my controller:
 
({
	init: function (cmp, event, helper) {
        
        //set the groupstructures attribute that is being passed via page reference need the next two lines of code
        var pageReference = cmp.get("v.pageReference");
	    cmp.set("v.groupstructures", pageReference.state.groupstructures);

    cmp.set('v.columns', [
            {label: 'Status', fieldName: 'Status__c', type: 'text', sortable: true},
            {label: 'Funding Type', fieldName: 'Funding_Type__c', type: 'text', sortable: true},
            {label: 'Group Number', fieldName: 'Group_Number__c', type: 'text', sortable: true},
        	{label: 'Section Code', fieldName: 'Section_Code__c', type: 'text', sortable: true},
        	{label: 'Package Code', fieldName: 'Package_Code__c', type: 'text', sortable: true},
            {label: 'Effectve Date', fieldName: 'Effective_Date__c', type: 'text', sortable: true},
        	{label: 'End Date', fieldName: 'End_Date__c', type: 'text', sortable: true},
        	{label: 'Health_Product', fieldName: 'Health_Product__c', type: 'text', sortable: true},
        	{label: 'Prescription?', fieldName: 'Prescription__c', type: 'text', sortable: true},
        	{label: 'Dental?', fieldName: 'Dental__c', type: 'text', sortable: true},
        	{label: 'Vision?', fieldName: 'Vision__c', type: 'text', sortable: true},
        	{label: 'CDH Status', fieldName: 'CDH_Status__c', type: 'text', sortable: true},
        	{label: 'Coverage Categories', fieldName: 'Coverage_Categories__c', type: 'text'},
        	{label: 'Prefix', fieldName: 'Prefix__c', type: 'text', sortable: true},
        	{label: 'Description', fieldName: 'Description__c', type: 'text', sortable: true}

        ]);
		console.log("### here is the groupstructures ???" + JSON.stringify(cmp.get("v.groupstructures")));
    },
        
 updateColumnSorting: function(component, event, helper) {
    var fieldName = event.getParam('fieldName');
    var sortDirection = event.getParam('sortDirection');
     // assign the latest attribute with the sorted column fieldName and sorted direction
    component.set("v.sortedBy", event.getParam("fieldName"));
    component.set("v.sortedDirection", event.getParam("sortDirection"));
    helper.sortData(component, fieldName, sortDirection);
    },
        
    PrintTable : function(component, event, helper) {
    var url = location.origin + '/apex/GroupStructureListPrint'
        ; 
    window.open(url, '_self');
        console.log("### Im in the PrintPageAction");
	},
    
})
Any help would be greatly appreciated!!! thanks!!

Fred
 
I am trying to complete the last segment of this trail.  I'm getting the following error: Challenge Not yet complete... here's what's wrong: 
The campingList component doesn't appear to have a Quantity input field in the form using a Lightning Base component.

On my camping list component I refer to two other components.  c:campingListForm and c: campingListItem   I do have the Quanity field on each of those components.  I assume it is the campingListItem that I am having issue with but not sure why.  This code was not a problem for the all of the other segments of the trail.  Any help would be greatly appreciated.  Here is the code for my camplinglistitem component:
​<aura:component >

 <aura:attribute name="item" type="Camping_Item__c" />
  
    <p>Name:
        <ui:outputText value="{!v.item.Name}"/>
    </p>
    
    <p>Price:
        <ui:outputCurrency value="{!v.item.Price__c}"/>
    </p>
    
    <p>Quantity:
                <ui:outputNumber value="{!v.item.Quantity__c}"/>
    </p>
    
    <p>Packed:
        <ui:outputCheckbox value="{!v.item.Packed__c}"/>
    </p>
    
    <ui:button label="Packed!"
            press="{!c.packItem}"/>
    
</aura:component>
Hello sfdx gurus,
In Windows 7, I get the following error when I attampt to authorize the developer hub org. The login windows to DevHub opens up that lead to next error after I put my DevHub credential.
It works fine in Mac. 

Appreciate any input.


C:\Users\raip\sfdx\sfdx-dreamhouse>sfdx force:auth:web:login -d -a DevHub
ERROR running force:auth:web:login:  Command failed with response.
 - CylancePROTECT Script Control has blocked access to this PowerShell script.
.
Try this:
Determine why this command failed to get an encryption key for user raip: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -File C:\Users\raip\AppData\Local\sfdx\plug
ins\node_modules\salesforce-alm\CredMan.ps1 -GetCred -Target sfdx -User local].
 
Hi.. Everything that I have found on this topic has been dated.  I have two field updates and I need one to fire before the other.  I strated by trying to build a formula field butthe formula ended up too big so I moved on to workflow field updates.

I know there is the checkbox to re-evaluate the rules if a specific field update changes the field but I wnat to be sure that will work.  My seond field update uses the field in the first field update so I really need them to be ordered properly.

Thank you!!!

Fred
Hi.  I am trying to assign a queue as the case owner.. In a Case Before Trigger, I am have the following.  The case owner is getting updated if the abm__c field is populated.. however, it does not get updated with the queue if that field is null.

Account_Team__c at = aMap.get(c.AccountId);
                // Only change the owner if the Account Team has
                // an ABM and the ABM is an active user. Once assigned
                // set the flag Assigned to ABM
            if (string.isNotBlank(at.abm__c)) {
                if (at.abm__r.IsActive) {
                    c.ownerid = at.abm__c;
                    c.Assigned_To_ABM__c = true;                    
                }
             }
              else {
                c.ownerid = abmQueue[0].Id;
                }

Any help woudl be greatly appreciated!!

Fred
I have a select list where the user selects a number from 1 to 10:
<apex:outputText >New Laser Count?  </apex:outputText>
                                                    <apex:selectList label="new Count?" value="{!newLaserCount}" size="1" >
                                                    <apex:selectOptions value="{!newLaserCounts}" />
                                                    </apex:selectList>

I then want to loop through, using that number to create the same number of new records for the user to popualate.  Here is the part of the code where I am using the 'newLaserCount':

    Integer LaserCount = integer.valueOf(newLaserCount);  

         for (Integer i = 0; i < LaserCount; i++) {
            SLLNewList.add(new Laser__c());
        } 

If I hardcode the LaserCount field it gives me the correct number.. however, this does not work.  The default value of teh seleclist is 1.. it always creates one record recardless of the value populated in the selectlist.

I've done this before without issue but for some reason, this is just not getting updated.  Any help would be greatly appreciated!!!

​Fred
Problem Statement:

Create a form to enter new items and display the list of items entered. To make our camping list look more appealing, change the campingHeader component to use the SLDS. Similar to the unit, style the Camping List H1 inside the slds-page-header. Modify the campingList component to contain an input form and an iteration of campingListItem components for displaying the items entered.
  • The component requires an attribute named items with the type of an array of camping item custom objects.
  • The component requires an attribute named newItem of type Camping_Item__c with default quantity and price values of 0.
  • The component displays the Name, Quantity, Price, and Packed form fields with the appropriate input component types and values from the newItem attribute.
  • The JavaScript controller checks to ensure that the Name, Quantity and Price values submitted are not null.
  • If the form is valid, the JavaScript controller pushes the newItem onto the array of existing items, triggers the notification that the items value provider has changed, and resets the newItem value provider with a blank sObjectType of Camping_Item__c.

My Code:

CampingList.cmp

 
<aura:component >
	<ol>
        <li>Bug Spray</li>
        <li>Bear Repellant</li>
        <li>Goat Food</li>
    </ol>
 <aura:attribute name="items" type="Camping_Item__c[]"/>
 <aura:attribute name="newItem" type="Camping_Item__c"
     default="{'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Price__c': 0,
                    'Quantity__c': 0,
                    'Packed__c': false }"/>    
    <div style = "slds">
    <div class="slds-col slds-col--padded slds-p-top--large">
		<div aria-labelledby="newform">
			<fieldset class="slds-box slds-theme--default slds-container--small">
				<legend id="newform" class="slds-text-heading--small slds-p-vertical--medium">New Form</legend>
				<form class="slds-form--stacked">
					<div class="slds-form-element slds-is-required">
						<div class="slds-form-element__control">
							<ui:inputText aura:id="formname" label="Name" class="slds-input" labelClass="slds-form-element__label" value="{!v.newItem.Name}" required="true"/>
						</div>
					</div>
					<div class="slds-form-element slds-is-required">
						<div class="slds-form-element__control">
							<ui:inputCurrency aura:id="formprice" label="Price" class="slds-input" labelClass="slds-form-element__label" value="{!v.newItem.Price__c}" placeholder="0"/>
						</div>
					</div>
					<div class="slds-form-element">
						<div class="slds-form-element__control">
							<ui:inputNumber aura:id="formquantity" label="Quantity" class="slds-input" labelClass="slds-form-element__label" value="{!v.newItem.Quantity__c}" required="true" placeholder="0"/>
						</div>
					</div>
					<div class="slds-form-element">
						<ui:inputCheckbox aura:id="formpacked" label="Packed?" class="slds-checkbox" labelClass="slds-form-element__label" value="{!v.newItem.Packed__c}"/>
					</div>
					<div class="slds-form-element">
						<ui:button label="Create Form" class="slds-button slds-button--brand" press="{!c.clickCreateFormData}"/>
					</div>
				</form>
			</fieldset>
		</div>
    </div>

    <div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Camping</h3>
        </header>
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="items">
                    <c:campingListItem item="{!items}"/>
                </aura:iteration>
            </div>
        </section>
    </div>    
	</div>
</aura:component>
CampingListController.js:
 
({
    clickCreateFormData: function(component, event, helper) {

        var validitem = true;
        
        var nameField = component.find("formname");
        var expname = nameField.get("v.value");
		if ($A.util.isEmpty(expname)){
            validitem = false;
            nameField.set("v.errors", [{message:"Expense name can't be blank."}]);
        }
        else {
            nameField.set("v.errors",null);
        }
        
        var priceField = component.find("formprice");
        var expprice = nameField.get("v.value");
            if ($A.util.isEmpty(expprice)){
            validitem = false;
            priceField.set("v.errors", [{message:"Expense price can't be blank."}]);
        }
        else{
            priceField.set("v.errors",null);
        }
        
        var quantityField = component.find("formquantity");
        var expquantity = nameField.get("v.value");
        if ($A.util.isEmpty(expquantity)){
            validitem = false;
            quantityField.set("v.errors", [{message:"Expense quantity can't be blank."}]);
        }
        else{
            quantityField.set("v.errors",null);
        } 
        
      /*  if(validExpense){
            var newItem = component.get("v.newItem");
            console.log("Create item: " + JSON.stringify(newItem));
            helper.createExpense(component, newItem);
        } */
         if(validitem){
            var newItem = component.get("v.newItem");
            console.log("Create item: " + JSON.stringify(newItem));
        	var theItem = component.get("v.items");
            var newItem = JSON.parse(JSON.stringify(newItem));
            theItem.push(newItem);
            component.set("v.newItem",newItem);
        }
        component.set("v.newItem",{'sobjectType': 'Camping_Item__c',
                    'Name': '',
					'Price__c': 0,                                   
                    'Quantity__c': 0,
                    'Packed__c': false });
    }
})
CampingListItem.cmp:
 
<aura:component implements="force:appHostable">
   <aura:attribute name="item" type="Camping_Item__c"/>
     <p>The Item is: 
         <ui:outputText value="{!v.item}" />
    </p> 
    <p>Name:
        <ui:outputText value="{!v.item.Name}"/>
    </p>
    <p>Price:
    	<ui:outputCurrency value="{!v.item.Price__c}"/>
    </p>
    <p>Quantity:
		<ui:outputNumber value="{!v.item.Quantity__c}"/>
    </p>
    <p>Packed?:
    	<ui:outputCheckbox value="{!v.item.Packed__c}"/>
    </p>
    
  <!--  <p>
    	<ui:button label="Packed!" press="{!c.packItem}"/>
    </p> -->
</aura:component>

Could anyone help pass and run the challenge.

Thanks.

I am trying to use apex:actionFunction that has one parameter in my apex:page javascript but the parameter is always null and I cannot figure out WHY?

 

I created a simple test page to test what I am doing:

--------------------------------------------------------------------------

<apex:page standardController="Quote" extensions="QuoteLineItems_ControllerExtension">

<apex:pagemessages />
<apex:pageBlock mode="edit">
    <apex:form id="testPage_Form">
        <script language="JavaScript" type="text/javascript">  
            function test1() {
                alert('>> init TEST_PAGE <<');   
                updateTest('this is my test data');
            }
        </script>
        
        <apex:actionFunction name="updateTest" action="{!updateTestData}">
           <apex:param name="test_param1" value="TEST_DUMMY" />
        </apex:actionFunction>
        
        <input type='button' value='TEST 1' onclick='test1();'/>
    </apex:form>
</apex:pageBlock>
</apex:page>

 

Here is a method in my the controller:

--------------------------------------------------

    public PageReference updateTestData() {
        System.Debug('>>> updateTest <<<');
        String test_param1 = ApexPages.CurrentPage().getParameters().get('test_param1');
        System.Debug('>>> test_param1 = '+ test_param1 + ' <<<');
        return null;
    }

 

Debug Log returns:

    >>> updateTest <<<

    >>> test_param1 = null <<<         ?? WHY NULL, expecting 'this is my test data'

 

WHAT am I doing wrong?