• Andee Weir 17
  • NEWBIE
  • 45 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 15
    Replies
Thought this was going to be simple problem to solve but wasted a day on it so far & no closer.

I have one LWC component, call it lwcParent, which needs to get an item of data e.g. the current user Id from an apex call.  It then passes this to a second LWC component, call it lwcChild, for that component to act upon.  I can pass the data but I need lwcChild to be aware of the passed data in its ConnectedCallback or at least recognise that the new data has been supplied so it can do something to it.

I have a pair of dummy LWC components to demonstrate:-

lwcChild
<template>
    <lightning-input label="User Id" type="text" value={userId}></lightning-input>
</template>
 
import { LightningElement, api } from 'lwc';

export default class LwcChild extends LightningElement {
    @api userId;
    connectedCallback(){
        console.log('starting lwcChild.connectedCallback');
        console.log('lwcChild userId: ' + this.userId);
        console.log('completed lwcChild.connectedCallback');
    }
}
 
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
</LightningComponentBundle>

lwcParent
html
<template>
    <article class="slds-card">
        <div data-id="mainDiv" class="slds-card-wrapper">  
            <h1>Parent</h1>
            <c-lwc-child user-id={userId}></c-lwc-child>
        </div>
    </article>
</template>
import { LightningElement, track } from 'lwc';
import getLoggedInUserId from '@salesforce/apex/LightningCommonUtilities.getLoggedInUserId';

export default class LwcParent extends LightningElement {

    @track userId;

    connectedCallback() {
        console.log('starting lwcParent.connectedCallback');
        getLoggedInUserId()
        .then(result => {
            this.userId = result;
            console.log('lwcParent userId: ' + this.userId);
        })
        .catch(error => {
            window.console.log('error (connectedCallback.getLoggedInUserId) =====> '+JSON.stringify(error));
            if(error) {
                window.console.log('@@@@ ERROR '+ error);
            }
        })
        console.log('completed lwcParent.connectedCallback');
    }

}
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" >
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects>
                <object>Contact</object>
            </objects> 
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>
Apex code :-
public with sharing class LightningCommonUtilities{    
    @AuraEnabled(cacheable=true)
    public static string getLoggedInUserId(){
        system.debug('AAb:' + UserInfo.getUserId());
        return UserInfo.getUserId();
    }
}
If I look at the console after it runs I can see :-
lwcParent.js:1 starting lwcParent.connectedCallback
lwcParent.js:1 completed lwcParent.connectedCallback
lwcChild.js:1 starting lwcChild.connectedCallback
lwcChild.js:1 lwcChild userId: undefined
lwcChild.js:1 completed lwcChild.connectedCallback
lwcParent.js:1 lwcParent userId: 00558000001MvGNAA0
So lwcParent isn't getting the userId until after the lwcChild's connectedCallback has completed.  I've also tried this using a wire rather than calling the apex method from connectedCallback but the end result is the same.

Is there a way to either delay the instantiation of lwcChild until lwcParent has loaded the data or for lwcChild to be made aware that the data has changed so that it can call one of its functions?

As always any help appreciated.




 
Hi.

We have a requirement to replace the Activity Timeline in the Account's side panel with a custom version that better meets our needs.  However we do not want to lose the functionality of creating a new Task/Meeting/Call that the Activity Timeline gives & would rethaer not spend time creating our own versions. 

My initial thought was to create an Aura compnent that was a wrapper of those quick actions e.g. :-

cmp:-
<aura:component implements="flexipage:availableForRecordHome" description="My Lightning Component">
    <lightning:quickActionAPI aura:id="quickActionAPI" />
    <div>
        <lightning:button label="New Event" onclick="{!c.newEvent}"/>
    </div>
