Skip to main content Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.
Hi,

I was asked in an interview the below question:

There is a custom object X and there is an Account Object.

Account object and X object do not have any relationship.

Whenever I will create an account record, I need to populate a text field with a value of X object on acccount object. This needs to be acheived using configuration and no customization.
3 Antworten
  1. 11. Okt. 2019, 11:40
    You can use process builder to trigger the Flow. once the flow is triggered,you can query on X object and assign the value to the text field(Account field) as per your requirment.
  2. 5. Nov. 2019, 14:00
    Hi Vaibhab,

    For you question, there are three solutions may be-

     1. Process Builder 

     2. Visual Flow 

     3. A trigger

    Trigger may be a better solution. Please refer the code -

    Let a text field on account-

    Label - TextByObjX

    and a record name on Object X is - XRecord

    Trigger PopulateAccountField on account(After insert){

    String str = '';

    X__c xRec = [select name from X__c where name=:'XRecord'];

    str = str + xRec.name;

    account acc = [select TextByObjX from account where Id =:trigger.new];

    acc.TextByObjX = str;

    update acc;

    }

    The above short code will help you populate the text field on account with one record name on object X.

    I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

    Thanks and Regards,

    Ajay Dubedi

    www.ajaydubedi.com  
0/9000