• ScottB3
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 6
    Replies

I am trying to send out notifications when certain knowledge articles are updated.

How do I include Knowledge Article fields in a Mail Merge Template?

Using the salesforce.com/servlet/servlet.SForceMailMerge?id= link doesn't seem to work with knowledge_kav IDs.

The out of the box related list view doesn't work for what I need to have displayed for leads as I cannot filter it and only a limited amount of results show.

I have created an LWC which shows all of the information that I need to have displayed, but I don't know how to include the button to "Send Engage Email"   Having this button is absolutely critical to what my team needs.

Salesforce has a Matched Leads Component that can be placed on an account to show which leads match the account.

The problem is that the layout is not conducive to the work that my company needs to do and I need to create a custom component which uses the same matching logic but displays in a more traditional table format.

I cannot find any documentation on where to start on how to utilize the matching rules engine in Apex code to get a list of leads that I can then manipulate into our needed format.

User-added image
I have a set of leads for which I need to find the most recent campaign that they are a member of.

Since there may be more than 100 leads in the set, I am trying to write a single SOQL query that will return only the CampaignMember Id with the most recent CreatedDate for each lead, rather than put a query inside of a for-loop

I need something along the lines of this, but with the actual ID of the CampaignMember object instead of the count.
 
SELECT count(Id), LeadID, max(CreatedDate) FROM CampaignMember WHERE LeadID IN :setOfLeads GROUP BY LeadID

 
  • September 28, 2020
  • Like
  • 0
I am working with Lightning Web Components and have implemented the use of lightning-datatables in many places in the app which I am developing.
The requirements have just changed and I now need to change some of my fields to rich text.  As far as I can figure out, there is no way to do this.
I see in the documentation that there is the idea of Creating Custom Data Types, but can't figure it out.

Does anyone know how I can incorporate a rich text field in a lightning-datatable?  
 
I am trying to create a LWC that is aware of whether or not the App it is embedded in is uses Console or Stanadard navigation style.

I need this because I have two separate apps using the same component, one for fully licensed users and another for those only with Company Community.  

If console, I need to use Navigation.Mixin, for Standard, I just open a new window.

I've tried calling UserInfo.getUiThemeDisplayed() but I just get Theme4d returned regardless of which app I'm using.
 
I have a lightning recordEditForm with an InputField that is a picklist
Is there any way of getting the number of options from that field, or does the Locker Service completely prevent me from doing anything useful?
<lightning:recordEditForm
  objectApiName="Case"
  aura:id="caseCreateForm">
                            
<lightning:inputField fieldName="Service_Area__c" aura:id="Service_Area__c" onchange="{!c.checkForOneOption}"/>

</lightning:recordEditForm>

In my onchange, I am trying to find how many options are in the field.  I cannot seem to figure out how to figure out to access anything though as it seems the Locker Service is preventing me from finding anything.
I have used the call Schema.getGlobalDescribe().Values(); to find all of the objects in the system.

Is it possible to find all objects that have feed tracking enabled on them?  I'm basically trying to find all objects which can be followed.
I have a component that is calling a controller method which then returns a Map of object Ids and the object name back to the component.

The Map is successfully created in the controller as I can see the values in the debug logs.
However, when I call response.getReturnValue(), it just says that the value is [object Object] and I can't do anything with it.  I see no values, the response.getReturnValue().length is 0.

If I return a string instead of a map, it works as would be expected.

Component
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" 
                access="global" 
                controller="WFS_ObjectsIFollowController"
                >
    
    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="targetFields" type="Object"/>
    <aura:attribute name="recordError" type="String"/>
    <aura:attribute name="followedObjectsCount" type="Integer" default="0"/>
    <aura:attribute name="parentObjects" type="Map"/>    
    
    <force:recordData aura:id="recordLoader"
                      recordId="{!v.recordId}" 
                      layoutType="FULL"
                      targetFields="{!v.targetFields}"
                      targetError="{!v.recordError}"
                      recordUpdated="{!c.recordUpdated}"
                      fields="Id"                  
                      mode="VIEW"/>   
    
    <article class="slds-card ">
            
            <div class="slds-card__body slds-card__body_inner">

                <aura:if isTrue="true">
                    <div class="slds-region_narrow">
                        Size = {! v.followedObjectsCount }
                </aura:if>
            </div>
        </div>
    </article>
</aura:component>

Controller
({
    recordUpdated : function(component, event, helper) {
        var changeType = event.getParams().changeType;
        
        if (changeType === "ERROR") { /* handle error; do this first! */ console.log("Error: ");}
    	else if (changeType === "LOADED") { /* handle record load */ 
            console.log("*** In the controller");
            helper.getData(component, event, changeType)
    	}
    	else if (changeType === "REMOVED") { /* handle record removal */ console.log("Removed: ");}
    	else if (changeType === "CHANGED") { /* handle record change */ 
            helper.getData(component, event, changeType)
        }

	}
})

