• Rima KACI
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hi,

Can anyone tell me how to expose REST webserive.
How to write classe and method which return List<Task> from salesforce 

retreiveTaskByDates(DateTime start, DateTime end)

thanks for help
I've developped a screen searchResults Lightning web component which display liste of customers.
When I selected one customer and save it in salesforce(Account). I want to display it in tab and close searchResult screen.

To display created account, I've used NavigationMixin.Navigate
To close searchResult screen I've created Aura Component which contains my LWC to be able to use WorkspaceAPI and closeTab...

But when tab screen is closed the focus is positioned on the precedent tab not on created account tab.

How to positione focus on createdAccountTab?
thx for help

Code 

ParentAuraComponent.cmp

<aura:component implements="flexipage:availableForAllPageTypes" access="global">    
   
 <lightning:workspaceAPI aura:id="workspace"/> 
<div><c:searchClientCustomerByPhoneResults oncloseclicked="{!c.handleFilterChange}"/></div>    

</aura:component>



ParentAuraComonent.js

({
    handleFilterChange: function(component, event) {
var accountToDisplay = event.getParam('accountToDisplay');
var workspaceAPI = component.find("workspace"); 

workspaceAPI.getFocusedTabInfo().then(function(response) {
  
var focusedTabId = response.tabId;    
workspaceAPI.closeTab({tabId: focusedTabId});

 }).catch(function(error) { 
    console.log(error);

}
);


searchScreen.js(LWC)

saveRow() {

    saveAccountInSF({identifiant: this.identifiant}).then(result => {
                        
            if (result.length === 1) {  
                this.accountId = result[0].Id;                                                               
                /*Appel methode pour la consulation client */                                      
                this.navigateToRecordViewPage(); 
                closeTab();    
            } 
        }).catch(error => {
            this.error = error;                
        });
}        

        
closeTab(){
        var close = true;
        var accountToDisplay = this.accountId;
        //var urlToDisplay = this.url;
        const closeclickedevt = new CustomEvent('closeclicked', {
            detail: { close, accountToDisplay},
        });

         // Fire the custom event
        this.dispatchEvent(closeclickedevt);        
   }     
        
        
        
navigateToRecordViewPage() {
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: this.accountId,
                objectApiName: 'Account',
                actionName: 'view'
            }
        });
    }

Hi,
I've created class and method which retrieves List<Account> then it call Visualforce page contains Lightning Web Component.

Is there any way to pass List<Account> from this method to my LWC

Class

public override SearchResult SearchRecords()
    List<Account> accountsCust = SearchClients.searchClientFromCustomerByPhoneMock2(callFolderId);
    if(accountsCust != null && accountsCust.size()>0){  
        result.objectType = 'Url'; 
         Set<String> setIds = new Set<String>();
         setIds.add('https://test.lightning.force.com/apex/SearchClientCustomerByPhoneResultsPage');
        .
        .            
    }
}

Page
<apex:page extensions="SearchClients">
<apex:includeLightning />
<script>
    //Tell your Visualforce page to use your Lightning app
    $Lightning.use("c:SearchClientCustomerByPhoneResultsApp", function() {

        // Write a function that creates the component on the page
        $Lightning.createComponent("c:searchClientCustomerByPhoneResults",
                                   {},
                                   "divid",
                                   function(cmp) {      
                                   })
    });
    </script>
    <body>
        <div id="divid" />
    </body>
</apex:page>


LWC.JS
@track accounts[];
 connectedCallback() {
    this.accounts;
 }
 
 thx for your help

 
Hi,
Could you confirm me please that the responses to the dml API call (Soap) is always sorted (the order of record in request and response is same)   thx
Hi,

Can anyone tell me how to expose REST webserive.
How to write classe and method which return List<Task> from salesforce 

retreiveTaskByDates(DateTime start, DateTime end)

thanks for help

Hi,
I've created class and method which retrieves List<Account> then it call Visualforce page contains Lightning Web Component.

Is there any way to pass List<Account> from this method to my LWC

Class

public override SearchResult SearchRecords()
    List<Account> accountsCust = SearchClients.searchClientFromCustomerByPhoneMock2(callFolderId);
    if(accountsCust != null && accountsCust.size()>0){  
        result.objectType = 'Url'; 
         Set<String> setIds = new Set<String>();
         setIds.add('https://test.lightning.force.com/apex/SearchClientCustomerByPhoneResultsPage');
        .
        .            
    }
}

Page
<apex:page extensions="SearchClients">
<apex:includeLightning />
<script>
    //Tell your Visualforce page to use your Lightning app
    $Lightning.use("c:SearchClientCustomerByPhoneResultsApp", function() {

        // Write a function that creates the component on the page
        $Lightning.createComponent("c:searchClientCustomerByPhoneResults",
                                   {},
                                   "divid",
                                   function(cmp) {      
                                   })
    });
    </script>
    <body>
        <div id="divid" />
    </body>
</apex:page>


LWC.JS
@track accounts[];
 connectedCallback() {
    this.accounts;
 }
 
 thx for your help