• GauravGarg
  • PRO
  • 3140 Points
  • Member since 2015
  • Salesforce Consultant
  • Shopee Pvt Ltd. Singapore


  • Chatter
    Feed
  • 100
    Best Answers
  • 0
    Likes Received
  • 5
    Likes Given
  • 10
    Questions
  • 1035
    Replies
I am VERY new to LWC development and having issue opening a previously created LWC from my Org using Visual Studio Code.   I do not have this code yet in any folder on my system just want to connect to the org and pull down the code for pre-existing LWCs.
I did install Salesforce in Visual Studio Code but not sure how to use it once it's installed

Any tips are appreciated.  
Most of my old experience was with Apex/VF and Eclipse IDE.
  • January 29, 2020
  • Like
  • 0
HI,
I want to create a lightning component where i need to pass the current account Id to the component and display all the quotes that are related to the account id.
 

I'm trying to embed a Visualforce Page onto my home page that allows users to select a report and filter it right there. 

When running I seem to be getting the following error:
caused by: System.NullPointerException: Attempt to de-reference a null object

Class.AnalyticsController.getSelectedFilters: line 69, column 1
Class.AnalyticsController.getChartFilter: line 64, column 1


Can anyone identify what's causing this issue? I notice this code was written for API Ver 29, while I'm on 48. 

Visualforce Page: 

<apex:page controller="AnalyticsController">
<style>
label {
    font-weight: bold;
}
#filters {
    overflow: hidden;
    width: 100%
}
#filterBox {
    float: left;
    align: center;
    padding: 5px 5px 5px 0px;
}
</style>
<apex:form >
    <apex:outputLabel value="Select Report"/> 
    <apex:selectList value="{!reportId}" multiselect="false" size="1">
        <apex:selectOptions value="{!availableReports}"/>
    </apex:selectList>
    <apex:commandButton action="{!getReportInfo}" value="Get Report Filters" reRender="report"/><br/>

    <apex:outputPanel id="report" layout="block">
        <apex:outputPanel rendered="{!reportId != null}">
            <div id="filters">
                <apex:repeat value="{!availableColumnFilters}" var="colFilter">
                    <div id="filterBox">
                        <apex:outputLabel >{!colFilter.label}</apex:outputLabel><br/>
                        <apex:selectList value="{!colFilter.operator}" size="1" multiselect="false" style="width: 100px;">
                            <apex:selectOption itemLabel="--None--" itemValue=""/>
                            <apex:selectOptions value="{!availableDataTypeFilterOperators[colFilter.dataType]}"/>
                        </apex:selectList>
                        <apex:inputText value="{!colFilter.value}"/>
                    </div>   
                </apex:repeat>
            </div>

            <apex:commandButton value="Get Chart with Filters" reRender="chart"/><br/>

            <apex:outputPanel layout="block" id="chart">
                <analytics:reportChart reportId="{!reportId}" filter="{!chartFilter}"/>
            </apex:outputPanel>
        </apex:outputPanel>
    </apex:outputPanel>
</apex:form>
</apex:page>

Controller:
 
