Friday, March 27, 2020

Retrieve related id / parent id in Aura component when override standard New button

Currently this is not possible , please vote the idea

Get parentId when overriding standard actions with a lightning components

This currently doable by overriding New button using  Visualforce page. So we can retrieve Parent Id or any record field in Visualforce page and pass it to the Aura component.The workaround that works is by wrapping it inside Visualforce page.

Basically it is the same for both Aura and LWC but I still put it here for my reference

Example for Aura component


<apex:page standardController="MyObject">
    <apex:includeLightning />

    <div id="lightning" />

    <script>
        $Lightning.use("c:lightApp", function() {
          $Lightning.createComponent("c:lightComp",
              { opportunityId:"{!MyObject.Opportunity__c}" },/*** here my parentId***/
              "lightning",
              function(cmp) {
                   // do some stuff
              }
          );
        });
    </script>
</apex:page>

Example for LWC

<apex:page standardController="MyObject">
    <apex:includeLightning />

    <div id="lightning" />

    <script>
        $Lightning.use("c:lightApp", function() {
          $Lightning.createComponent("c:lightLWC",
              { opportunityId:"{!MyObject.Opportunity__c}" },/*** here my parentId***/
              "lightning",
              function(cmp) {
                   // do some stuff
              }
          );
        });
    </script>
</apex:page>

Useful Link :


Hope this helps.

Monday, March 16, 2020

Custom Metadata Retrieve and Deploy

Some of error while uploading CustomMetadata record. Version 47

3.  package.xml (Sync_Mapping__mdt.Quote_Related_Framework) -- Error: An object
'Sync_Mapping__mdt.Quote_Related_Framework' of type CustomMetadata was named in
package.xml, but was not found in zipped directory
4.  package.xml (Sync_Mapping__mdt.Quote_Levy) -- Error: An object 'Sync_Mapping
__mdt.Quote_Levy' of type CustomMetadata was named in package.xml, but was not f
ound in zipped directory

Can be fixed using this :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Sync_Mapping.Bid_Related_Framework</members>
        <members>Sync_Mapping.Bid_Levy</members>
        <members>Sync_Mapping.Quote_Related_Framework</members>
        <members>Sync_Mapping.Quote_Levy</members>
        <name>CustomMetadata</name>
    </types>
 <types>
        <members>Sync_Mapping__mdt</members>
        <name>CustomObject</name>
    </types>
    <version>47.0</version>
</Package>