Helper
({
    getData : function(component, event, cType) {
        
        console.log("In the WFS_Objects_I_FollowHelper.js function");
        
        var action = component.get('c.getObjectsIFollow');
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS"){
                alert(response.getReturnValue());
                component.set('v.parentObjects', response.getReturnValue());
                component.set('v.followedObjectsCount', response.getReturnValue().length);
                console.log("Objects Returned: " + response.getReturnValue().length);
            }else {
                console.log("RESPONSE FAILURE");
            }
        });
        $A.enqueueAction(action);        
    }
})
Apex Controller
public class WFS_ObjectsIFollowController {
    @AuraEnabled
    public static Map<String, String> getObjectsIFollow(){
	
        List<Case> followedCases;
        
        Map<String, String> parentObjects = new Map<String, String>();
        String userId = UserInfo.getUserId();
        String soql = 'SELECT Id, Subject FROM Case WHERE Id IN (SELECT ParentId FROM EntitySubscription WHERE SubscriberId = :userId)';
        followedCases = Database.query( soql );
                
        for ( Case parent : followedCases ){
            String parentId = parent.Id;
            String caseSubject = parent.Subject;
            parentObjects.put(parentId, caseSubject);
            System.debug('*** OBJECTS I FOLLOW - ' + parentId + ' - ' + caseSubject);
        }
        System.debug('Parent Objects --- ' + parentObjects);
        //THIS LINE PRINTS WITH THE CORRECT INFO

        return parentObjects;
    }
}


 
I need to create a button on a Lightning component which will open the "Manage Contact Roles" page for the current opportunity.

I cannot figure out where the page is located that opens in the modal box when the standard button is used.

My organization has a limited number of products (20) for which we currently use Salesforce CPQ.

After a customer is signed, we then have thousands of modules which the implementation team needs to sort through to find which are most applicable to the customers needs.  These can be categorized by things like geography, feature set, language (customer needs the Ireland, China and US modules that apply to widgets, gizmos and dangles and we need it in Irish, Mandarin and American English) 

Once the implementation team decides which modules to use, they then need to be able to associate the chosen module configuration to the customer's account.

These aren't exactly products, and they aren't sold individually.  They're just pre-designed software modules to add to an overall configuration.

I'm looking for the best way to implement this which will give me something similar to the Salesforce AppExchange where you can multi-select different attributes based on metadata and narrow down your search to the appropriate modules.

Finally, I would need to be able to associate related objects to these modules such as implementation instructions, requirements, etc.

I currently have a set of four dependent dropdowns added to the case object.

The dropdowns are used to narrow down the type of request that a customer is trying to submit.  The problem is that we have around 100 potential options and it can be very difficult at times to find the appropriate choice.

Is it possible to create a search function that would display alongside the dropdowns which would search those fields and display possible selections?  Ideally, it would show the best options and if one were clicked it would fill in the dropdowns with the selection chosen.

This would preferably be done in lightning as we are kicking off our migration, but a standard visual force page would be welcome in the meantime as the switch will likely take a while.
I am trying to add a comment to a case feed using ConnectAPI.  
When I run this, I get the error

ConnectApi.ConnectApiException: Invalid identifier: 5003B000002o1FfQAI
Class.ConnectApi.ChatterFeeds.postCommentToFeedElement: line 674, column 1
 
Case salesforceCase;
createSFCase(salesforceCase);  //this works correctly and retrieving the Id gives me a value matching the system
ConnectApi.Comment comment = ConnectApi.ChatterFeeds.postCommentToFeedElement(null, salesforceCase.Id, 'comment text' );
I have a visualforce page, on which I am trying to get a pageBlockSection to show/hide based upon the value of an inputField picklist.

I cannot seem to get the reRender function to work and am at a loss as to why.

Here is the code that I am using.
 
<apex:pageBlockSection title="Case Type Selection"  collapsible="false" columns="1" rendered="{!isChangeRequest == false && contains(lower($Profile.Name),'community') == false}">
                <apex:repeat value="{!$ObjectType.Case.FieldSets.Standard_Case_Switcher_Fields}" var="f">
                        <apex:inputField value="{!Case[f.fieldPath]}" required="(f.required, f.dbrequired)" rendered="true">
                            <apex:actionSupport event="onChange" reRender="acInfo" immediate="true"/>
                        </apex:inputField>
                </apex:repeat> 
            </apex:pageBlockSection>
            

            <apex:pageBlockSection title="Account and Contact Info"  collapsible="false" columns="1" rendered="{!IF(contains(Case.Service_Area__c, 'Chg Req'), true, false)}" id="acInfo">
                <apex:repeat value="{!$ObjectType.Case.FieldSets.Standard_Case_Account_Contact_Fields}" var="f">
                    <apex:inputField value="{!Case[f.fieldPath]}" required="(f.required, f.dbrequired)"/>
                </apex:repeat> 
            </apex:pageBlockSection>

 