public with sharing class AnalyticsController{
 
    public List<SelectOption> availableReports { get; set; }
    public Id reportId { get; set; }
    public Map<String, List<SelectOption>> availableDataTypeFilterOperators { get; set; }
    public List<ColumnFilter> availableColumnFilters { get; set; }
 
    public AnalyticsController() {
        availableReports = retrieveAvailableReports();
        availableDataTypeFilterOperators = retrieveAvailableDataTypeFilterOperators();
    }
 
    public List<SelectOption> retrieveAvailableReports() {
        List<SelectOption> reptOpts = new List<SelectOption>();
        for (Report r : [
             Select Id, Name
             From Report
             Where Format In ('Summary','Matrix')
             Order By Name
        ]) {
            reptOpts.add(new SelectOption(r.Id, r.Name));
        }
        return reptOpts;
    }
 
    public Map<String, List<SelectOption>> retrieveAvailableDataTypeFilterOperators() {
        Map<String, List<SelectOption>> dataTypeFilterOpts = new Map<String, List<SelectOption>>();
        Map<String, List<Reports.FilterOperator>> filterOperatorMap = Reports.ReportManager.getDataTypeFilterOperatorMap();
 
        for (String dataType : filterOperatorMap.keySet()) {
            List<SelectOption> operators = new List<SelectOption>();
 
            // Append _DATA to match ColumnDataType from ReportTypeColumn
            dataTypeFilterOpts.put(dataType.toUpperCase() + '_DATA', operators);
 
            for (Reports.FilterOperator fo : filterOperatorMap.get(dataType)) {
                operators.add(new SelectOption(fo.getName(), fo.getLabel()));
            }
        }        
        return dataTypeFilterOpts;
    }
 
    public PageReference getReportInfo() {
        Reports.ReportDescribeResult descRes = Reports.ReportManager.describeReport(reportId);
 
        availableColumnFilters = new List<ColumnFilter>();
 
        for (Reports.ReportTypeColumnCategory category : descRes.getReportTypeMetadata().getCategories()) {
            for (Reports.ReportTypeColumn col : category.getColumns().values()) {
                if (col.getFilterable()) {
                    ColumnFilter cf = new ColumnFilter(
                        col.getLabel(),
                        col.getName(),
                        col.getDataType().name()
                    );
                    availableColumnFilters.add(cf);
                }
            }
        }
        return null;
    }
 
    public String getChartFilter() {
        return JSON.serialize(getSelectedFilters());
    }
 
    private List<ColumnFilter> getSelectedFilters() {
        List<ColumnFilter> selectedFilters = new List<ColumnFilter>();
        for (ColumnFilter cf : availableColumnFilters) {
            if (String.isNotBlank(cf.operator)) {
                selectedFilters.add(cf);
            }
        }
        return selectedFilters;
    }
 
    public class ColumnFilter {
        public ColumnFilter(String lab, String col, String dt) {
            label = lab;
            column = col;
            dataType = dt;
        }
 
        // Values needed for apex:analytics component
        public String column { get; set; }
        public String operator { get; set; }
        public String value { get; set; }
 
        // Values need for display and operator select list
        public String label { get; set; }
        public String dataType { get; set; }
 
    }
}

Thanks for the help!! 
Hello, 



Recently I've been tasked with sending a questionnaire to customers related to specific orders with an e-mail with a questionnaire, when the user replies the InboundEmail class needs to save the information sended back (Evaluation from 0 to 10), plus any comentaries.

Is there a way to achieve this natively or trough Apex?

I've searched the boards but wasn't able to find any solution related to my problem, in any case if it's a duplicate topic sorry in advance!

Thank you!
Hello All,

I've got an interesting use case here.  I've got an approval process built out on Opportunities.  One of the managers wants an email anytime something is approved or rejected but only if the Oppty was created by one of the people on her team.  Otherwise she doesn't want an email at all.  

Any ideas on how to do this?  In the approval process itself, I don't see a way to send an email alert based on a criteria.   I know that I could create some formula field like a checkbox to return 'true' if the record was created by someone on her team, but I don't see a way to fire of an Approval Action based off a criteria. 

So maybe a trigger then on approval?  If so, what object would by trigger be on?  

Thanks in advance everyone!
George


 
how to iterate over map of Map<ID,List<String>>in apex
  • October 02, 2018
  • Like
  • 0
So if the output is blank or a default value I would like it to highlight, is this possible, if so how?
User-added image
visualforce page:
<apex:form >    
         <apex:pageBlock title="Your Carts:"> 
            
            <apex:pageblockTable value="{!MapProducts}" var="a"> 
                <apex:column >
                    <apex:image width="100" height="100" value="{!URLFOR($Resource.ProductImage, 'ProductImage/' & MapProducts[a]['ImageName__c'])}"></apex:image>
                </apex:column>
                
                <apex:column headerValue="Name" value="{!MapProducts[a]['Name']}"/> 
                <apex:column headerValue="Price" value="{!MapProducts[a]['Price__c']}"/> 
                <apex:column headerValue="Amount" > 
                    <apex:inputText style="text-align:right;width:100px;" value="{!MapProducts[a]['Amount']}"/>
                </apex:column>
                <apex:column headerValue="Money" value="{!MapProducts[a]['Total']}"/> 
                <apex:column >
                    <apex:commandLink action="{!deleteItem}" reRender="MapProducts" ><apex:param assignTo="{!iKey}" value="{!a}" name="assignvalue" /> Remove Row</apex:commandLink>
                </apex:column>
            </apex:pageblockTable>   
          <apex:pageBlock title="Total Money:"> 
             <apex:outputText >{!iTotalMoney}</apex:outputText> 
          </apex:pageBlock>
        </apex:pageBlock> 
   </apex:form>

apex function:
public void deleteItem()
  {
      System.Debug('deleteItem') ;
      iTotalMoney=0;      
      System.Debug(iKey) ;
      MapProducts.remove(iKey);
      for (Integer key : MapProducts.keySet()) {     
        iTotalMoney +=Double.valueOf(MapProducts.get(key).get('Total'));
      }
  }