</aura:component>
Controller :-
({
    
    newEvent : function( cmp, event, helper ) {
        var actionAPI = cmp.find("quickActionAPI");
        var args = {actionName: "Event.New_Meeting_Retail"};
        actionAPI.selectAction(args).then(function(result){
            //Action selected; show data and set field values
        }).catch(function(e){
            if(e.errors){
                //If the specified action isn't found on the page, show an error message in the my component
                console.error(e.errors);
            }
        });
    }
})

The quick Action looks like :-
screenshot of quickaction& my user's profile has access to the record type :-
screenshot of recordtype access
The quick action itself already exists on the page layout (hence why it appears in the Activities Timeline).

I've added the component to the side panel & the button appears but when I click it, nothing happens.  In the console log I see 'The action you specified isn’t available on the current record page.'

Also tried it with a create case record but same result.  Works fine if the quick action calls a flow.

Any help gratefully received!
Hi.
Bit of a stupid question but I have 2 LWC components, andeeParent which contains the second LWC andeeChild.  The child has an input box which after the user enters a value & clicks a submit button, passes the value entered by the user to the parent for display in a separate field. This all works.  However once the parent receives the data from the child it should remove the value the user entered from the display.  I cannot do this in the child component within its handleClick as we have other uses of this child LWC which requires the value to stay.

andeeParent.html
<template>
    {parentValue}
    <c-andee-Child search-string={result} ongetsearchvalue={handleSearchValue}></c-andee-Child>    
</template>

andeeParent.js
import { LightningElement } from 'lwc';

export default class AndeeParent extends LightningElement {

    parentValue = 'origValue';
    result = "";

    handleSearchValue(event){
        this.parentValue = this.parentValue + ',' + event.detail;
        this.result = ""; // I would expect this to clear the input box on the child.
    }
}
andeeChild.html
<template>
    <lightning-input data-id="input" type="text" value={searchString}></lightning-input>
    <lightning-button label="Submit" title="Submit" onclick={handleClick}></lightning-button>
</template>

andeeChild.js
import { LightningElement, api } from  'lwc';

export default class AndeeChild extends LightningElement {

    @api searchString = '';

    handleClick(event) {
        this.searchString = this.template.querySelector('[data-id="input"]').value;
        const searchEvent = new CustomEvent("getsearchvalue", {
            detail : this.searchString
        });

        this.dispatchEvent(searchEvent);
    }
}

I would have expected the setting of this.result to "" in andeeParent.js.handleSearchValue to have removed the value that the user has entered in the child's inputbox. 

Any ideas really appreciated.

Andee
Hi,

I'm trying to display 2 columns of data in a LWC using <lightning-output-field>.  They are displaying ok (ideally I would want the labels not wrapping) but when I resize the browser window some of the columns jump too far to the right. 

Looking Ok :- Looking ok - ideally labels shouldn't be wrapping
Not so good when browser size made smaller :-
Preference Centre label aligning incorrectly
& things continue to move around if I reduce the browser size further :-
Last Client Approval moved
My html looking like :-
<template>
	<template if:true={readmode}>
		<div class="centerButtonDiv">
			<lightning-button variant="brand" label="Update Preferences" onclick={customShowModalPopup}>
			</lightning-button>
		</div>
		<lightning-record-view-form record-id={recordId} object-api-name={ObjectName}>
			
			<div class="slds-grid slds-gutters">
				<div class="slds-size_1-of-2">
					<lightning-output-field field-name="Preferences_Are_Client_Approved__c"></lightning-output-field><br/>
					<lightning-output-field field-name="Last_Client_Approval_Given_By__c"></lightning-output-field><br/>
					<lightning-output-field field-name="Preference_Centre_Visited__c"></lightning-output-field><br/>
				</div>

				<div class="slds-size_1-of-2">
					<lightning-output-field field-name="Date_of_Last_Client_Approval__c"></lightning-output-field><br/>
					<lightning-output-field field-name="HasOptedOutOfEmail"></lightning-output-field><br/>
					<lightning-output-field field-name="Do_not_email__c"></lightning-output-field><br/>
				</div>
			</div>
		</lightning-record-view-form>
	</template>
