Snippets Collections
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lightningSharingWrapper">
    <apiVersion>46.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>SubmitterWrapperLWC</masterLabel>
    <description>This is a demo component.</description>

    <targets>
        <target>lightning__FlowScreen</target>  
        <target>lightning__RecordPage</target> 
    </targets>

    <targetConfigs>
        <targetConfig targets="lightning__FlowScreen" category="some random category">
            <property name="ruleName" type="String" role="inputOnly" />
            <property name="recordId" type="String" role="inputOnly" />
        </targetConfig>
        <targetConfig targets="lightning__RecordPage">     
            <objects>
                <object>Account</object> 
            </objects>
        </targetConfig>
    </targetConfigs>

</LightningComponentBundle>
@AuraEnabled()
public static Map<String, Object> test() { 
        Map<String, Object> scc = new Map<String, Object>();
        
        try {
          //CODE

            scc.put('key', value);
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        
        return scc;
    }
.slds-modal__content{
    overflow: initial;
}
import { LightningElement, wire, api } from "lwc";

//1. import the methods getRecord and getFieldValue
import { getRecord, getFieldValue } from "lightning/uiRecordApi";

//2. Import reference to the object and the fields
import NAME_FIELD from "@salesforce/schema/Account.Name";
import RATING_FIELD from "@salesforce/schema/Account.Rating";
import INDUSTRY_FIELD from "@salesforce/schema/Account.Industry";

const fields = [NAME_FIELD, RATING_FIELD, INDUSTRY_FIELD];
export default class ExploreGetRecord extends LightningElement {
  @api
  recordId;

  //3. Wire the output of the out of the box method getRecord to the property account
  @wire(getRecord, {
    recordId: "$recordId",
    fields
  })
  account;

  renderedCallback() {
    console.log(this.account.data);
  }
  
  //4. Fetch the field values from the record
  get name() {
    return getFieldValue(this.account.data, NAME_FIELD);
  }

  get rating() {
    return getFieldValue(this.account.data, RATING_FIELD);
  }

  get industry() {
    return getFieldValue(this.account.data, INDUSTRY_FIELD);
  }
}

showNotification(title, msg, variant) {
  const evt = new ShowToastEvent({
    title: title,
    message: msg,
    variant: variant
  })
  this.dispatchEvent(evt);
}

//to use it, call the method passing parameters like "this.showNotification('Title', 'Message', 'success')""
var faturasFechadas = [
    { 
        "valorFatura": {
            "valor": -1665.46, 
            "moeda": "R$" 
            
        },
        "dataFechamento": "2025-03-26T00:00:00", 
    },
    { 
        "valorFatura": {
            "valor": -1665.46, 
            "moeda": "R$" 
            
        }, 
        "dataFechamento": "2025-03-26T00:00:00"
    }
];
    
var detalhesFatura = {
    "numeroCartao": "xxxxxxxxxxxx1193",
    "detalhesLancamentoParcela": {
        "quantidadeParcelas": 12,
        "numeroParcelaTransacao": 7
        
    },
    "dataVencimentoFatura": "2025-03-01T00:00:00"
}

var result = faturasFechadas.map(function(el) {
    var o = Object.assign({}, el);
    o.detalhesFatura = detalhesFatura;
    return o;
});

console.log(JSON.stringify(result));
@wire(callout2Apex,{id: this.recordId})
faturaAbertaWired({ error, data }) {
  if (data) {
    this.arr = JSON.parse(data).keyFromJSON;
    this.loaded = true;
  } else if (error) {
    this.loaded = false;
  };
}
star

Sat Oct 29 2022 13:00:00 GMT+0000 (UTC) https://unofficialsf.com/adding-lightning-web-components-to-flow-screens/

#lwc #flow
star

Tue Oct 11 2022 23:42:04 GMT+0000 (UTC)

#javascript #lwc #css
star

Fri Jul 01 2022 15:12:47 GMT+0000 (UTC) https://blog.salesforcecasts.com/how-to-use-getrecord-in-lwc/

#javascript #lwc
star

Fri Jul 01 2022 14:41:53 GMT+0000 (UTC)

#javascript #lwc

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension