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
Laura GilLaura Gil 

How to set Account field automatically - Asset as child record: Every asset needs an Account or Contact ID

Hi all,
We are facing a serious problem.
We have a custom object, Custom_Fullfillment__c. We are using the standard object Asset set as related list in the Custom Fullfillment Page Layout.
Our requirement is to get the Account field on Asset automatically filled when we create Assets from the related list Assets in the Custom Fullfillment record. The custom object has a lookup to Account.

The problem we are facing is that standard we get the error "Every asset needs an Account or Contact ID" when we don't fill out the Account field on the Asset record and try to save it. The Fullfillment field on the Asset is being set automatically with the Fullfillment ID of the Parent Record, Account is also set on the Fullfillment Parent Record, but the Asset record can not be saved if we don't set the Account on it.

We built a process to set the Account on the Asset automatically when the Asset is being created from a Custom Fullfillment related list, but the saving is not working because Salesforce asks in advance for the filling of the Account field.

Probably process builder is not the best option for this requirement. I would appreciate tips which other possibilities would be suitable for this. Even when you set Account as non-required on the Asset layout, Salesforce is asking you to fill that field in advance.

I would appreciate tips, guys. I am not a developer but would like to know which other options we have for the solution of this requirement.

 
Best Answer chosen by Laura Gil
Laura GilLaura Gil
I solved this using Quick Action.

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi Laura,

Please check the sharing settings for the Asset object.

Note:
Creating Assets,
If asset sharing is set to the Controlled by Parent—the default setting—the Account field, Contact field, or both must be completed for an asset to be saved. If asset sharing is not set to Controlled by Parent, assets can be saved without an associated account or contact.


for more information about assets, please refer the below article.
https://help.salesforce.com/s/articleView?id=sf.assets_del.htm&type=5

If this helps, please mark it as best answer for future reference.

Thanks,
Ankaiah
Laura GilLaura Gil
Hi Ankaiah,
Thanks for your response. Unfortunately none of the options is working.
You have the possibility to enable or disable Asset Sharing Settings. After disabling the Asset Sharing Settings Asset become Private (OWD= Private).
When I try to save the same Asset record I talked about in my thread, I am getting the same Salesforce validation:

Every asset needs an account, a contact, or both.: Account ID, Contact ID

User-added image
User-added image
 
AnkaiahAnkaiah (Salesforce Developers) 
Hi Laura,
Please enable the asset settings as per the below screenshot.
Navigation:
Enable Asset Sharing (Setup > Asset Settings, from Classic)


User-added image

 
Laura GilLaura Gil
I solved this using Quick Action.
This was selected as the best answer