</template>
The related css file has no relevant code.

Thanks in advance for any help that can be offered. 
Hi,

We currently have a mapping of lead fields to account e.g. Street Line 1 etc.  We also have a process builder flow that kicks off a batch process if an account's address changes.  The final piece of the puzzle is a scheduled batch job that automatically converts leads into contacts if certain criteria are met. 

The problem is that when this scheduled batch job runs, the lead to contact apex code attaches an existing account to the new contact which seems to cause the account to be updated (I think this is vanilla salesforce because of the lead to account field mapping) which in turn causes the process builder flow to start (& fail) as it cannot start a batch job from a batch job.

So is it possible to recognise in the flow if the account update is due to lead conversion or alternatively if the flow is already running in a batch?  If not, is there a way to force the lead field mapping to only happen if a new account is being created & ignore updates to existing accounts.  The process builder update needs to run as a batch as it updates all of the account's contacts which could be many. 

Thanks in advance for any help you can offer.
 
Hi all,

I've read other postings about how to pass parameters from a visualforce page to a lightning component but cannot get it to work.  In my case I have created my own custom version of  a related list as a lightning component (All Financial Accounts in Third Party's Hierarchy) but want to add the functionality that if there are more than 6 items, the View All link at the bottom of the component opens up the same component in a new page with slightly different paramaters so that more columns & rows are shown (similar to normal related list functionality). 

Screenshot of custom component related list
I'm attempting to do this by navigating to a new visualforce page which uses lightning:isUrlAddressable but I get a 'Lightning out App error in callback function error' when it trys to display the lightning component.  This can be demonstrated in a cutdown version of the code :

LC1.cmp:
<aura:component implements='flexipage:availableForAllPageTypes, lightning:isUrlAddressable' access='global'> 
	<aura:attribute name="param1" type="String" default="AAA"/>    
    
    <p>{!v.param1}</p>
    <a href="javascript:void(0);" onclick="{!c.changeParam}">Change Parameter</a>    
    
</aura:component>

LC1Controller.js :
({
	changeParam : function(component, event, helper) {
		var urlEvent = $A.get("e.force:navigateToURL"); 
        urlEvent.setParams({ "url":"/apex/VfPage?param1=BBB" }); 
        urlEvent.fire();
	}
})
VfPage.vfp :
<apex:page >
    <apex:includeLightning />
    <script>
    $Lightning.use("c:LC1Container", function() {
            $Lightning.createComponent("c:LC1",
                                       {
                                           "param1" : "BBB" // Removing this still has the same error
                                       },
                                       "lightning",
                                       function(cmp) {
                                           console.log('Component created');
                                       });
        });
    </script>
    
    {!$CurrentPage.parameters.param1}
</apex:page>

LC1Container.app :
<aura:application access="GLOBAL" extends="ltng:outApp" >
    <aura:dependency resource="c:LC1"/>
</aura:application>
I then added LC1 to the top of the Account's Lightning Page | Related List tab.  The end result looks like :
Change param 1

When I click on Change Parameter I get :
Change param 2

​​​​​​​Any suggestions on how get this component to load successfully with the new value of the parameter?
​​​​​​​
Thanks for any help that can be offered.
Very new to Flow so not sure if what I'm trying to achieve is possible or not.

In essense I want a flow to call a custom Lightning Component which returns an array of contacts which the flow should store in a variable for later processing.  I've defined the LC which at the moment just returns the last 10 created contacts (the real LC will allow user input & be more complex but I've stripped it right back for the moment) :-

Apex Controller :-
public with Sharing class TestReturnContactscontroller {
	@AuraEnabled
    public static list<Contact> getContacts() 
    {
        list<contact> contacts = [select id, name from contact order by createdDate desc limit 10];
        
        return contacts;
    }
}

 LC :-
<aura:component controller="TestReturnContactscontroller" implements="force:appHostable,force:lightningQuickAction,lightning:availableForFlowScreens" access="global">
	
    <aura:attribute name="contacts" type="contact[]" description="Array of contacts returned"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
