• Thomas Reinman 16
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 11
    Replies
I've got an apex:chart that's rendering some data from a custom controller. 

I'm using an apex:barseries to display the data, and I've chosen to select stacked="true", which stacks two integer values onto the same column. 

The problem is, when you define the fields for that axis (in this case the right y axis), you give the axis a Title (i.e., Number of Customers), but when you display the Legend, there is no way to dicipher what each grouping in the stacked column represents. The Legend will just display the Title of the axis for each unique grouping. 

Does anyone know how to indicate a unique value for each group within the Legend? Thanks ~

User-added image
I'm trying to query tasks related to opportunity, provided the context that the user is on the opportunity record. This query will grab that Opportunity ID and display the related tasks in a visualforce page on the layout.

Before you ask what the purpose is, this SOQL query doesn't include all of the filters on Tasks yet; first I just need to get it working for any related tasks. 

The apex class is:
 
public class discoQuery{

//VARIABLES

public Opportunity opp {get; set;}
ApexPages.StandardController sController;
public Map<ID,Task> tMap {get; set;}
    
//CONSTRUCTOR
public discoQuery(ApexPages.StandardController controller){
    sController = controller;
    opp = (Opportunity)controller.getRecord();
    }
    
public List<Task> tList{
    get{
        if(tMap == null){
            tMap = new Map<ID, Task>([SELECT Id, Subject, Activity_Type__c, Outcome__c, Status, OwnerId FROM Task WHERE What.Type IN ('Opportunity') AND WhatId =: ([SELECT Id FROM Opportunity WHERE Id =: opp.Id]) AND IsDeleted = FALSE ORDER BY CreatedDate LIMIT 1000 ALL ROWS]);
        }
            return tMap.values();
        }
    }
}

Visualforce:
<apex:page standardController="Opportunity" extensions="discoQuery" lightningStylesheets="true">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!tList}" var="t">
            <apex:outputField value="{!t.Subject}"/>
            <apex:outputField value="{!t.Activity_Type__c}"/>
            <apex:outputField value="{!t.Status}"/>
            <apex:outputField value="{!t.Outcome__c}"/>
            <apex:outputField value="{!t.OwnerId}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

Any thoughts on why this query isn't returning any records?

Thanks​​​​​​​
 
I'm re-using some code that I've used in the past to upload and insert a File into Salesforce from a Visualforce page. 

Apex:
// rfpio is the variable associated to a custom sObject that was inserted previously

 public PageReference addFile(){
            

               try{
                ContentVersion conver = new ContentVersion();
                conver.ContentLocation = 'S';
                conver.PathOnClient = System.now().format('MM-dd-YY') + ' ' + title;
                conver.Title = title;
                conver.VersionData = VersionData;
                insert conver;
                System.debug(conver);

                Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conver.Id].ContentDocumentId;

                // Create a ContentDocumentLink to the case
                ContentDocumentLink cDe = new ContentDocumentLink();
                cDe.ContentDocumentId = conDoc;
                cDe.LinkedEntityId = rfpio.Id;
                cDe.ShareType = 'V';
                cDe.Visibility = 'AllUsers';
                insert cDe;
                System.debug(cDe);
            }
            catch(System.DMLException e){
                System.debug(e);
                return null;
            }

            return new PageReference('/'+rfpio.Id);

    }

Visualforce:
// Here is the part of the page where the user can upload a blob

<apex:pageBlockButtons location="bottom">
    <apex:commandButton value="Upload" action="{!addFile}"/>
</apex:pageBlockButtons>

<apex:inputFile value="{VersionData}" fileName="{!title}" required="true"></apex:inputFile>

VersionData should be populated when the file gets uploaded, but for some reason I'm still getting an error message:
User-added image

Thanks for any support
Hello,

I need a trigger that will update a lookup field on a Task of a particular record type based upon the users' picklist value selection on that task record. The lookup field should be populated with the ID of another custom object. Both the task and custom object have a lookup to Opportunites, and the picklist on the task record matches the values of a picklist on the custom object. The matching criteria should be a combination of: (1) Task.WhatId and CustomObject.OpportunityId, (2) Task.PicklistValue and CustomObject.PicklistValue. So far, I have the following solution written:

User-added image

It is saved and active in my sandbox, but it is not updating the lookup field as expected. 

Does anyone have a correct solution?

Thanks,
Tom
How difficult would it be for Salesforce to add the Describe() method for the following objects?

CollaborationGroupRecord, ContentDocumentLink, ContentFolderItem, ContentFolderMember, ContentHubItem, Datacloud*, DataStatistics, DataType, DcSocialProfile*, EntityDefinition, EntityParticle, FieldDefinition, FlexQueueItem, IdeaComment, KnowledgeArticleVersion, ListViewChartInstance, LoginEvent, OauthToken, PicklistValueInfo, PlatformAction, RelationshipDomain, RelationshipInfo, SearchLayout, TenantUsageEntitlement, UserEntityAccess, UserAppMenuItem, UserFieldAccess, UserProfileFeed, UserRecordAccess, Vote
I've got an apex:chart that's rendering some data from a custom controller. 

