• Rajesh Varma Mudunuri
  • NEWBIE
  • 25 Points
  • Member since 2016


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
Hi Folk
Im looking for a little help, I was just putting something together for cost saved which we record on individual contacts
List<Contact> CostSaved;
        public List<Contact> getCostSaved() {
               	CostSaved = [SELECT Account_ID__c, SUM(Savings_per_week__c)
                			 FROM Contact, Contact.Account
                			 WHERE Account.Name = 'ram test'
                			 GROUP BY Account_ID__c];
            	return CostSaved;
        }
I am getting Illegal assignment from List<AggregateResult> to List<Contact> im obviously missing something I just cant figure out what.
 
Currently we are using a custom list view Visual Force page button for mass actions to export data to excel sheet in salesforce classic.
Objects and relations:
  • Static List (Custom object with Master relationship to Static List Member )
  • Static List Member (Custom junction object to static list and static list member )
  • Contact (Standard object with Master relationship to Static List Member )
Expected behavior for the visual force page:
  • On the static List, list view select the static list and click export
  • The export in the excel file should return all the static list members for each static list.
  • -Known limitations: The number of items in a collection that can be handled by iteration components is 10,000 in read only mode.
Current Behavior: Export for each list is maxed out at 1999 rows.
I'm trying to figure out if the current behavior is a salesforce bug or Am I missing something? Any help appreciated, below is the code snippet.
<apex:page standardController="Static_List__c" recordSetVar="staticLists" contentType="application/vnd.ms-excel#Static_List_Export{!NOW()}.xls" readOnly="true">
<!-- Vf page to generate the static member list records into a single excel sheet using standard controller functionality-->
<!-- Using content type along with date time stamp to create unique name every time the excel report is created-->
<!-- Using recordsetvar to fetch all the records from the list view-->
<head>
    <style>
        #contacttable {
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        border-collapse: collapse;
        width: 100%;
        }
        #contacttable td, #contacttable th {
        border: 1px solid #ddd;
        padding: 8px;
        }
        #contacttable tr:nth-child(even){background-color: #f2f2f2;}
        #contacttable tr:hover {background-color: #ddd;}
        #contacttable th {
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: left;
        background-color: #4CAF50;
        color: white;
        }
    </style>
</head>
<table id="contacttable">
    <tr>
        <th>Static List: List Name</th>
        <th>Prefix</th>
        <th>Name</th>
        <th>Company Name</th>
        <th>Status</th>
        <th>Email opt-out</th>
        <th>Email</th>
        <th>Phone</th>
        <th>Street Address</th>
        <th>City</th>
        <th>State</th>
        <th>Country</th>
        <th>Zip</th>
    </tr>
    <!-- Iterating over the selected records on the list view -->
    <apex:repeat value="{!selected}" var="sL">
        <!-- Iterating over the child records using relationship-->
        <apex:repeat value="{!sL.Static_List_Members__r}" var="sLM">
            <tr >
                <td>   {!sLM.Static_List__r.Name}    </td>
                <td>   {!sLM.Contact_Name__r.Salutation}</td>
                <td>   {!sLM.Contact_Name__r.Name}</td>
                <td>   {!sLM.Company_Name__c}        </td>
                <td>   {!sLM.Contact_Status__c}      </td>
                <td>   {!sLM.Email_Opt_Out__c}       </td>
                <td>   {!sLM.Email__c}               </td>
                <td>   {!sLM.Contact_Name__r.Phone}</td>
                <td>   {!sLM.Contact_Name__r.MailingStreet}</td>
                <td>   {!sLM.Contact_Name__r.MailingCity}</td>
                <td>   {!sLM.Contact_Name__r.MailingState}</td>
                <td>   {!sLM.Contact_Name__r.MailingCountry}</td>
                <td>   {!sLM.Contact_Name__r.MailingPostalCode}</td>
            </tr>                        
        </apex:repeat>
    </apex:repeat>