</aura:component>

LC Controller :-
({
	doInit : function(component, event, helper) {
		var action = component.get('c.getContacts');
                           
        // Define the callback
        action.setCallback(this, function(response) {
            var state = response.getState();
            
            if (component.isValid() && state === "SUCCESS")
            {
                // Callback succeeded
            	console.log('Successful response from doInit ---> ',response.getReturnValue());
                
                // Get the label of the object
                var result = response.getReturnValue();
                
                component.set('v.contacts', result);
                
            }
        });
        
        // Enqueue the action                  
        $A.enqueueAction(action); 
	}
})

LC Design :-
<design:component>
	<design:attribute name="contacts" label="contacts : return list" />
</design:component>
When I put this into a Flow I can see the console.log statement & an array of 10 contact ids/names.  However I cannot work out how to get these results into a flow variable.  In my flow I've created a Screen which contains my LC but the the field for 'contacts' in the Store Output Values only seems to want a variable for a single contact not one that I've defined as a collection.  Is what I am trying to do possible & if so, what am I doing wrong?

Thanks in advance for any help.
Hi,

I was hoping someone might be able to explain why when my debug logging level in Developer Console is set to a fairly fine setting (i.e. ApexCode :Finer, Workflow:Finer, Visualforce:Finer, DB:Info, Wave:Info, Nba:Info, the remainder set to none), a test class is consistently failing (Limit exceeded :Too many SOQL queries) but when I only have DB:Info turned on the test class works.  Surely logging levels do not affect the Salesforce limits?
Hi.

I'm trying to user Live Agent's rest API to retrieve the current session id to then subsequently retrieve if any agents are online or not.  I can call the rest API using a Chrome extension called Restlet Client & see the correct response.  However when I try to make the same call using Javascript I get 'https://xxx.salesforceliveagent.com/chat/rest/System/SessionId 400 (Bad Request)' when performing the request.send().

The javascript being used, with the appropriate URLs being anonymised, is shown below.  The restApi function gets the error but the movies function, which is basically the same but to a public rest API service which requires no request headers, doesn't.  Any suggestions would be very gratefully received. 
 
<html>
    <head>
    </head>
    <body>

        <button type="submit" onclick="javascript:restApi()">RestApi</button>
        
        <button type="submit" onclick="javascript:movies()">Movies</button>
        
    
        <script type="text/javascript">
            
            function restApi(){
                var request = new XMLHttpRequest();

                request.open('GET', 'https://xxx.salesforceliveagent.com/chat/rest/System/SessionId', true);
                request.setRequestHeader('X-LIVEAGENT-API-VERSION', '34');
                request.setRequestHeader('X-LIVEAGENT-AFFINITY', '');
                request.onload = function () {
                    var data = JSON.parse(this.response);
                    console.log(request.status);
                        if (request.status >= 200 && request.status < 400) {
                            console.log('worked');
                        } else {
                            console.log('error');
                        }
                }

                request.send();
            }
            
            function movies(){
                var request = new XMLHttpRequest();

                request.open('GET', 'https://ghibliapi.herokuapp.com/films', true);
                request.setRequestHeader('X-LIVEAGENT-API-VERSION', '34');
                request.setRequestHeader('X-LIVEAGENT-AFFINITY', '');
                request.onload = function () {
                    var data = JSON.parse(this.response);
                    console.log(request.status);
                        if (request.status >= 200 && request.status < 400) {
                            console.log('worked');
                            data.forEach(movie => {
                                console.log(movie.title);
                            });
                        } else {
                            console.log('error');
                        }
                }

                request.send();
            }

            
        </script>

    </body>
<html> 
Hi & thanks for taking the time to look at my question,