Salesforce has a Matched Leads Component that can be placed on an account to show which leads match the account.

The problem is that the layout is not conducive to the work that my company needs to do and I need to create a custom component which uses the same matching logic but displays in a more traditional table format.

I cannot find any documentation on where to start on how to utilize the matching rules engine in Apex code to get a list of leads that I can then manipulate into our needed format.

User-added image
I have a set of leads for which I need to find the most recent campaign that they are a member of.

Since there may be more than 100 leads in the set, I am trying to write a single SOQL query that will return only the CampaignMember Id with the most recent CreatedDate for each lead, rather than put a query inside of a for-loop

I need something along the lines of this, but with the actual ID of the CampaignMember object instead of the count.
 
SELECT count(Id), LeadID, max(CreatedDate) FROM CampaignMember WHERE LeadID IN :setOfLeads GROUP BY LeadID

 
  • September 28, 2020
  • Like
  • 0
I am working with Lightning Web Components and have implemented the use of lightning-datatables in many places in the app which I am developing.
The requirements have just changed and I now need to change some of my fields to rich text.  As far as I can figure out, there is no way to do this.
I see in the documentation that there is the idea of Creating Custom Data Types, but can't figure it out.

Does anyone know how I can incorporate a rich text field in a lightning-datatable?  
 
I have a component that is calling a controller method which then returns a Map of object Ids and the object name back to the component.

The Map is successfully created in the controller as I can see the values in the debug logs.
However, when I call response.getReturnValue(), it just says that the value is [object Object] and I can't do anything with it.  I see no values, the response.getReturnValue().length is 0.

If I return a string instead of a map, it works as would be expected.

Component
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" 
                access="global" 
                controller="WFS_ObjectsIFollowController"
                >
    
    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="targetFields" type="Object"/>
    <aura:attribute name="recordError" type="String"/>
    <aura:attribute name="followedObjectsCount" type="Integer" default="0"/>
    <aura:attribute name="parentObjects" type="Map"/>    
    
    <force:recordData aura:id="recordLoader"
                      recordId="{!v.recordId}" 
                      layoutType="FULL"
                      targetFields="{!v.targetFields}"
                      targetError="{!v.recordError}"
                      recordUpdated="{!c.recordUpdated}"
                      fields="Id"                  
                      mode="VIEW"/>   
    
    <article class="slds-card ">
            
            <div class="slds-card__body slds-card__body_inner">

                <aura:if isTrue="true">
                    <div class="slds-region_narrow">
                        Size = {! v.followedObjectsCount }
                </aura:if>
            </div>
        </div>
    </article>
</aura:component>

Controller
({
    recordUpdated : function(component, event, helper) {
        var changeType = event.getParams().changeType;
        
        if (changeType === "ERROR") { /* handle error; do this first! */ console.log("Error: ");}
    	else if (changeType === "LOADED") { /* handle record load */ 
            console.log("*** In the controller");
            helper.getData(component, event, changeType)
    	}
    	else if (changeType === "REMOVED") { /* handle record removal */ console.log("Removed: ");}
    	else if (changeType === "CHANGED") { /* handle record change */ 
            helper.getData(component, event, changeType)
        }

	}
})

Helper
({
    getData : function(component, event, cType) {
        
        console.log("In the WFS_Objects_I_FollowHelper.js function");
        
        var action = component.get('c.getObjectsIFollow');
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS"){
                alert(response.getReturnValue());
                component.set('v.parentObjects', response.getReturnValue());
                component.set('v.followedObjectsCount', response.getReturnValue().length);
                console.log("Objects Returned: " + response.getReturnValue().length);
            }else {
                console.log("RESPONSE FAILURE");
            }
        });
        $A.enqueueAction(action);        
    }
})
Apex Controller
public class WFS_ObjectsIFollowController {
    @AuraEnabled
    public static Map<String, String> getObjectsIFollow(){
	
        List<Case> followedCases;
        
        Map<String, String> parentObjects = new Map<String, String>();
        String userId = UserInfo.getUserId();
        String soql = 'SELECT Id, Subject FROM Case WHERE Id IN (SELECT ParentId FROM EntitySubscription WHERE SubscriberId = :userId)';
        followedCases = Database.query( soql );
                
        for ( Case parent : followedCases ){
            String parentId = parent.Id;
            String caseSubject = parent.Subject;
            parentObjects.put(parentId, caseSubject);
            System.debug('*** OBJECTS I FOLLOW - ' + parentId + ' - ' + caseSubject);
        }
        System.debug('Parent Objects --- ' + parentObjects);
        //THIS LINE PRINTS WITH THE CORRECT INFO

        return parentObjects;
    }
}