</table>

 
I need to send data to marketing cloud from sales cloud. These are the objects involved.

 - Account (around 20k records)
 - User (around 250 records)
 - Contact (30k records)
 - Contact List (around 20 but can increase)
 - Contact List Member (25k as on now )
Note: Contact list member is junction object for contact and contact list

So this is how the solution is designed currently.

 - Created a new object **MCList**
 - Schedule an apex class to refresh and send the data periodically from **MCList** table 

Current Apex Class structure

 1. Schedule MCList (to schedule the queueable class)
 2. Queueable McList (To run the Data gen handler asynchronously)
 3. **Data Gen Handler** : In the data gen class currently **firing a future method for every contact list** to wipe out any current existing rows in the MCList table for this list and create the list with latest data.

The reason the solution was built with Queueable and Future instead of batch combination is because we want **all or nothing dml** type for each list. 

But with the current limitations with my approach are

 - I Can fire only 50 future calls
 - Only 10k row dmls for each list
Which we might be hitting at some point in the future.

Workaround: The work around i was looking is wrinting the code in java using bulk api and hosting on unix server.
What I'm looking for is, is there a way to do this without bulk api???

Any help is appreciated
Thanks
Rajesh Varma
Currently we are using a custom list view Visual Force page button for mass actions to export data to excel sheet in salesforce classic.
Objects and relations:
  • Static List (Custom object with Master relationship to Static List Member )
  • Static List Member (Custom junction object to static list and static list member )
  • Contact (Standard object with Master relationship to Static List Member )
Expected behavior for the visual force page:
  • On the static List, list view select the static list and click export
  • The export in the excel file should return all the static list members for each static list.
  • -Known limitations: The number of items in a collection that can be handled by iteration components is 10,000 in read only mode.
Current Behavior: Export for each list is maxed out at 1999 rows.
I'm trying to figure out if the current behavior is a salesforce bug or Am I missing something? Any help appreciated, below is the code snippet.
<apex:page standardController="Static_List__c" recordSetVar="staticLists" contentType="application/vnd.ms-excel#Static_List_Export{!NOW()}.xls" readOnly="true">
<!-- Vf page to generate the static member list records into a single excel sheet using standard controller functionality-->
<!-- Using content type along with date time stamp to create unique name every time the excel report is created-->
<!-- Using recordsetvar to fetch all the records from the list view-->
<head>
    <style>
        #contacttable {
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        border-collapse: collapse;
        width: 100%;
        }
        #contacttable td, #contacttable th {
        border: 1px solid #ddd;
        padding: 8px;
        }
        #contacttable tr:nth-child(even){background-color: #f2f2f2;}
        #contacttable tr:hover {background-color: #ddd;}
        #contacttable th {
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: left;
        background-color: #4CAF50;
        color: white;
        }
    </style>
</head>
<table id="contacttable">
    <tr>
        <th>Static List: List Name</th>
        <th>Prefix</th>
        <th>Name</th>
        <th>Company Name</th>
        <th>Status</th>
        <th>Email opt-out</th>
        <th>Email</th>
        <th>Phone</th>
        <th>Street Address</th>
        <th>City</th>
        <th>State</th>
        <th>Country</th>
        <th>Zip</th>
    </tr>
    <!-- Iterating over the selected records on the list view -->
    <apex:repeat value="{!selected}" var="sL">
        <!-- Iterating over the child records using relationship-->
        <apex:repeat value="{!sL.Static_List_Members__r}" var="sLM">
            <tr >
                <td>   {!sLM.Static_List__r.Name}    </td>
                <td>   {!sLM.Contact_Name__r.Salutation}</td>
                <td>   {!sLM.Contact_Name__r.Name}</td>
                <td>   {!sLM.Company_Name__c}        </td>
                <td>   {!sLM.Contact_Status__c}      </td>
                <td>   {!sLM.Email_Opt_Out__c}       </td>
                <td>   {!sLM.Email__c}               </td>
                <td>   {!sLM.Contact_Name__r.Phone}</td>
                <td>   {!sLM.Contact_Name__r.MailingStreet}</td>
                <td>   {!sLM.Contact_Name__r.MailingCity}</td>
                <td>   {!sLM.Contact_Name__r.MailingState}</td>
                <td>   {!sLM.Contact_Name__r.MailingCountry}</td>
                <td>   {!sLM.Contact_Name__r.MailingPostalCode}</td>
            </tr>                        
        </apex:repeat>
    </apex:repeat>