Log debug output
43.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;NBA,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WAVE,INFO;WORKFLOW,INFO
03:14:43.0 (94306)|USER_INFO|[EXTERNAL]|0057F000002yTNz|daitb@vnitsolutions.com|Pacific Standard Time|GMT-07:00
03:14:43.0 (138242)|EXECUTION_STARTED
03:14:43.0 (143358)|CODE_UNIT_STARTED|[EXTERNAL]|0667F000009PMhv|VF: /apex/carts
03:14:43.0 (360015)|VF_DESERIALIZE_VIEWSTATE_BEGIN|0667F000009PMhv
03:14:43.0 (7435075)|VF_DESERIALIZE_VIEWSTATE_END
03:14:43.0 (9840462)|SYSTEM_MODE_ENTER|true
03:14:43.0 (14743313)|SYSTEM_MODE_ENTER|true
03:14:43.0 (15488240)|VF_SERIALIZE_VIEWSTATE_BEGIN|0667F000009PMhv
03:14:43.0 (17250235)|VF_SERIALIZE_VIEWSTATE_END
03:14:43.20 (20160362)|CUMULATIVE_LIMIT_USAGE
03:14:43.20 (20160362)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

03:14:43.20 (20160362)|CUMULATIVE_LIMIT_USAGE_END

03:14:43.0 (20198901)|CODE_UNIT_FINISHED|VF: /apex/carts
03:14:43.0 (21042239)|EXECUTION_FINISHED
log not exist text: deleteItem
Why delete row action not call apex function?

Hi,

How to get the record type name in before insert.

Requiremnet is need to check in if condition for record type name 
Ex : if(record type name= 'A' ) 

We have a custom EmailService for inbound messages written in apex, which is processing Inbound email messages and then showing them in a lightning component.
The type od the received email object is EmailMessage. On the production org, when the system administrator is logged in, he sees all the needed incoming emails (the component is showing them as it should be, querying also works). It all worked well in our sandbox though.
The problem is when the user is logged in. The component does not show any emails and they are not visible also by querying. The problem is I suppose with some permissions, but the EmailMessage object in our org is not customizable when it comes to permissions (everything is set to default and is not changeable). The user has a company community licence. Any help or suggestion would be greatly appreciated.
HI All,

can anyone provide me a solution on how to update the ownerId field in the ContentDocument object. i have tried doing this with a trigger on ContentDocument object but it does not seems to work
Hi,

I have this trigger that I would like to convert to an apex class and I would like to add some code to the class.  The trigger changes contacts to the account owner id when the account owner is changed.  What I would like to add is something that also changes the contact owner when a contact is created or added to the account.

Here is the trigger I have.

trigger AlignContactownertoAccountOwner on Account (after insert,after update) {
      Set<Id> accountIds = new Set<Id>();
      Map<Id, String> oldOwnerIds = new Map<Id, String>();
      Map<Id, String> newOwnerIds = new Map<Id, String>();
      List<Contact> contactUpdates = new List<Contact>();
      for (Account a : Trigger.new)
      {
         if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId)
         {
            oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId);
            newOwnerIds.put(a.Id, a.OwnerId);
            accountIds.add(a.Id);

         }

      }

        if (!accountIds.isEmpty()) {

         for (Account acc : [SELECT Id, (SELECT Id, OwnerId FROM Contacts) FROM Account WHERE Id in :accountIds])

            {

            String newOwnerId = newOwnerIds.get(acc.Id);
            String oldOwnerId = oldOwnerIds.get(acc.Id);

            for (Contact c : acc.Contacts)

            {

               if (c.OwnerId == oldOwnerId)
               {

               Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId);

               contactUpdates.add(updatedContact);

               }

            }

             

            }

       }
            update contactUpdates;

}

Any help would be great.

Thanks,

Michael 
Hello Devs, I have the following Trigger and Class that was working fine until this morning when I received the following error of Too Many future calls: 51. 

Any idea how to alleviate gettign this error?  Here is my trigger and class code....thank you all for any help you can provide....

Trigger:
 
trigger DeleteExtraBookingsTrigger on Opportunity (after insert) {

    For(Opportunity opps : Trigger.new){
        If(opps.Auto_Bookings__c == True){
            
            
        DeleteExtraBookingsClass.deleteRecords(Trigger.newMap.keySet());    
            
        }
    }
    
    
}

Class code:
 
public class DeleteExtraBookingsClass {