I'm using an apex:barseries to display the data, and I've chosen to select stacked="true", which stacks two integer values onto the same column. 

The problem is, when you define the fields for that axis (in this case the right y axis), you give the axis a Title (i.e., Number of Customers), but when you display the Legend, there is no way to dicipher what each grouping in the stacked column represents. The Legend will just display the Title of the axis for each unique grouping. 

Does anyone know how to indicate a unique value for each group within the Legend? Thanks ~

User-added image
I'm trying to query tasks related to opportunity, provided the context that the user is on the opportunity record. This query will grab that Opportunity ID and display the related tasks in a visualforce page on the layout.

Before you ask what the purpose is, this SOQL query doesn't include all of the filters on Tasks yet; first I just need to get it working for any related tasks. 

The apex class is:
 
public class discoQuery{

//VARIABLES

public Opportunity opp {get; set;}
ApexPages.StandardController sController;
public Map<ID,Task> tMap {get; set;}
    
//CONSTRUCTOR
public discoQuery(ApexPages.StandardController controller){
    sController = controller;
    opp = (Opportunity)controller.getRecord();
    }
    
public List<Task> tList{
    get{
        if(tMap == null){
            tMap = new Map<ID, Task>([SELECT Id, Subject, Activity_Type__c, Outcome__c, Status, OwnerId FROM Task WHERE What.Type IN ('Opportunity') AND WhatId =: ([SELECT Id FROM Opportunity WHERE Id =: opp.Id]) AND IsDeleted = FALSE ORDER BY CreatedDate LIMIT 1000 ALL ROWS]);
        }
            return tMap.values();
        }
    }
}

Visualforce:
<apex:page standardController="Opportunity" extensions="discoQuery" lightningStylesheets="true">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!tList}" var="t">
            <apex:outputField value="{!t.Subject}"/>
            <apex:outputField value="{!t.Activity_Type__c}"/>
            <apex:outputField value="{!t.Status}"/>
            <apex:outputField value="{!t.Outcome__c}"/>
            <apex:outputField value="{!t.OwnerId}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

Any thoughts on why this query isn't returning any records?

Thanks​​​​​​​
 
I'm re-using some code that I've used in the past to upload and insert a File into Salesforce from a Visualforce page. 

Apex:
// rfpio is the variable associated to a custom sObject that was inserted previously

 public PageReference addFile(){
            

               try{
                ContentVersion conver = new ContentVersion();
                conver.ContentLocation = 'S';
                conver.PathOnClient = System.now().format('MM-dd-YY') + ' ' + title;
                conver.Title = title;
                conver.VersionData = VersionData;
                insert conver;
                System.debug(conver);

                Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conver.Id].ContentDocumentId;

                // Create a ContentDocumentLink to the case
                ContentDocumentLink cDe = new ContentDocumentLink();
                cDe.ContentDocumentId = conDoc;
                cDe.LinkedEntityId = rfpio.Id;
                cDe.ShareType = 'V';
                cDe.Visibility = 'AllUsers';
                insert cDe;
                System.debug(cDe);
            }
            catch(System.DMLException e){
                System.debug(e);
                return null;
            }

            return new PageReference('/'+rfpio.Id);

    }

Visualforce:
// Here is the part of the page where the user can upload a blob

<apex:pageBlockButtons location="bottom">
    <apex:commandButton value="Upload" action="{!addFile}"/>
</apex:pageBlockButtons>

<apex:inputFile value="{VersionData}" fileName="{!title}" required="true"></apex:inputFile>

VersionData should be populated when the file gets uploaded, but for some reason I'm still getting an error message:
User-added image

Thanks for any support
Hi, I am trying to set up an integration between slack and salesforce with customized slash commands (like top opps, new leads, etc). Does anybody know of a guide or tutorial vid for setting something like this up (or if it is even possible)?
Hello,

I need a trigger that will update a lookup field on a Task of a particular record type based upon the users' picklist value selection on that task record. The lookup field should be populated with the ID of another custom object. Both the task and custom object have a lookup to Opportunites, and the picklist on the task record matches the values of a picklist on the custom object. The matching criteria should be a combination of: (1) Task.WhatId and CustomObject.OpportunityId, (2) Task.PicklistValue and CustomObject.PicklistValue. So far, I have the following solution written:

User-added image

It is saved and active in my sandbox, but it is not updating the lookup field as expected. 

Does anyone have a correct solution?

Thanks,
Tom