</table>

 
Hi Folk
Im looking for a little help, I was just putting something together for cost saved which we record on individual contacts
List<Contact> CostSaved;
        public List<Contact> getCostSaved() {
               	CostSaved = [SELECT Account_ID__c, SUM(Savings_per_week__c)
                			 FROM Contact, Contact.Account
                			 WHERE Account.Name = 'ram test'
                			 GROUP BY Account_ID__c];
            	return CostSaved;
        }
I am getting Illegal assignment from List<AggregateResult> to List<Contact> im obviously missing something I just cant figure out what.
 
How do I pass a recordId (or other saleforce page info) to an Angular2 SPA wrapped in Visual Force in Lightning with My-Domain enabled?
Hi,

I have a class that updates the PriceBookEntry of all the products in each available currency, but I have an "Apex CPU Time Limit" error when I test the code.
public class Update_Product_Price implements Schedulable {
    
    public void Update_Price()
    {
        Decimal unitPriceEuro = 0;
        list<PriceBookEntry> listProductPrice = [SELECT Product2Id, UnitPrice, CurrencyIsoCode  FROM PriceBookEntry];
        list<Currency_Rate__c> listExchangeCurrency = [SELECT CHF__c, CNY__c, CZK__c, DKK__c, GBP__c, NOK__c, PLN__c, RUB__c, SEK__c, USD__c, ZAR__c  FROM Currency_Rate__c];
        
        PriceBookEntry pbe = new PriceBookEntry();
        Map<Id, PriceBookEntry> listOfPriceBookEntry = new Map<Id, PriceBookEntry>();
        
        for (PriceBookEntry StandardPrice : listProductPrice) {   
            
            unitPriceEuro = -1;
            if(StandardPrice.CurrencyIsoCode == 'EUR')
            {
                unitPriceEuro = StandardPrice.UnitPrice;
                System.debug('Currency code : ' +  StandardPrice.CurrencyIsoCode + ' Unit price : ' + StandardPrice.UnitPrice);
                System.debug(unitPriceEuro);                      
                
                for (PriceBookEntry StandardPrice_2 : listProductPrice) {
                    if(StandardPrice_2.CurrencyIsoCode == 'CHF' && unitPriceEuro != -1 || unitPriceEuro == null)
                    {     
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].CHF__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'CNY' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].CNY__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'CZK' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].CZK__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'DKK' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].DKK__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'GBP' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].GBP__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'NOK' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].NOK__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'PLN' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].PLN__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'RUB' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].RUB__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'SEK' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].SEK__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'USD' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].USD__c;
                    }
                    if(StandardPrice_2.CurrencyIsoCode == 'ZAR' && unitPriceEuro != -1)
                    {            
                        StandardPrice_2.UnitPrice = unitPriceEuro * listExchangeCurrency[0].ZAR__c;
                    }
                    pbe = StandardPrice_2;
                    listOfPriceBookEntry.put(pbe.Id, pbe);
                }
            }        
        }
        update listOfPriceBookEntry.values();
    }
    
    public void execute (SchedulableContext sc) {
        Update_Price();
    }
    
    
}

Can someone help me on this, I totally stuck right now.
Thanks
  • April 16, 2018
  • Like
  • 0
Hi, all please help me save response in a custom object.

