7

There's no problem with this for loop configuration because it doesn't cause multiplicative execution. The reason you may have heard about avoiding nested for loops is that some people try a naive implementation to match up records. Here's a typical example of what not to do: Account[] accounts = [SELECT Name FROM Account]; Contact[] contacts = [SELECT ...


6

If you are creating child record from parent record's detail page then create a recordtype on the parent object and create a separate page layout where you can remove the New button of Child object's related list. Map this recordtype with the page layout. When you create a child record then update the recordtype of Parent record. This way, user will not see ...


6

Firstly, this is not documented. As a thumb-rule, salesforce always insists to use ONLY what is documented. So, this may some day be made invalid by salesforce the sameway they did Prevent Creation of Function Expressions in Dynamically Created Aura Components (Critical Update). Although passing function expressions in attributes (properties) of dynamically ...


6

I'd be surprised if they don't have this approach documented anywhere. It's pretty standard in other web frameworks, but works for a different kind of communication paradigm to events. Events keep everything loosely coupled, and if you needed later on to support communications with a component outside of the hierarchy then you'd be good to go, but there are ...


3

Known Issue - Distance cannot be selected for foreign key fields (via @fehays) Distance cannot be selected for foreign key fields, for example use the below query in Apex: [SELECT id, DISTANCE(Parent__r.some_field__c, GEOLOCATION(0,0), 'mi') distance FROM Child__c ], we get an error saying No such column 'distance' on entity Parent object. I added a ...


3

You can simply get the maps from the respective lists without looping. Map<Id, Order> mapOrders = new Map<Id, Order>(listaOrders); Map<Id, Opportunity> mapOpps = new Map<Id, Opportunity>([SELECT ID, Name FROM Opportunity WHERE Id IN : idsOpps]);


3

I can say few reason:- Bound expressions provide an implementation of bidirectional data binding. Bidirectional data binding provides a convenient and powerful abstraction. However it also comes at a cost: The framework has to set up two event listeners for each bound expression, which can have a negative impact on performance when there is a large number ...


3

Related fields in trigger context are null unless queried explicitly. Your options are to either: Query your users based on the values from OwnerId Create a formula field Owner_Name__c, which returns the text of Owner.Name, allowing to you use the formula in your trigger. I usually prefer a formula over the query, since its cheaper, and you can re-use it ...


3

What you are mentioned in a question is a parent-to-child relationship. you can go only 1 level deep. So you can't use it here Let's say, you have Level1__c, Level2__c, Level3__c, Level4__c objects with respective lookup fields on parent object. Option 1 If you need to get Level4__c records you will need to perform the following query, In this way, you are ...


2

The error message is fairly clear. In SOQL, you cannot have a subquery that uses the same relationship name that another subquery used. The syntax you used isn't how you'd query a grandchild record, but the right way to do it doesn't matter, because in a single SOQL query you can only query one level down the relationship hierarchy (you can only go from ...


2

If I understand correctly you want to take the values of the year__c and goal__c field from the participation__c record through the personnel__c record and put it into a field on the parent account record. I'm assuming the field name on account matches the field name on the Participation record: public class AccountParticipateTriggerHandler { public ...


2

You can filter your query on the field Parent.Type, whose value is an sObject name: SELECT ParentId, Id FROM Attachment WHERE Parent.Type = 'Account' That will get you back record-by-record level data on each Attachment and its parent. Alternately, if what you want to know is "which kinds of objects in my org have attachments", you can do an aggregate ...


2

The filter simply selects which records are going to be returned. If you actually wanted the courses, you'd put that in to the query's field list: String req = 'SELECT name, (SELECT Name FROM Courses__r) FROM Certification__c WHERE ID IN (SELECT Certification__c from Course__c)'; Note that you'll need to go in to the Course__c object, take a look at the ...


2

Yup this is pretty easy there is a "add fields related via lookup" link on the side of the report type layout editor: Just click on that, select the parent object you want included and then the fields you want added. Do this for each parent object you have.


2