I have a requirement to only allow system admins to uncheck a checkbox on a custom lightning component.  I've included example code below that replicates some of the behaviour but jI cannot work out how to set the value of the checkbox back to true if the alert is displayed.  Hopefully it's pretty obvious what I am trying to do from the code.  Just for your information the real component has the inputcheckbox inside a <aura:iteration/> so I don't think I can use anything like Document.getElementById().

Thanks again.

Component :-

<aura:component >
    <ui:inputCheckbox aura:id="childCheckbox" value="true" change="{!c.onChangeChildCheckbox}"/>Test
</aura:component>

Controller :-
({

    onChangeChildCheckbox : function(component, event, helper) {

        // If the checkbox was unchecked by the user...
        if(!event.getSource().get('v.value')){
            var profileName = "Basic User"; // This would normally be coming from the component class

            // If the user is not a system administrator, display alert & set the checkbox back to checked 
            if (profileName != "System Administrator"){
                alert("Not Allowed!");
                // PROBLEM - How to set the checkbox value to be checked. Code below doesn't work
                var temp = event.getSource();
                temp.value = true;
            }
        }
    }
})
Thought this was going to be simple problem to solve but wasted a day on it so far & no closer.

I have one LWC component, call it lwcParent, which needs to get an item of data e.g. the current user Id from an apex call.  It then passes this to a second LWC component, call it lwcChild, for that component to act upon.  I can pass the data but I need lwcChild to be aware of the passed data in its ConnectedCallback or at least recognise that the new data has been supplied so it can do something to it.

I have a pair of dummy LWC components to demonstrate:-

lwcChild
<template>
    <lightning-input label="User Id" type="text" value={userId}></lightning-input>
</template>
 
import { LightningElement, api } from 'lwc';

export default class LwcChild extends LightningElement {
    @api userId;
    connectedCallback(){
        console.log('starting lwcChild.connectedCallback');
        console.log('lwcChild userId: ' + this.userId);
        console.log('completed lwcChild.connectedCallback');
    }
}
 
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
</LightningComponentBundle>

lwcParent
html
<template>
    <article class="slds-card">
        <div data-id="mainDiv" class="slds-card-wrapper">  
            <h1>Parent</h1>
            <c-lwc-child user-id={userId}></c-lwc-child>
        </div>
    </article>
</template>
import { LightningElement, track } from 'lwc';
import getLoggedInUserId from '@salesforce/apex/LightningCommonUtilities.getLoggedInUserId';

export default class LwcParent extends LightningElement {

    @track userId;

    connectedCallback() {
        console.log('starting lwcParent.connectedCallback');
        getLoggedInUserId()
        .then(result => {
            this.userId = result;
            console.log('lwcParent userId: ' + this.userId);
        })
        .catch(error => {
            window.console.log('error (connectedCallback.getLoggedInUserId) =====> '+JSON.stringify(error));
            if(error) {
                window.console.log('@@@@ ERROR '+ error);
            }
        })
        console.log('completed lwcParent.connectedCallback');
    }

}
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" >
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects>
                <object>Contact</object>
            </objects> 
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>
Apex code :-
public with sharing class LightningCommonUtilities{    
    @AuraEnabled(cacheable=true)
    public static string getLoggedInUserId(){
        system.debug('AAb:' + UserInfo.getUserId());
        return UserInfo.getUserId();
    }
}
If I look at the console after it runs I can see :-
lwcParent.js:1 starting lwcParent.connectedCallback
lwcParent.js:1 completed lwcParent.connectedCallback
lwcChild.js:1 starting lwcChild.connectedCallback
lwcChild.js:1 lwcChild userId: undefined
lwcChild.js:1 completed lwcChild.connectedCallback
lwcParent.js:1 lwcParent userId: 00558000001MvGNAA0
So lwcParent isn't getting the userId until after the lwcChild's connectedCallback has completed.  I've also tried this using a wire rather than calling the apex method from connectedCallback but the end result is the same.

Is there a way to either delay the instantiation of lwcChild until lwcParent has loaded the data or for lwcChild to be made aware that the data has changed so that it can call one of its functions?