I have written my code and able to display record in the Visualforce page from rest API endpoint.
please help me to store data in  Custom object  test__c

Wrapper class
global class Issuerwrap {
public String issuername{get;set;}
public String issuerBankdirName{get;set;}
public String ProcessorName{get;set;}
public String SubprocessorName{get;set;}
}

Controller
public class IssuerCalloutcontroller {
public List<Issuerwrap> IssuerWrapperList{get;set;}
public List<Issuerwrap> getperformcallout(){
IssuerWrapperList= new List<Issuerwrap>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://************End-point *****************');
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
IssuerWrapperList=(List<Issuerwrap>)json.deserialize(res.getbody(),List<Issuerwrap>.class);
}
return IssuerWrapperList;
}
}

VF Page

<apex:page controller="IssuerCalloutcontroller" title="JSON table" readonly="true" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!performcallout}" var="wrap" width="100%">
<!--<apex:column headerValue="Select">
<apex:inputCheckbox value="{!wrap.isSelected}"/>
</apex:column>-->
<apex:column headerValue="Name" value="{!wrap.issuername}"/>
<apex:column headerValue="BankdirName" value="{!wrap.issuerBankdirName}"/>
<apex:column headerValue="ProcessorName" value="{!wrap.ProcessorName}"/>
<apex:column headerValue="SubprocessorName" value="{!wrap.SubprocessorName}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

it's very urgent please help me.
Thanks in advance
Hi all,

can anyone let how we can retrive more than  50000 records using salesforce.

Thanks in advance,
regards,
kiran.

Hello Community,

My requirement is to display a field Provided_Cash_Amount__c if another field Cash_Provided__c only if it is populated as  'Yes'. I believe I can do it using Rendered, which I tried but couldn't get to work. Please look at the code below:

Visualforce Page:

<apex:page standardController="Response_Action_Plan__c" extensions="RapSaver"  tabStyle="Response_Action_Plan__c">
<apex:form >
<apex:pageBlock >
<apex:sectionHeader title="New Response Action Plan" />
<apex:pageBlockSection title="Information" collapsible="False" columns="1">

<apex:inputField value="{!RAP.name}"/>
<apex:inputField value="{!RAP.Disaster__c}"/>
<apex:inputField value="{!RAP.Causalities_Attended__c}"/> 
<apex:inputField value="{!RAP.Staff_Allotted_Offshore__c}"/>
<apex:inputField value="{!RAP.Staff_Onsite__c}"/>
<apex:inputField value="{!RAP.Onsite_Staff_Count__c}"/>
<apex:inputField value="{!RAP.Blankets_Provided__c}"/>
<apex:inputField value="{!RAP.Number_of_Blankets_Provided__c}"/>
<apex:inputField value="{!RAP.Cash_Provided__c}"/> 
<apex:inputField value="{!RAP.Provided_Cash_Amount__c}" rendered="{!IF(RAP.Cash_Provided__c = 'Yes', true, false)}"/>


</apex:pageBlockSection>
<apex:pageblockbuttons location="Bottom" >
<apex:commandbutton value="Save RAP" action="{!RapSaver}"/>
</apex:pageblockbuttons>
</apex:pageBlock>
</apex:form>
</apex:page>

Extension Class:

Public class RapSaver
{
Public Response_Action_Plan__c RAP{get;set;}
Public ApexPages.StandardController Stcl{get;set;}

Public RapSaver(ApexPages.StandardController str)  
{
Stcl = str;
}

Public RapSaver()                           
{
RAP = new Response_Action_Plan__c();
}

Public PageReference RapSaver()
{
insert RAP;

PageReference pg = new PageReference ('/a07?fcf=00B7F000009BsJx');
pg.SetRedirect(true);

return pg;

}

}


 