There's a way to do it declaratively, but it would involve creating a junction object between Contact and Proposal (since your Contacts for an Account will all be related to all Proposals under any of those Contacts) and building a very complex set of Process Builder and Flows automations to maintain the junction objects when Contacts or Proposals change. ...


2

My assumption you need the record type Id for the Newsletter. And while creating an account you need to tag recordtypeid field Check this: Id recordTypeId = [SELECT Id FROM RecordType WHERE DeveloperName = 'Newsletter' and SObjectType = 'Account' LIMIT 1].id; While creating a test account mention mockAccount.RecordTypeId = recordTypeId;


2

You cannot make a field to field comparison in SOQL i.e. as mentioned in the question, you cannot compare X.Parent.AccountId != X.AccountId. There is other workaround by which you can do this i.e. by creating a new formula field which evaluates to true when X.Parent.AccountId = X.AccountId and false when it is not same. The formula for your new field ...


2

I think you should mark external id as unique. Secondly, in the 3rd screen, field mapping should be on 2 fields External_Id__c and Parent’s External_Id__c where you have specified the id and external_id__c. Thats why the records are not matched during upsert.


2

You should only be selecting your External Id field in Step 2b. You don't want to match the child records to the parent records and update them; you want to connect their lookup relationship. Step 1 is identifying existing copies of this record in your database.


2

Do I have to import anything into the 'Parent' Component? No. Or Export anything from the 'Child Just the default export: export default class LwcEditForm extends LightningElement { ... Am I perhaps referencing the component incorrectly? Not as far as I can tell. Your main problem is that you're referencing a SLDS grid with a total size of 6/3 (...


2

Making a flow using process builder alone will not allow you to count the number of sibling closing records under a contact. Also, it wouldn't cover the scenario whereby a closing record is deleted. You could use a rollup summary field if you can change the lookup on Closings up to Contact into a master-detail relationship. Otherwise other options include ...


1

You could use record types to achieve this. On object ‘A’s’ open and active update the child record’s record type that has only open and active in the picklist values. Similarly when the status is Closed update the child record type that would have only Closed as an option. So you would need two different record types to accomplish this.


1

User tempo = [select contact.name from user where id= :UserInfo.getUserId() limit 1 ]; Please use tempo.contact.Name


1

There are a number of things to consider with your business unit set up such as using the connector to synchronize data between SalesCloud/Service Cloud and if you will need a Multi-Org setup. Support may be recommending an additional 2 child business units (BU) as it is good practice to keep the parent business unit as the top-level admin BU — especially ...


1

I dont think you can achieve that by using event.preventDefault();. This is basically to stop default behaviour. In your case you should have something like: moveNext : function(component,event,helper){ // control the next button based on 'currentStep' attribute value if(isValid) { var getCurrentStep = component.get("v.currentStep"); ...


1

We cant create more that M-D on any object and there is really good reason why Salesforce do now allow us to create more than 2 two. Read more about data skew problem if you want to know why. If you want to control sharing based on other(parent) record access then you can simply make all objects private and create your won sharing rules or apex manual ...


1

As you have already stated, you can have at most two master-detail relationships with your custom object on the detail side. Also, only one of them is the main parent. The usual use case of two master-detail relationships is in junction objects. There is no way to have more than two master-detail relationships on an object but you can fake them with several ...


1

The update DML command on the CertificationObjects will not update the Contact lookup fields' data - it only updates fields on the Certification__c record itself. Try the following (EDIT - using Map to avoid duplicate Contact Id updates): List<Certification__c> CertificationObjects = new List<Certification__c>(); CertificationObjects = [SELECT ...


1

You can do it in two ways By adding the required field in the markup and not displaying it. That way, the field that you need will be automatically picked up by the standard controller. And, then you can use Case__c field to query other related appointments. By adding the required field using addFields method in the constructor of the controller. Using this ...


1

You don't need to query the Case ID, but you do need to query the related appointments. Simply add this code in your Visualforce: <apex:outputText rendered="false" value="{!Appointment__c.Case__c}" /> Visualforce can automatically retrieve the parent record's fields if you include it in the markup. For example, if you also wanted the case's case ...


Only top voted, non community-wiki answers of a minimum length are eligible