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
shyam sundar 112shyam sundar 112 

help me on this in trigger!!!

I am new to apex and wondering if someone help me to do... 

update picklist from lookup value..

Example:- If i select india in lookup the picklist has to get updated as india.

whatever the value is selected in lookup needs to get updated in picklist.
I have 248 values needs to be updated.
Rajat Pratap SinghRajat Pratap Singh
Hi , Shyam

I am glad to share now we have a team of 150+ Salesforce and Full Stack experts. Here are Top 11 in-demand expertise in my organization

1. Salesforce Einstein with AI Learning. [4+ certified consultants]
2. Commerce Cloud / Demandware [4+ certified devs]
3. Mulesoft [2+ certified resources]
4. Field Service Lightning [2+ certified]
5. Marketing Cloud [5+ certified resources]
6. CPQ/ PARDOT [5+]
7. Dell Boomi [10+ certified resources]
8. DEV OPS [5+ devs with multiple projects experience]
9. Salesforce DX [10+]
10. Block chain + Salesforce [2+ in learning stage]
11. Marketo / ServiceNow / Zoho CRM / HubSpot CRM /Freshsales / Pipedrive [10+]

We have a list of Customer Success Story from our client with their valuable feedback-

YouTube Link - https://www.youtube.com/watch?v=gDowyMBToYc&list=PL-sRc4lVXrN6ZHCHcFds5KvOrwkbnQ7io

Do let me know if you find any synergies or have a requirement for such high in-demand expertise and we can schedule a meeting as per your availability and preferred time. Here is the link- https://calendly.com/salesforceup
Biswojeet Ray 11Biswojeet Ray 11

Hi @shyam sundar 112

Let's assume, You have a child object is "Account". parent one is the "Country" object.

There is one name field in "Country".

1) Name of Country

One Country record is - India

There is a picklist in the account object is the "Selected country".

EX value is - 'India'.

The trigger in Account is ->

 

Trigger accountTrigger on Account (before Insert) {
    Set<Id> SelectedCountryId = new Set<Id>();
    for (Account acc : Trigger.New) {
        SelectedCountryId.add(acc.Country__c);
    }
    Map<Id, Country__c> countries = new Map<Id, Country__c>([SELECT Id, Name FROM countries WHERE Id IN: SelectedCountryId]);
    for (Account acc : Trigger.New) {
        //countryName__c  is the picklist field name
        acc.countryName__c = countries.get(acc.Country__c).Name;
    }
}