Hi, there is a scenario in my project where I want to clone case record using cutom cloning and after the cloning record get save it will redirect me to that newly created record detail page. How can I archive that in salesforce. I tried with force:createRecord but it won't return any url so that i can nevigate to that. Please help.
Does anyone know if you can pass a list variable between components using the navigatetoComponent function? I tried passing a list of strings, but was unable to do so.
Hi all,
I am trying to create a table within a table. Each row in both tables has an add and delete button to add and remove rows. The buttons for the outer table and the button to add rows to the inner table function correctly. The problem is that I am unable to delete rows from the inner table. I basically used the same code for both the inside and outside tables so I don't understand why one works and the other does not. From what I can tell the index number (deleteButtonNumber) for the delete commandLinks is always equal to the highest index of the last group in the inner table. My code is as follows.

Visualforce Page:
<apex:page id="AddItems" showHeader="true" sidebar="true" standardController="Formulary__c" extensions="AddItemsExtension">
    <apex:messages />
    <apex:form id="form">
        <apex:pageBlock title="Add Items Page" id="block">

            <apex:pageBlockButtons>
                <!-- Continue Button -->
                <apex:commandButton value="Continue" action="{!continueButton}"/>
                <!-- Cancel Button -->
                <apex:commandButton value="Cancel" action="{!cancelButton}"/>
                <!-- Add Group Button -->
                <apex:commandButton value="Add Group" action="{!addNewGroupToList}"/>
            </apex:pageBlockButtons>


            <apex:variable value="{!0}" var="groupNumber"/>
            <apex:pageBlockSection collapsible="false" columns="1">
                <apex:pageBlockTable value="{!groupList}" var="groupRecord" columnsWidth="10%,10%,10%,70%">
                    <apex:column headerValue="Group" width="100px">
                        {!'Group ' + TEXT(groupNumber + 1) }<br/>
                    </apex:column>

                    <!-- Add Product Link -->
                    <apex:column>
                        <apex:commandLink value="Add product to group" action="{!addProductButton}">
                            <apex:param value="{!groupNumber}" assignTo="{!buttonNumber}" name="buttonNumber"/>
                        </apex:commandLink>
                    </apex:column>

                    <!-- Delete Link -->
                    <apex:column>
                        <apex:commandLink value="Delete This Group" action="{!deleteGroupButton}">
                            <apex:param value="{!groupNumber}" assignTo="{!buttonNumber}" name="buttonNumber"/>
                        </apex:commandLink>
                    </apex:column>

                    <!-- Item List -->
                    <apex:variable value="{!0}" var="productNumber"/>
                    <apex:column headerValue="Item List">
                        <apex:pageBlockTable value="{!groupRecord.prods}" var="product">
                            <apex:column>
                                <apex:commandLink value="Delete Product" action="{!deleteProductButton}">
                                    <apex:param value="{!productNumber}" assignTo="{!deleteButtonNumber}" name="deleteButtonNumber"/>
                                    <apex:param value="{!groupNumber}" assignTo="{!buttonNumber}" name="buttonNumber"/>
                                </apex:commandLink>
                            </apex:column>
                            <apex:column>
                                <apex:outputText value="{!product.Product_Name__c}"/> <br/>
                            </apex:column>
                            <apex:variable var="productNumber" value="{!productNumber + 1}"/>
                        </apex:pageBlockTable>
                    <apex:variable var="groupNumber" value="{!groupNumber + 1}"/>
                    </apex:column>

                </apex:pageBlockTable>
            </apex:pageBlockSection>

        </apex:pageBlock>
    </apex:form>
</apex:page>
Apex Extension:
public class AddItemsExtension {

    ApexPages.standardController controller = null;
    public Integer groupNumber {get; set;}
    public Integer productNumber {get; set;}
    public List<DiscountGroup> groupList {get; set;}
    public List<Formulary__c> productList {get; set;}
    public Integer buttonNumber {get; set;}
    public Integer deleteButtonNumber {get{ return deleteButtonNumber;} set {deleteButtonNumber = value; System.debug('deleteButtonNumber set to ' + deleteButtonNumber);}}
    public String searchTerm {get; set;}
    public List<Formulary__c> searchResults {get; set;}
    public String formList {get; set;}