    @future
    public static void deleteRecords(Set<ID> oppIdsToDelete){
        List<Opportunity> opp = [SELECT ID, Armor_Product_Category__c From Opportunity WHERE ID IN : oppIdsToDelete AND Auto_Bookings__c = True
                                AND (Armor_Product_Category__c = null or Armor_Product_Category__c = 'Armor | null')];
        
        If(opp.size()>0){
        delete opp;
        database.emptyRecycleBin(opp);
        }
    }
    
}

Hello everyone.
I have a requirement to store information from different Contacts in Google Drive. My problem is that I would like to create a directory dynamically for each new contact and I have not found much information on how to do it from apex. Has anyone had success performing this functionality?

Greetings thank you!
Hi,

The below trigger was fired after updating the field twice, but it was not fired before update.
 
trigger age on Account (before update) {

  Map<Id,Account> ageMap = new Map<Id,Account>(); 
  Account[] acct = [SELECT Id,Age__c FROM Account WHERE Id IN : Trigger.newMap.keySet()];
    
     for(Account a : trigger.new){
           

            if(a.age__c != null){
             
                ageMap.get(a.Id);
                a.Is_Age_Updated__c = true;
               
            }
            else{
                
             ageMap.get(a.Id);
             a.Is_Age_Updated__c = false;
            }                  
    }

}


 
  • February 02, 2018
  • Like
  • 0
Hi All,
          I have two objects called product and product details. Product field is lookup on product details.
          In product details object, if I have a product detail record pd1 with product p1, I shouldn't be able to create or update 
          another product detail pd2 with product p1.
         
           How can I achieve this?
Hi,

    I have written a trigger .I want this trigger to be executed when clicked on a custom button in a VF page. Can anyone help me out with this?
Thanks.
What happens to the secondary master detail relationship if the primary master detail relationship is changed to lookup?
Hello,
I'm new to triggers and struggling with this. I need a trigger that pulls the Opportunity name and creates a new record in my custom object, AE Opp. I do not need it to create a lookup or link it to the opp, i just need it to create a whole new record so that I can create a task on it.. Is this feasible?
Hi all,

I'm new to Salesforce and would like to ask for more information about different salesforce editions and versions. Our team wants to use an organization, with Force.com account to be used as PaaS for custom application development. This means without the standard CRM features, which Salesforce.com provides like Campaigns, Leads, Opportunities, or Cases. But to get access to the “Core” functionality of Accounts and Contacts, Reports, Dashboards, Documents, and Activities and Custom Objects.  I know the Salesforce platform (https://www.salesforce.com/products/platform/lightning/?d=70130000000f27V&internal=true) can be used for this case. I have a free trial to test it out but still, it provides me features for Salesforce standard license, not for Salesforce platform license. Would please tell me which edition and licenses are best to be used when I want to use Force.com as a platform.
Hi All, 

I have a requirement to send out 50000 email to a un-verified email address every day, but due to 5000 email limit, we cannot. 

Do you have any solution which can be implemented?

Background: 
We are using a custom VF page to filter out records which need to send an email. 

An ideal solution would be a button over the VF page which can send email just like Salesforce button using some tool. 


Thanks in Advance. 
I am working on lightning flow for a month. My flow, there are about 5 screens and on every screen has 1 or 2 pick-list / radio buttons which are marked as mandatory.
The problem I am facing here is, the customer selects the choice values and navigates forward (next) but in-case if he returns back to the screen, the selected value is reset to default i.e. the choice has been reset.

 Can you please provide an optimal solution out-of-the-box to fix this issue. Thanks
Can we convert List<account> to Map<String, String> i.e. Map<FieldLabel, FieldValue> pair. 


Thanks in advance. 
I am able to upload documents in Lightning Flow using Standard lightnign component "forceContent:fileUpload" and attached related record to "current user id". 

My Requirement is to display the "files name" of uploaded document. I have attribute "Uploaded file names" and store into a collection variable, but when I choose this option, my flow screen is showing blank. 

I want to display all the file name that are uploaded. 

Any idea?

Thanks in advance. 
 
Hi All,

I am new to lightning. My requirement is to load external Minify javascript file which will run a demo or walkthru over the object records, Dashboard to enlight customer to use Lightning. 

Currently, the same has been working in salesforce classic, but in lightning it is not allowed and throwing error. 

Do anyone facing the same issue? 
My client require to have two way integration between Salesforce - Siebel. 

Is there any third party (app exchange) tool. 
Or we should go with customized code. 

Please suggest. 
I want to create Opportunity Share records for two custom fields "Manager" and "Senior Manager"  lookup to User on Opportunity object. 

