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
Dan BroussardDan Broussard 

Assign AcctID

I am working on a TrailHead quiz at
https://developer.salesforce.com/trailhead/force_com_admin_intermediate/business_process_automation/flow
I have created a New Account in a previous record create. I want to assign a new Contact to that new Acccount. Is the AccountID required and if so I  have the following issue: How to I take an Account ID from an account record and place it in a new Contact record for a contact record I have created in a previous step in a work flow? Is a formula required? 
For the new Contact Record, I have assigned  FirstName = {!FirstName} input from previous screen, same with LastName. I am guessing that to assign a Contact to an Account requires assigning the AccountID to the new contact record. I cannot figure out how to do that. 
I think I may have the same issue when I create a new Opportunity in the next step. :)
Thank you!


 
Best Answer chosen by Dan Broussard
Abhi_TripathiAbhi_Tripathi
Rachel and Dan,
Actually in that task its not asking you to relate Contact to Account or Opportunity to Account as well, its just asking you to create Account, Contact and Opportunity from a single page.

Just want to add one thing that in that part of the trailhead, its actually asking you to create Account, Opportunity and Contact from the flow not to relate each of them,

As per salesforce process if you need to relate Account to Contact first you need to create Account and use the ID of the Account in Contact to relate it, we can use the ID of the Account only when its created, but in this trailhead flow we are creating just single page, and flow page is inserting everything at once, so according to the requirement of the trailhead you cannot relate Account with Contact or Opportunity

Dan,
For the date format is same everywhere for a user, so Close Date format have no issue, and in that task its asking for the todays date of the next month (hard coded) so just put the date like 6/16/2015 you can choose the next month date from the calender icon itself.

Hope I am clear this time.

All Answers

Abhi_TripathiAbhi_Tripathi
Contact is a child object of Account, to relate a Contact with Account you need to populate AccountId field which is on Contact object its a lookup field which requires Account record Id.

Take a look below
//Inserting new Account
Account acc = new Account( Name = 'New Acc');
insert acc;

//Inserting new contact related to Account filling AccountId field
Contact con = new Contact(FirstName = 'New Contact', LastName= 'Test', AccountId= acc.Id);
isert con;

 
Rachel_NatikRachel_Natik
Are you sure thats correct? I though to use the last section where it asks if you want to create a record id as a variable?
Dan BroussardDan Broussard
I found that if I take in the create record  - account section and make the record id a variable AcctID (the very bottom of the page), I could use AcctID as the key in the contact record to tie the contact to the account. I passed the quiz but I still have not been able to get the opportunity record create to function properly. I think that the CloseDate calculated using the TODAY ()  function is not the same format as the CloseDate in the opp record.
Rachel_NatikRachel_Natik
I think you need to use flow created date +30
Abhi_TripathiAbhi_Tripathi
Rachel and Dan,
Actually in that task its not asking you to relate Contact to Account or Opportunity to Account as well, its just asking you to create Account, Contact and Opportunity from a single page.

Just want to add one thing that in that part of the trailhead, its actually asking you to create Account, Opportunity and Contact from the flow not to relate each of them,

As per salesforce process if you need to relate Account to Contact first you need to create Account and use the ID of the Account in Contact to relate it, we can use the ID of the Account only when its created, but in this trailhead flow we are creating just single page, and flow page is inserting everything at once, so according to the requirement of the trailhead you cannot relate Account with Contact or Opportunity

Dan,
For the date format is same everywhere for a user, so Close Date format have no issue, and in that task its asking for the todays date of the next month (hard coded) so just put the date like 6/16/2015 you can choose the next month date from the calender icon itself.

Hope I am clear this time.
This was selected as the best answer