    public AddItemsExtension(ApexPages.StandardController controller) {
        this.controller = controller;
        groupList = new List<AddItemsExtension.DiscountGroup>();
        addNewGroupToList();
    }

    // Continue Button OnClick method
    public PageReference continueButton() {
        PageReference nextPage = Page.ProductQuery;
        nextPage.setRedirect(false);

        return nextPage;
    }

    // Cancel Button OnClick method
    public PageReference cancelButton() {
        return controller.cancel();
    }

    // Back Button OnClick method
    public PageReference backButton() {
        searchTerm = '';
        PageReference lastPage = Page.AddItems;
        lastPage.setRedirect(false);
        return lastPage;
    }

    // Add Group Button OnClick method
    public void addNewGroupToList() {
        DiscountGroup newGroup = new DiscountGroup();
        newGroup.prods = new List<Formulary__c>();
        newGroup.requireAll = true;
        newGroup.quantity = 1;
        groupList.add(newGroup);
    }

    public void deleteGroupButton() {
        groupList.remove(buttonNumber);
    }

    public void deleteProductButton() {
        System.debug('buttonNumber: ' + buttonNumber +
                    '\ndeleteButtonNumber: ' + deleteButtonNumber +
                    '\ngroupNumber: ' + groupNumber);
        groupList[buttonNumber].prods.remove(deleteButtonNumber);
    }

    // Add Product Button OnClick method
    public PageReference AddProductButton() {
        searchTerm = '';
        PageReference nextPage = Page.ProductQuery;
        nextPage.setRedirect(false);
        return nextPage;
    }

    public void search() {
        searchResults = new List<Formulary__c>();
        String temp = '%' + searchTerm + '%';
        searchResults = [SELECT Id, Product_Name__c FROM Formulary__c WHERE Product_Name__c LIKE :temp AND Formulary_Status__c != 'Discontinued' ORDER BY Product_Name__c ASC];
    }

    public List<SelectOption> getformChoices() {
        List<SelectOption> options = new List<SelectOption>();
        for (Formulary__c form : searchResults) {
            options.add(new SelectOption(form.Id, form.Product_Name__c));
        }
        return options;
    }

    public PageReference addItem() {
        Formulary__c tempForm = [SELECT Id, Product_Name__c FROM Formulary__c WHERE Id = :formList];
        groupList[buttonNumber].prods.add(tempForm);
        PageReference lastPage = Page.AddItems;
        lastPage.setRedirect(false);
        return lastPage;

    }

    public class DiscountGroup {
        public List<Formulary__c> prods {get; set;}
        public boolean requireAll {get; set;}
        public Integer quantity {get; set;}
    }
}
Any help is appreciated.
I created a lightning component to override the standard "new" opportunity. The problem is that when I implement the force:hasRecordId interface, the recordId shows in my debugger as "undefined". I need to use the current id of the account or contact to pre-populate fields in my component. How can I do this?

Here is the documentation I found, which seems to explain that recordId is undefined in my situation.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_interfaces_force_hasrecordid.htm

The recordId attribute is set only when you place or invoke the component in an explicit record context. For example, when you place the component directly on a record page layout, or invoke it as an object-specific action from a record page or object home. In all other cases, such as when you invoke the component as a global action, or create the component programmatically inside another component, recordIdisn’t set, and your component shouldn’t depend on it.
These unsupported contexts include a few contexts that might seem like they should have access to the current record. Examples of these other contexts include the following:
Invoking the component from a global action (even when you’re on a record page)
Invoking the component from header or footer navigation in a community (even if the page shows a record)
force:hasRecordId and force:hasSObjectName are unsupported in these contexts. While the marker interfaces still add the relevant attribute to the component, accessing either attribute generally returns null or undefined.

Thanks for helping.