As always any help appreciated.




 
Hi.
Bit of a stupid question but I have 2 LWC components, andeeParent which contains the second LWC andeeChild.  The child has an input box which after the user enters a value & clicks a submit button, passes the value entered by the user to the parent for display in a separate field. This all works.  However once the parent receives the data from the child it should remove the value the user entered from the display.  I cannot do this in the child component within its handleClick as we have other uses of this child LWC which requires the value to stay.

andeeParent.html
<template>
    {parentValue}
    <c-andee-Child search-string={result} ongetsearchvalue={handleSearchValue}></c-andee-Child>    
</template>

andeeParent.js
import { LightningElement } from 'lwc';

export default class AndeeParent extends LightningElement {

    parentValue = 'origValue';
    result = "";

    handleSearchValue(event){
        this.parentValue = this.parentValue + ',' + event.detail;
        this.result = ""; // I would expect this to clear the input box on the child.
    }
}
andeeChild.html
<template>
    <lightning-input data-id="input" type="text" value={searchString}></lightning-input>
    <lightning-button label="Submit" title="Submit" onclick={handleClick}></lightning-button>
</template>

andeeChild.js
import { LightningElement, api } from  'lwc';

export default class AndeeChild extends LightningElement {

    @api searchString = '';

    handleClick(event) {
        this.searchString = this.template.querySelector('[data-id="input"]').value;
        const searchEvent = new CustomEvent("getsearchvalue", {
            detail : this.searchString
        });

        this.dispatchEvent(searchEvent);
    }
}

I would have expected the setting of this.result to "" in andeeParent.js.handleSearchValue to have removed the value that the user has entered in the child's inputbox. 

Any ideas really appreciated.

Andee
Hi,

I'm trying to display 2 columns of data in a LWC using <lightning-output-field>.  They are displaying ok (ideally I would want the labels not wrapping) but when I resize the browser window some of the columns jump too far to the right. 

Looking Ok :- Looking ok - ideally labels shouldn't be wrapping
Not so good when browser size made smaller :-
Preference Centre label aligning incorrectly
& things continue to move around if I reduce the browser size further :-
Last Client Approval moved
My html looking like :-
<template>
	<template if:true={readmode}>
		<div class="centerButtonDiv">
			<lightning-button variant="brand" label="Update Preferences" onclick={customShowModalPopup}>
			</lightning-button>
		</div>
		<lightning-record-view-form record-id={recordId} object-api-name={ObjectName}>
			
			<div class="slds-grid slds-gutters">
				<div class="slds-size_1-of-2">
					<lightning-output-field field-name="Preferences_Are_Client_Approved__c"></lightning-output-field><br/>
					<lightning-output-field field-name="Last_Client_Approval_Given_By__c"></lightning-output-field><br/>
					<lightning-output-field field-name="Preference_Centre_Visited__c"></lightning-output-field><br/>
				</div>

				<div class="slds-size_1-of-2">
					<lightning-output-field field-name="Date_of_Last_Client_Approval__c"></lightning-output-field><br/>
					<lightning-output-field field-name="HasOptedOutOfEmail"></lightning-output-field><br/>
					<lightning-output-field field-name="Do_not_email__c"></lightning-output-field><br/>
				</div>
			</div>
		</lightning-record-view-form>
	</template>
</template>
The related css file has no relevant code.

Thanks in advance for any help that can be offered. 
Hi Team,
I need help there is one requirement on button click I need to generate ppt that is happening from vf page attribute content type but there are lot of sections and we need to decide which section should go to slide 1 of ppt which section section go to slide 2 and so on
How to do slide break.
Hello,

Q - how can we display Uploaded file names in Lightning flow on the same screen?

I am hoping someone can help.

I have created a flow on the case object in which I have used file upload component, now I want to display the file names underneath that component after the files are uploaded. (see red arrow for reference in the image attached) 
 
User-added image
Thank you in advance.

