Adding Additional Fields to a sObject in Apex, (just for manipulation)

I’m working with some complicated queries, and I need to send over http, the sObject in turn, but I can’t make queries with more than 1 level of depth in the SOQL, so I am working with separated queries, then composing the sObjects, (or at least that is what I try), so I can created … Read more

Bubbling up an Account hierarchy to capture top most Parent Id from query

Based on some of the answers I’ve browsed I think this might involve 2 queries. I feel like this is probably a pretty common problem so I was hoping someone would have a quick answer or at least be able to point me to the docs that detail how this works. I briefly looked through … Read more

SOQL multipicklist contains value

I need to select a record from Salesforce and I have to use multi-picklist as a query condition. the one of the value from multi-picklist equals to ‘some test‘ I need somehow to select by the condition equals ‘some‘ I mean: SELECT FROM Account WHERE picklist INCLUDES (‘some’) Answer For picklists, you need to know … Read more

How to query parent record picklist field value in dynamic WHERE clause

I want to develop a WHERE clause for a dynamic SOQL query in a utility class. The WHERE clause should lookup a parent record picklist field value.The relationship between Shared_Contact__c and Contact is a standard lookup. The field I’m lookuping up is named Status__c and on Contact object. I want to lookup the Active picklist … Read more

if picklist label is queried using ToLabel() for an SObject, one cant save updates to this object if picklist is restricted

I followed the article below and got the picklist label-name instead of API name for an object. How to query ‘Value’ of a picklist rather than the ‘API NAME’, using SOQL? However while updating the object we get the error below. INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST This is problematic, as now there is no way to get the API … Read more

Is it possible to output an aggregate query to a Map>

Is it possible to output an aggregate query like this: Map<Id, List<Contact>> accountContactsMap = [SELECT aggregate query …]; Where the Map key is the AccountId and the Map value is a List of related Contact‘s for that Account? If so, how should the query be constructed? If not, what is the best approach to achieve … Read more

Compare fields in lightning component

I have a lightning component which the goal of it is to open a page if some fields on the record are not null, how to compare those fields to null? Here the component: <aura:component controller=”purchaseOrderComponentController” implements=”force:lightningQuickAction,force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId”> <aura:handler name=”init” value=”{!this}” action=”{!c.doInit}” /> <aura:attribute name=”recordId” type=”Id” default=”a0e2000000X2I9AAAV”/> <aura:attribute name=”purchaseOrder” type=”PBSI__PBSI_Purchase_Order__c”/> </aura:component> Here the JS controller: ({ … Read more

Apex: can’t use a lookup reference retrieved using SOQL query as a function parameter in a recursive function

I’m refactoring a recursive function to avoid hitting governor limits on SOQL queries. In order to keep SOQL queries out of a for loop, I’m using dot notation to retrieve a lookup relation (Residence) that exists on the parent account (household) of the object (wish) being queried. I had no problem when I had a … Read more