• Bernardo Lira 1
  • NEWBIE
  • 5 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
Hi all.

A customer is sending outbound messages when updating an account record, and wishes to send an outbound message (to a certain endpoint) with the updated related contact (to maintain consistency at the other end).

Is there any way to make this happen out-of-the-box or shoud we build a flow?

Thank you!
Best
Hi all.

I have a problem trying to pass the (Account) recordId from the Lightning page to an LWC to an Apex class.

This is a line chart I plan to show in the Account detail page, but I am unable to pass the record Id from the page to LWC to Apex class. The LWC is used in a screen flow. In the Lightning page I pass the record Id.

JS:
import {LightningElement, wire, track, api} from 'lwc';
    import { getRecord } from 'lightning/uiRecordApi';
    import getEstosDatos from '@salesforce/apex/BC_PuntajeActor3valores.getEstosDatos';
    export default class BC_PuntajeActor3valores extends LightningElement {
        @api recordId;
        @track chartConfiguration;
        @track data;
        @wire(getEstosDatos , { recordId: "$recordId"})
        WireGetEstosDatos({error, data}) {
            if (error) {
                this.error = error;
          console.log('error => ' + JSON.stringify(error));
          this.chartConfiguration = undefined;
            } else if (data) {
                    let chartData = []; 
(...)

Apex class:
 
public class BC_PuntajeActor3valores {
    @AuraEnabled(cacheable=true)
    public static List<BC_Puntaje_semanal_actor__c> getEstosDatos(String actorId){
        return BC_PuntajeActor3valores.obtenerDatosGrafico(actorId);
    }
    
    @RemoteAction
    public static List<BC_Puntaje_semanal_actor__c> obtenerDatosRemotos(String actorId){
        return BC_PuntajeActor3valores.obtenerDatosGrafico(actorId);
    }
    
    public static List<BC_Puntaje_semanal_actor__c> obtenerDatosGrafico(String actorId){
        List<BC_Puntaje_semanal_actor__c> estosDatos = new List<BC_Puntaje_semanal_actor__c>();
        idActor=id.valueof(actorId);
        estosDatos = [select id, BC_Fecha__c, BC_Puntaje__c, BC_Orden__c from BC_Puntaje_semanal_actor__c where BC_Actor__c =: idActor order by BC_Orden__c];
        system.debug(estosDatos);
        return estosDatos;
    }
}


Note that if I change the 
@wire
line to
@wire(getEstosDatos , { recordId: "001H..."}) // this is an actual account record Id.
it does the trick (so I understand all the logic works, except that I'm unable to pass the record Id from the page to the LWC to the class).

Any help would be greatly appreciated!

Thx​​​​​​​
Hi all!

I am building al screen flow-enabled LWC to show a simple line chart (the evolution of a score), but this implementation is unable to pass the data gathered to the chart presentation... (labels and data are shown as "null")...

BC_puntajeActor (the presentation) JS:

import {LightningElement, wire, track} from 'lwc';
import getEstosDatos from '@salesforce/apex/BC_puntajeActor.getEstosDatos';
export default class BC_puntajeActor extends LightningElement {
   @track chartConfiguration;
   @wire(getEstosDatos, {})
   getEstosDatos({error, data}) {
   if (error) {
      this.error = error;
      console.log('error => ' + JSON.stringify(error));
      this.chartConfiguration = undefined;
   } else if (data) {
      let chartData = [];
      let etiquetas = [];
      data.forEach(ptj => {
         chartData.push(ptj.puntaje);
         etiquetas.push(ptj.fecha);
      });

      this.chartConfiguration = {
         type: 'line',
         data: {
            labels: etiquetas,
            datasets: [
               {
                     label:'Puntaje',
                     data: chartData,
                     borderColor:'rgba(62, 159, 222, 1)',
                     borderWidth: 1,
                     fill: false,
                     pointBackgroundColor: "#FFFFFF",
                     pointBorderWidth: 4,
                     pointHoverRadius: 5,
                     pointRadius: 3,
                     bezierCurve: true,
                     pointHitRadius: 10
               }
            ]
         },
      };
      console.log('data => ', data);
      this.error = undefined;
   }
   }
}

Chart.js (the config JS):
 
import {LightningElement, api, track} from 'lwc';
import chartjs from '@salesforce/resourceUrl/BC_ChartJs';
import {loadScript} from 'lightning/platformResourceLoader';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';

export default class Chart extends LightningElement {
 @api loaderVariant = 'base';
 @api chartConfig;

 @track isChartJsInitialized;
 renderedCallback() {
  if (this.isChartJsInitialized) {
   return;
  }
  // load static resources.
  Promise.all([loadScript(this, chartjs)])
   .then(() => {
    this.isChartJsInitialized = true;
    //c/chartconst ctx = this.template.querySelector('canvas.lineChart').getContext('2d');
    const ctx = this.template.querySelector('canvas');
    this.chart = new window.Chart(ctx, JSON.parse(JSON.stringify(this.chartConfig)));
   })
   .catch(error => {
    this.dispatchEvent(
     new ShowToastEvent({
      title: 'Error loading ChartJS',
      message: error.message,
      variant: 'error',
     })
    );
   });
 }
}

Apex class:
 
public with sharing class BC_puntajeActor {
    @AuraEnabled(cacheable=true)
    public static List<Data> getEstosDatos(){
        return BC_puntajeActor.obtenerDatosGrafico();
    }
    
    @RemoteAction
    public static List<Data> obtenerDatosRemotos(){
        return BC_puntajeActor.obtenerDatosGrafico();
    }
    
    public static List<Data> obtenerDatosGrafico(){
        List<Data> estosDatos = new List<Data>();
        // the code to query data an create the data list...
        return estosDatos;
    }
    public class Data {
        public Date fecha {get;set;}
        public Double puntaje {get; set;}
        public Data(Date fecha, Double puntaje) {
            this.fecha = fecha;
            this.puntaje = puntaje;
        }
    }
}


The chart is well shown within the screen flow, but labels and values are null (when I try hardcoding the values they're shown ok).

I'm lost... any help would be greatly appreciated!

Thx​​​​​​​

 
Hi all!

I need to setup a user profile with access to all configuration settings (object manager, change sets, development, etc.) but NO access to production data (NONE).

Can this be achieved?

Thanks in advance!

We're trying to route bot conversations to skill-based queues (the key issue here is "bot"). Here's what we want to do:

The visitor enters a dialog with an Einstein bot (no request type is entered in the pre-chat form) and if they want to transfer to an (human) agent, the bot will transfer to a "general knowledge" queue that will use its own method to choose the next available agent.

But if the visitor chooses a specific option in a menu ("Sales" it is), then the bot will automatically transfer them to a "sales skilled" queue (not the "general knowledge" queue).

Here is a brief description of the flow:

Skill based routing (bot) flow
I suppose we could define a context variable (or entity?) containing the skill, and by default it is "general knowledge". Whenever the visitor requests a transfer, the bot will know which skill-bases queue will transfer.

Any time the visitor clicks the "Sales" menu option, the variable will change to "sales".

How can we achieve this?

Thanks in advance, Bernardo
Hi all.

A customer is sending outbound messages when updating an account record, and wishes to send an outbound message (to a certain endpoint) with the updated related contact (to maintain consistency at the other end).

Is there any way to make this happen out-of-the-box or shoud we build a flow?

Thank you!
Best
Hi all.

I have a problem trying to pass the (Account) recordId from the Lightning page to an LWC to an Apex class.

This is a line chart I plan to show in the Account detail page, but I am unable to pass the record Id from the page to LWC to Apex class. The LWC is used in a screen flow. In the Lightning page I pass the record Id.

JS:
import {LightningElement, wire, track, api} from 'lwc';
    import { getRecord } from 'lightning/uiRecordApi';
    import getEstosDatos from '@salesforce/apex/BC_PuntajeActor3valores.getEstosDatos';
    export default class BC_PuntajeActor3valores extends LightningElement {
        @api recordId;
        @track chartConfiguration;
        @track data;
        @wire(getEstosDatos , { recordId: "$recordId"})
        WireGetEstosDatos({error, data}) {
            if (error) {
                this.error = error;
          console.log('error => ' + JSON.stringify(error));
          this.chartConfiguration = undefined;
            } else if (data) {
                    let chartData = []; 
(...)

Apex class:
 
public class BC_PuntajeActor3valores {
    @AuraEnabled(cacheable=true)
    public static List<BC_Puntaje_semanal_actor__c> getEstosDatos(String actorId){
        return BC_PuntajeActor3valores.obtenerDatosGrafico(actorId);
    }
    
    @RemoteAction
    public static List<BC_Puntaje_semanal_actor__c> obtenerDatosRemotos(String actorId){
        return BC_PuntajeActor3valores.obtenerDatosGrafico(actorId);
    }
    
    public static List<BC_Puntaje_semanal_actor__c> obtenerDatosGrafico(String actorId){
        List<BC_Puntaje_semanal_actor__c> estosDatos = new List<BC_Puntaje_semanal_actor__c>();
        idActor=id.valueof(actorId);
        estosDatos = [select id, BC_Fecha__c, BC_Puntaje__c, BC_Orden__c from BC_Puntaje_semanal_actor__c where BC_Actor__c =: idActor order by BC_Orden__c];
        system.debug(estosDatos);
        return estosDatos;
    }
}


Note that if I change the 
@wire
line to
@wire(getEstosDatos , { recordId: "001H..."}) // this is an actual account record Id.
it does the trick (so I understand all the logic works, except that I'm unable to pass the record Id from the page to the LWC to the class).

Any help would be greatly appreciated!

Thx​​​​​​​
Hi all!

I am building al screen flow-enabled LWC to show a simple line chart (the evolution of a score), but this implementation is unable to pass the data gathered to the chart presentation... (labels and data are shown as "null")...

BC_puntajeActor (the presentation) JS:

import {LightningElement, wire, track} from 'lwc';
import getEstosDatos from '@salesforce/apex/BC_puntajeActor.getEstosDatos';
export default class BC_puntajeActor extends LightningElement {
   @track chartConfiguration;
   @wire(getEstosDatos, {})
   getEstosDatos({error, data}) {
   if (error) {
      this.error = error;
      console.log('error => ' + JSON.stringify(error));
      this.chartConfiguration = undefined;
   } else if (data) {
      let chartData = [];
      let etiquetas = [];
      data.forEach(ptj => {
         chartData.push(ptj.puntaje);
         etiquetas.push(ptj.fecha);
      });

      this.chartConfiguration = {
         type: 'line',
         data: {
            labels: etiquetas,
            datasets: [
               {
                     label:'Puntaje',
                     data: chartData,
                     borderColor:'rgba(62, 159, 222, 1)',
                     borderWidth: 1,
                     fill: false,
                     pointBackgroundColor: "#FFFFFF",
                     pointBorderWidth: 4,
                     pointHoverRadius: 5,
                     pointRadius: 3,
                     bezierCurve: true,
                     pointHitRadius: 10
               }
            ]
         },
      };
      console.log('data => ', data);
      this.error = undefined;
   }
   }
}

Chart.js (the config JS):
 
import {LightningElement, api, track} from 'lwc';
import chartjs from '@salesforce/resourceUrl/BC_ChartJs';
import {loadScript} from 'lightning/platformResourceLoader';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';

export default class Chart extends LightningElement {
 @api loaderVariant = 'base';
 @api chartConfig;

 @track isChartJsInitialized;
 renderedCallback() {
  if (this.isChartJsInitialized) {
   return;
  }
  // load static resources.
  Promise.all([loadScript(this, chartjs)])
   .then(() => {
    this.isChartJsInitialized = true;
    //c/chartconst ctx = this.template.querySelector('canvas.lineChart').getContext('2d');
    const ctx = this.template.querySelector('canvas');
    this.chart = new window.Chart(ctx, JSON.parse(JSON.stringify(this.chartConfig)));
   })
   .catch(error => {
    this.dispatchEvent(
     new ShowToastEvent({
      title: 'Error loading ChartJS',
      message: error.message,
      variant: 'error',
     })
    );
   });
 }
}

Apex class:
 
public with sharing class BC_puntajeActor {
    @AuraEnabled(cacheable=true)
    public static List<Data> getEstosDatos(){
        return BC_puntajeActor.obtenerDatosGrafico();
    }
    
    @RemoteAction
    public static List<Data> obtenerDatosRemotos(){
        return BC_puntajeActor.obtenerDatosGrafico();
    }
    
    public static List<Data> obtenerDatosGrafico(){
        List<Data> estosDatos = new List<Data>();
        // the code to query data an create the data list...
        return estosDatos;
    }
    public class Data {
        public Date fecha {get;set;}
        public Double puntaje {get; set;}
        public Data(Date fecha, Double puntaje) {
            this.fecha = fecha;
            this.puntaje = puntaje;
        }
    }
}


The chart is well shown within the screen flow, but labels and values are null (when I try hardcoding the values they're shown ok).

I'm lost... any help would be greatly appreciated!

Thx​​​​​​​

 
Hi All,
I have a trigger on attachment object to update the case owner based on the attachment type.
But the owner is being reassigned to case default owner (under Support Settings)

I have tried the dml options but it didn't work.
Any pointers/workarounds will be highly appreciated.
Many thanks in advance