My Batch job is working as expected and creating those record perfectly. 

But, the issue is in Test Class:
  • I have created one createOpportunity() method, and create two Opportunities. 
  • Both the opportunities have Manager / Senior Manager field populated with User. 
  • Now, when I run this method, It will cover my Batch job and create sharing records ( that I can debug in batch job).
  • If I am trying to query those sharing record in Test Class using below query, it is giving 0 records. 
  • SELECT Id, manager__c, senior_manager__c, rowcause from Opportunity. 
Any ideas please. 
We have some VF page, that we visible as Public Site on my client website. The VF page are working fine but due to salesforce Standard Javascripts. The website perform is quite down. 

Can you please provide me some idea to avoid running these standard Javascript libraries. 

 
Hi All,

I have completed my Lightning Superbadge two months ago and since then it is showing in active module. Please help me out how can I fix this. I already had contacted with salesforce trailhead but they are providing no help. 

Thanks,
Gaurav
Hi All,

Today I have completed my Lightning super badge module, still it is showing under Active module.

User-added image

Please suggest how can I fix this. 

Thanks,
Gaurav
I need to restrict editation of a record this way:

Only owner or users above hierarchy can edit the record.

I know that validation rule can obtain NOT(user.id = owner.id), which makes sure that only the owner can edit the record, but how about the users above hierarchy?

I have OWD on public/read, that's. Can't use private OWDs.

Recently (Since Oct 2019) we have had a problem where pdf attachments show the "binary" data instead of the actual PDF. If we use the "Open in PDF Viewer" Chrome extension it opens fine, but directly from Salesforce, it does not.  I have scoured the web this evening and cannot find anything to help.  Ideas?

Using Salesforce Classic.

hi, i have the follwing class and a VF page that will show the results if records are found. If there are no records for any query, then i see an error:

List has no rows for assignment to SObject
An unexpected error has occurred. Your development organization has been notified.

How can i modify the code to display a message in VF when there are no records returned? this will need to be for each query. Any help is appreciated! thanks!

CLASS:
public class extendAccountsChannel2 { 
    public Investor_Channel__c channels{get; set;} 
    public Investor_Channel__c channelsWholesale{get; set;} 
    public Investor_Channel__c channelsMiniCorrespondent{get; set;} 
    public Investor_Channel__c channelsCorrespondentAOTDirectTrade{get; set;} 
    public Investor_Channel__c channelsCorrespondentBestEfforts{get; set;} 
    public Investor_Channel__c channelsCorrespondentMandatoryBulkFlow{get; set;}
    public Investor_Channel__c channelsCorrespondentNonDelegated{get; set;} 
    public Investor_Channel__c channelsCorrespondentNonDelMandatory{get; set;}   
    
    public Account accounts {get;set;} 
    
    public Account acc {get;set;}
    
    public extendAccountsChannel2(ApexPages.StandardController controller) {
        Id id = ApexPages.currentPage().getParameters().get('id');
        if(ApexPages.currentPage().getParameters().get('id') != null){
            
           id accRecId = [select id from Account where id = :id].id;
            if(accRecId != null){
                channels = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Retail'];
                channelsWholesale = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Wholesale'];  
                channelsMiniCorrespondent = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Mini Correspondent']; 
                channelsCorrespondentAOTDirectTrade = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Correspondent AOT / Direct Trade']; 
                channelsCorrespondentBestEfforts = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Correspondent Best Efforts']; 
                channelsCorrespondentMandatoryBulkFlow = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Correspondent Mandatory (Bulk/Flow)']; 
                channelsCorrespondentNonDelegated = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Correspondent Non Delegated'];
                channelsCorrespondentNonDelMandatory = [SELECT Id,name from Investor_Channel__c WHERE Account_Name__r.id= :accRecId AND Channel__c = 'Correspondent Non-Del Mandatory'];
                
                 
            }
        }
        
        
        
    }
    
}




VF:
 
