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

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

How does joining two custom objects into one custom object through master-detail relationship work

I’ve been working on a test method but I’ve had a problem creating the setup of it. public static List<Job_Posting__c> createPostings(){ List<Job_Posting__c> testPostings = new List<Job_Posting__c>(); List<Position__c> testPositions = new List<Position__c>(); List<Employment_Website__c> testEmploymentWebsites = new List<Employment_Website__c>(); for(Integer i=0; i<10; i){ testPositions.add(new Position__c(Name = ‘Test ‘+ i, Status__c = ‘Closed – Filled’)); insert testPositions; testEmploymentWebsites.add(new Employment_Website__c(Name … Read more