Swapnil

 
Hi all,

I've read other postings about how to pass parameters from a visualforce page to a lightning component but cannot get it to work.  In my case I have created my own custom version of  a related list as a lightning component (All Financial Accounts in Third Party's Hierarchy) but want to add the functionality that if there are more than 6 items, the View All link at the bottom of the component opens up the same component in a new page with slightly different paramaters so that more columns & rows are shown (similar to normal related list functionality). 

Screenshot of custom component related list
I'm attempting to do this by navigating to a new visualforce page which uses lightning:isUrlAddressable but I get a 'Lightning out App error in callback function error' when it trys to display the lightning component.  This can be demonstrated in a cutdown version of the code :

LC1.cmp:
<aura:component implements='flexipage:availableForAllPageTypes, lightning:isUrlAddressable' access='global'> 
	<aura:attribute name="param1" type="String" default="AAA"/>    
    
    <p>{!v.param1}</p>
    <a href="javascript:void(0);" onclick="{!c.changeParam}">Change Parameter</a>    
    
</aura:component>

LC1Controller.js :
({
	changeParam : function(component, event, helper) {
		var urlEvent = $A.get("e.force:navigateToURL"); 
        urlEvent.setParams({ "url":"/apex/VfPage?param1=BBB" }); 
        urlEvent.fire();
	}
})
VfPage.vfp :
<apex:page >
    <apex:includeLightning />
    <script>
    $Lightning.use("c:LC1Container", function() {
            $Lightning.createComponent("c:LC1",
                                       {
                                           "param1" : "BBB" // Removing this still has the same error
                                       },
                                       "lightning",
                                       function(cmp) {
                                           console.log('Component created');
                                       });
        });
    </script>
    
    {!$CurrentPage.parameters.param1}
</apex:page>

LC1Container.app :
<aura:application access="GLOBAL" extends="ltng:outApp" >
    <aura:dependency resource="c:LC1"/>
</aura:application>
I then added LC1 to the top of the Account's Lightning Page | Related List tab.  The end result looks like :
Change param 1

When I click on Change Parameter I get :
Change param 2

​​​​​​​Any suggestions on how get this component to load successfully with the new value of the parameter?
​​​​​​​
Thanks for any help that can be offered.
Very new to Flow so not sure if what I'm trying to achieve is possible or not.

In essense I want a flow to call a custom Lightning Component which returns an array of contacts which the flow should store in a variable for later processing.  I've defined the LC which at the moment just returns the last 10 created contacts (the real LC will allow user input & be more complex but I've stripped it right back for the moment) :-

Apex Controller :-
public with Sharing class TestReturnContactscontroller {
	@AuraEnabled
    public static list<Contact> getContacts() 
    {
        list<contact> contacts = [select id, name from contact order by createdDate desc limit 10];
        
        return contacts;
    }
}

 LC :-
<aura:component controller="TestReturnContactscontroller" implements="force:appHostable,force:lightningQuickAction,lightning:availableForFlowScreens" access="global">
	
    <aura:attribute name="contacts" type="contact[]" description="Array of contacts returned"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
</aura:component>

LC Controller :-
({
	doInit : function(component, event, helper) {
		var action = component.get('c.getContacts');
                           
        // Define the callback
        action.setCallback(this, function(response) {
            var state = response.getState();
            
            if (component.isValid() && state === "SUCCESS")
            {
                // Callback succeeded
            	console.log('Successful response from doInit ---> ',response.getReturnValue());
                
                // Get the label of the object
                var result = response.getReturnValue();
                
                component.set('v.contacts', result);
                
            }
        });
        
        // Enqueue the action                  
        $A.enqueueAction(action); 
	}
})

LC Design :-
<design:component>
	<design:attribute name="contacts" label="contacts : return list" />