<apex:page standardController="Account" extensions="extendAccountsChannel2"> <style> .activeTab {background-color: #003366; color:white; background-image:none;} .inactiveTab { background-color: lightgrey; color:black; background-image:none;} input.btn[name="del"] { display: none; } input.btn[name="clone"] { display: none; } input.btn[name="edit"] { display: none; } </style> 

<apex:tabPanel switchType="ajax" id="theTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" > <apex:tab label="Correspondent AOT / Direct Trade" name="name4" id="tabFour" style="background-color: white;" > <apex:detail subject="{!channelsCorrespondentAOTDirectTrade}" relatedList="false" /> </apex:tab> <apex:tab label="Correspondent Best Efforts" name="name5" id="tabFive" style="background-color: white;" > <apex:detail subject="{!channelsCorrespondentBestEfforts}" relatedList="false" /> </apex:tab> <apex:tab label="Correspondent Mandatory (Bulk/Flow)" name="name6" id="tabSix" style="background-color: white;" > <apex:detail subject="{!channelsCorrespondentMandatoryBulkFlow}" relatedList="false" /> </apex:tab> <apex:tab label="Correspondent Non Delegated" name="name7" id="tabSeven" style="background-color: white;" > <apex:detail subject="{!channelsCorrespondentNonDelegated}" relatedList="false" /> </apex:tab> <apex:tab label="Correspondent Non-Del Mandatory" name="name8" id="tabEight" style="background-color: white;" > <apex:detail subject="{!channelsCorrespondentNonDelMandatory}" relatedList="false" /> </apex:tab> <apex:tab label="Mini Correspondent" name="name3" id="tabThree" style="background-color: white;" > <apex:detail subject="{!channelsMiniCorrespondent}" relatedList="false" /> </apex:tab> <apex:tab label="Retail" name="name1" id="tabOne" style="background-color: white;" > <apex:detail subject="{!channels}" relatedList="false" /> </apex:tab> <apex:tab label="Wholesale" name="name2" id="tabTwo" style="background-color: white;" > <apex:detail subject="{!channelsWholesale}" relatedList="false" /> </apex:tab> </apex:tabPanel> <br/> </apex:page>

 
  • January 29, 2020
  • Like
  • 0

While making an authenticated GET call to the REST Query API, I am receiving the following:

[
  {
    "message": "\nSELECT+name+from+Account\n     ^\nERROR at Row:1:Column:6\nunexpected token: '+'",
    "errorCode": "MALFORMED_QUERY"
  }
]

https://{customerName}.my.salesforce.com/services/data/v44.0/query/?q=SELECT+name+from+Account

It's worth noting that the above url is sourced directly from the REST API Developer Guide and that when I execute an authenticated GET request against the REST Describe API endpoint, the description comes back correctly (https://{customerName}.my.salesforce.com/services/data/v33.0/sobjects/Account/describe)

It seems as if this is the only customer that we are experiencing this with.

I'd love any assistance or direction to seek more information.

Thanks in advance!

HI,
I want to create a lightning component where i need to pass the current account Id to the component and display all the quotes that are related to the account id.
 
My organization requires a specific (and short) timeout for a particular case record type.  Only a subset of our users need access to these records so I have created dedicated profiles for the users who view this data.  

Now I need to prevent users who don't have this profile from being able to access the records.  I've done what I can with OWDs, profiles, sharing button (removed the button from the page layout for this record type), but now I'm trying to figure out how I can block access via the case team.

I have a case open with salesforce and the support rep recommended creating a VFpage for the record type.  I don't code so I'm trying to figure out what all of the options are before we try to bring on outside resources.  A validation rule isn't possible.  I could remove the case team related list from the page layout but I feel like someone might want to add a team member some day.  I did see the trailhead for 'with sharing' here (https://trailhead.salesforce.com/en/content/learn/modules/data-leak-prevention/identify-and-prevent-sharing-violations).  I don't really understand it but am trying to at least understand if it might be a possible solution.  Also I have had to create a trigger in the past to block users from deleting opportunity products.  I'm wondering if I could do the same for this.  Create a trigger that will block sharing for this record type with all users who don't have a particular word in their profile name.  

I'm really bummed that this is so complicated :/

Thanks in advance for your help!

 

I'm trying to embed a Visualforce Page onto my home page that allows users to select a report and filter it right there. 

When running I seem to be getting the following error:
caused by: System.NullPointerException: Attempt to de-reference a null object

Class.AnalyticsController.getSelectedFilters: line 69, column 1
Class.AnalyticsController.getChartFilter: line 64, column 1


Can anyone identify what's causing this issue? I notice this code was written for API Ver 29, while I'm on 48. 

Visualforce Page: 

<apex:page controller="AnalyticsController">
<style>
label {
    font-weight: bold;
}
#filters {
    overflow: hidden;
    width: 100%
}
#filterBox {
    float: left;
    align: center;
    padding: 5px 5px 5px 0px;
}
</style>
<apex:form >
    <apex:outputLabel value="Select Report"/> 
    <apex:selectList value="{!reportId}" multiselect="false" size="1">
        <apex:selectOptions value="{!availableReports}"/>
    </apex:selectList>
    <apex:commandButton action="{!getReportInfo}" value="Get Report Filters" reRender="report"/><br/>

    <apex:outputPanel id="report" layout="block">
        <apex:outputPanel rendered="{!reportId != null}">
            <div id="filters">
                <apex:repeat value="{!availableColumnFilters}" var="colFilter">
                    <div id="filterBox">
                        <apex:outputLabel >{!colFilter.label}</apex:outputLabel><br/>
                        <apex:selectList value="{!colFilter.operator}" size="1" multiselect="false" style="width: 100px;">
                            <apex:selectOption itemLabel="--None--" itemValue=""/>
                            <apex:selectOptions value="{!availableDataTypeFilterOperators[colFilter.dataType]}"/>
                        </apex:selectList>
                        <apex:inputText value="{!colFilter.value}"/>
                    </div>   
                </apex:repeat>
            </div>

            <apex:commandButton value="Get Chart with Filters" reRender="chart"/><br/>

            <apex:outputPanel layout="block" id="chart">
                <analytics:reportChart reportId="{!reportId}" filter="{!chartFilter}"/>
            </apex:outputPanel>
        </apex:outputPanel>
    </apex:outputPanel>
