function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mahesh Babu 187Mahesh Babu 187 

Create New Records Through Trigger/Flow

Hi Team,

I have a requirement to create new records for a custom object in Salesforce.
My conditions are:
1. On my Product Object, there is a picklist field 'Verticals' and a     checkbox field 'Pricing'. Now if the value of Picklist field is 'A' and checkbox is unchecked, then it should create a new record for my custom object. That custom object should be populated with my Product name and a Price field's value. But the issue is Price field's value which needs to be populated will come from another Object named Product Offering which is a related list on Product Object. 

2.  On my Product Object, there is a picklist field 'Verticals'. Now if the value of Picklist field is 'B', then it should create a new record for my custom object. That custom object should be populated with my Product name and a Price field's value. But the issue is Price field's value which needs to be populated will come from another Object named Block Prices which is a related list on Product Object.

Can anyone tell how this can we created?
ANUTEJANUTEJ (Salesforce Developers) 
Hi Mahesh,

So in the trigger you could get the details from the Product Offering or Block Prices after checking the conditional statements i.e., the values that are selected in the record, let me know if this helps and you can find a sample trigger code below:

>> https://tekslate.com/15-sample-triggers-different-scenarios

Looking forward for your response.

Regards,
Anutej
Mahesh Babu 187Mahesh Babu 187
Hi Anudeep,

Thanks for your quick reply. But I think my scenario is different. I can rephrase the question. Suppose there are 4 Objects A, B ,C and D. B and C Object are related lists of A,but they don't have any relation with D. Now I want to create a new record of D which needs to be populated with values of A, B and C. I am able to populate value of A in it. But how can populate values of B and C in D as they don't have any relationship between them.