</design:component>
When I put this into a Flow I can see the console.log statement & an array of 10 contact ids/names.  However I cannot work out how to get these results into a flow variable.  In my flow I've created a Screen which contains my LC but the the field for 'contacts' in the Store Output Values only seems to want a variable for a single contact not one that I've defined as a collection.  Is what I am trying to do possible & if so, what am I doing wrong?

Thanks in advance for any help.
Hi & thanks for taking the time to look at my question,

I have a requirement to only allow system admins to uncheck a checkbox on a custom lightning component.  I've included example code below that replicates some of the behaviour but jI cannot work out how to set the value of the checkbox back to true if the alert is displayed.  Hopefully it's pretty obvious what I am trying to do from the code.  Just for your information the real component has the inputcheckbox inside a <aura:iteration/> so I don't think I can use anything like Document.getElementById().

Thanks again.

Component :-

<aura:component >
    <ui:inputCheckbox aura:id="childCheckbox" value="true" change="{!c.onChangeChildCheckbox}"/>Test
</aura:component>

Controller :-
({

    onChangeChildCheckbox : function(component, event, helper) {

        // If the checkbox was unchecked by the user...
        if(!event.getSource().get('v.value')){
            var profileName = "Basic User"; // This would normally be coming from the component class

            // If the user is not a system administrator, display alert & set the checkbox back to checked 
            if (profileName != "System Administrator"){
                alert("Not Allowed!");
                // PROBLEM - How to set the checkbox value to be checked. Code below doesn't work
                var temp = event.getSource();
                temp.value = true;
            }
        }
    }
})
I am testing OAuth integration with my App. Everything was going fine until over the weekend I lost my refresh tokens for my test accounts.

Now I am receiving this error:
{"error":"invalid_grant","error_description":"expired authorization code"}

The redirect back returns a code. This code never changes. However, this code is deemed expired once I try to request an access token and refresh token. I imagine this is because the initial access token has expired and I need to use the refresh token to gain a new one. However, I do not have access to the original refresh tokens.

My question is, how to I reset this whole thing? I have tried the following in all possible combinations:

- In the client login, revoked oauth access to all apps
- In the client login, Reset API Key
- In the developer login, modify redirect_uri
- In the developer login, completely delete exisiting app and create a new one. The new app gives the same error.

I would just like to get both the Client Login and Developer Login App reset to square one. Then I can request my access and refresh tokens and, this time, reliably store them.
In my test class I insert new products and pricebookentries, in my test class I don't use seeAllDate=true annotation and in order to retrieve standard pricebook id I used Test.getStandardPricebookId() method, here's my code:
Product2 p1 = new Product2(Name='Product Monthly 1111', Family='Monthly', isActive=true, CurrencyIsoCode='USD');
Product2 p2 = new Product2(Name='Product Yearly 2222', Family='Yearly', isActive=true, CurrencyIsoCode='USD');

insert new List<Product2>{p1, p2};

Id pricebookId = Test.getStandardPricebookId();

PricebookEntry pbe1 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p1.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=100);
PricebookEntry pbe2 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p2.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=50);

insert pbe1;
insert pbe2;

List<PricebookEntry> pbes = [SELECT ID FROM PricebookEntry 
    WHERE Product2id IN (:p1.Id, :p2.Id) AND Pricebook2.isStandard = TRUE AND Pricebook2.isActive = TRUE AND CurrencyIsoCode = 'USD' AND isActive = TRUE];

System.assertEquals(2, pbes.size());


pbes.size() returns 0. I used the same query in console for existing data and I got results. What am I doing wrong?

Which kind of object is MyUnresolved Items?. I have a custom object called Candidates__c which has Main_Email__c as one of the fields, the problem is that when a Salesforce user(User with an account in salesforce) receives an email from a Candidate and the Salesforce user autoforwards the Email to salesforce using the Email to Salesforce generated url, the email is saved under the Unresolved Items, Is it possible to automatically assign the email to the specific custom object 'Candidates__c', lets say using a trigger which gets fired on 'after insert'. Anyone with an idea on how to go about this?!!