</apex:form>
</apex:page>

Controller:
 
public with sharing class AnalyticsController{
 
    public List<SelectOption> availableReports { get; set; }
    public Id reportId { get; set; }
    public Map<String, List<SelectOption>> availableDataTypeFilterOperators { get; set; }
    public List<ColumnFilter> availableColumnFilters { get; set; }
 
    public AnalyticsController() {
        availableReports = retrieveAvailableReports();
        availableDataTypeFilterOperators = retrieveAvailableDataTypeFilterOperators();
    }
 
    public List<SelectOption> retrieveAvailableReports() {
        List<SelectOption> reptOpts = new List<SelectOption>();
        for (Report r : [
             Select Id, Name
             From Report
             Where Format In ('Summary','Matrix')
             Order By Name
        ]) {
            reptOpts.add(new SelectOption(r.Id, r.Name));
        }
        return reptOpts;
    }
 
    public Map<String, List<SelectOption>> retrieveAvailableDataTypeFilterOperators() {
        Map<String, List<SelectOption>> dataTypeFilterOpts = new Map<String, List<SelectOption>>();
        Map<String, List<Reports.FilterOperator>> filterOperatorMap = Reports.ReportManager.getDataTypeFilterOperatorMap();
 
        for (String dataType : filterOperatorMap.keySet()) {
            List<SelectOption> operators = new List<SelectOption>();
 
            // Append _DATA to match ColumnDataType from ReportTypeColumn
            dataTypeFilterOpts.put(dataType.toUpperCase() + '_DATA', operators);
 
            for (Reports.FilterOperator fo : filterOperatorMap.get(dataType)) {
                operators.add(new SelectOption(fo.getName(), fo.getLabel()));
            }
        }        
        return dataTypeFilterOpts;
    }
 
    public PageReference getReportInfo() {
        Reports.ReportDescribeResult descRes = Reports.ReportManager.describeReport(reportId);
 
        availableColumnFilters = new List<ColumnFilter>();
 
        for (Reports.ReportTypeColumnCategory category : descRes.getReportTypeMetadata().getCategories()) {
            for (Reports.ReportTypeColumn col : category.getColumns().values()) {
                if (col.getFilterable()) {
                    ColumnFilter cf = new ColumnFilter(
                        col.getLabel(),
                        col.getName(),
                        col.getDataType().name()
                    );
                    availableColumnFilters.add(cf);
                }
            }
        }
        return null;
    }
 
    public String getChartFilter() {
        return JSON.serialize(getSelectedFilters());
    }
 
    private List<ColumnFilter> getSelectedFilters() {
        List<ColumnFilter> selectedFilters = new List<ColumnFilter>();
        for (ColumnFilter cf : availableColumnFilters) {
            if (String.isNotBlank(cf.operator)) {
                selectedFilters.add(cf);
            }
        }
        return selectedFilters;
    }
 
    public class ColumnFilter {
        public ColumnFilter(String lab, String col, String dt) {
            label = lab;
            column = col;
            dataType = dt;
        }
 
        // Values needed for apex:analytics component
        public String column { get; set; }
        public String operator { get; set; }
        public String value { get; set; }
 
        // Values need for display and operator select list
        public String label { get; set; }
        public String dataType { get; set; }
 
    }
}

Thanks for the help!! 
I have created a lightning component that executes a screen flow which is running on "New".
How can I customize the layout of the lightning component?
For example, i want to have 2 columns and set specific fields insise these columns.
Hello All,

I've got an interesting use case here.  I've got an approval process built out on Opportunities.  One of the managers wants an email anytime something is approved or rejected but only if the Oppty was created by one of the people on her team.  Otherwise she doesn't want an email at all.  

Any ideas on how to do this?  In the approval process itself, I don't see a way to send an email alert based on a criteria.   I know that I could create some formula field like a checkbox to return 'true' if the record was created by someone on her team, but I don't see a way to fire of an Approval Action based off a criteria. 

So maybe a trigger then on approval?  If so, what object would by trigger be on?  

Thanks in advance everyone!
George


 
Hi All, 

I have a requirement to send out 50000 email to a un-verified email address every day, but due to 5000 email limit, we cannot. 

Do you have any solution which can be implemented?

Background: 
We are using a custom VF page to filter out records which need to send an email. 

An ideal solution would be a button over the VF page which can send email just like Salesforce button using some tool. 


Thanks in Advance. 
Has any one heard of Marketing Cloud Lite?
 

Hey Guys,

i am looking for a "best practice" solution, to create a conditionally url button. The button should be placed on the standard page layout.
Related to a value of the object, the button button should redirect the user to a page.

For example, if the status is x, redirect to a new task.
if the status is y, redirect to the homepage.
if the status is z, redirect to an external page.

Unfortunately, a javascript button is not a soultion for lightning.

I have created a controller and a methode to create a conditionally PageReference for each case. I dont think that this solution is best practice. Moreover, i used simply urls like
1new PageReference('https://...............+lead.id');
what is definitely not best practise.  So my button opens the page which is fireing the action methode automatically.

Conclusion, i am looking for : 
- a solution for lightning and classic
- a button placed on the standard page layout
- the button should redirect to different pages related to a value of the object
- a more best practice solution than mine 

I appreciate your help ! 

Cheers, 
Marry
I was planning to bring in data from an external database and found that it will cost us 13+GB of storage. The data has more than 7 million records across 4 tables, so at 2kb per record, the total cost would be 7000000*2/(1024*1024) = 13.4 GB. We would like to search and report on the data and add associated contacts and accounts to campaigns. What are our options?  
Hello Everyone, Hope all are doing good i have some information for you all go through it and give me a reply for that!

Amazon EC2 (AWS Certified)is an Infrastructure as a Service which offers pay-by-hour servers (EC2), storage (S3) etc. You bring your own software to the table – OS (Red Hat, Windows, whatever), Database (MySQL, Oracle, DB2, whatever), Search (your pick), Business Intelligence (Cognos, Oracle BI, whatever) – and then you piece it together and get it all to work. The benefits are that you can do whatever you want – and the con is you have to manage complexity yourself.

Force.com, by contrast, is a Platform as a Service that provides a pre-integrated offering that already has a database, search, BI Reports, identity/security etc. all built in – that you program using a Java-like language (Apex). With the newly announced VMforce, a VMware and Salesforce.com offering, you will be able to use Java soon. Force.com automatically backs up your data, manages upgrades (your apps don’t need to know if Force.com is running on database version 11i or 11g, Dell boxes or Sun boxes, Linux or Windows etc.)

Regards
Sarahjohn
{!REQUIRESCRIPT("/xdomain/xdomain.js")}
{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/39.0/apex.js")}
{!REQUIRESCRIPT("/support/console/39.0/integration.js")}

var Program='{!Program_Member_MVN__c.Program_Name__c}';
var Pname=sforce.connection.query("Select Program__c from Program_Names__c");
var rec16 = Pname.getArray('records');
var status='{!Program_Member_MVN__c.Status_MVN__c}';
var PmId='{!JSENCODE(Program_Member_MVN__c.Id)}'; 
var PName='{!Program_Member_MVN__c.Program_Name__c}'; 
var url;
if (sforce.console.isInConsole()) {
if(Program == rec16){
alert("You are on the wrong Program")
} 

else if(status == 'On Therapy')
{
url = "/apex/Milestone_skip?id="+PmId;
window.open(url,'_blank','toolbar=0,location=0,menubar=0,width=800,scrollbars'); 
}  
else
{
alert("Patient must be ‘On-Therapy’ before skipping to a milestone");
}
}

This is my java script on click button code.In this i am querying  custom setting here:var Pname=sforce.connection.query("Select Program__c from Program_Names__c");
And i want to compare to field to show a alert.So i have to multiple values in custom setting.So how can i access all the values given in the custom setting in the java script code?