0

My company wants to gather the client's assets at the lead stage and automatically populate the assets page of the account once the lead gets converted.

The same assets fields currently exist as custom fields in leads but all the information gets lost when converted OR the user is having to make a note on it and add it manually on the account when converted.

Is there any way to do this / suggestions for this? It seems something so silly to not to include Assets object on the conversion process... they should of at least made it optional!

One solution I tested (and works!) is to re-create the fields on the account and use the map leads fields to populate them but that will replicate data and not use the inbuilt Salesforce functionality! It will also make the page layout incredibly big...

Might also add it to the Salesforce idea page...

  • Only 1 asset record per Account after lead conversion or many? Also, assets are not normally part of SFDC Leads so don't hold your breath for this being added as OOB functionality to lead conversion – cropredy Nov 29 '16 at 22:57
  • There are lots ans lots of assets that we use and that can be placed under an account... hence why we need the quickest most effective solution as APEX will also take a long time to create, test and deploy... Can it be done on a visualforce page which redirects it to the account object --- problem here is the 'chicken or the egg' problem as the lead's account wont be created until the conversion...! – TheAdmin Nov 30 '16 at 8:55
  • First idea that popped in my mind is to use processBuilder - entry criteria - if Lead's isConverted field true, then get assets associated with that lead and set their AccountId field to newly created Account. – EvAzi Nov 30 '16 at 9:27
  • sorry, i wasn't clear -- does a specific Lead conversion need to create multiple Asset children under the Account or only a single Asset? If the former, how are these assets enumerated in the Lead record? – cropredy Nov 30 '16 at 15:11
  • @cropredy - right I think I understand you now - no luckily there is only one asset instance per account but as I have mentioned before there are lots of fields available to be filled in on one asset page. These are currently all custom fields in the Leads record that for now are unfortunately destroyed when converted! – TheAdmin Dec 1 '16 at 9:25
1

OK, a clicks not code solution is as follows

  • Create new fields on Account called Asset_Staging_xxxx__c where xxxx aligns to a field on the Lead. Make these fields hidden on the page layout
  • Use Lead Field Mapping on the Lead setup and map each Lead field associated with asset data into the corresponding Account.Asset_Staging_xxxx__c field
  • Use Process Builder that after an Account is created, you create an Asset object and populate the Asset fields from the Account.Asset_Staging_xxxx__c fields. Process Builder allows creation of child records

Process Builder entry conditions need to consider:

  • Account DML event is caused by Lead Conversion/Lead field mapping. This can be done by mapping a checkbox formula field from Lead isLead__c to Account.IsUpdatedByLeadConversion__c (don't forget to clear this field when the Process executes as an immediate action)
  • Thus, avoid execution of the Asset creation on normal Account create/update

Update to address comment CANNOT_EXECUTE_FLOW_TRIGGER

For the Asset to successfully save on insertion in the Process Builder Immediate Action the following needs to be true:

  • All Asset Validation Rules must pass
  • Any triggers on Asset do not invoke addError or throw exceptions
  • The required fields on the Asset object must be set. There are two OOTB required fields: AccountId and Name

I tested this in my Dev Org and all works well on Lead Conversion. The reference to the Known Issue is no longer operative as a) it was fixed and b) applies to something other than Process Builder (i.e. Flow as a Workflow Action).

enter image description here

  • Thanks for this @cropredy (a click not code solution is always preferred!) Quick 2 questions: Its only 1 Process Builder I need to create, correct? (or one for Leads/Accounts) 2. Can you give more details on the criteria/ immediate actions that need to be in the process builder? I have selected quick actions >global actions>Create a record> but no Assets actions is in that dropdown! Essentially - how do I create an asset under that new account so I can do an update record (still with process builder) and reference the Asset_Staging_xxxx__c field to populate it? – TheAdmin Dec 7 '16 at 15:36
  • @user2326637: (1) PB on Account only; (2) Action Type = Create Record. Assets appears as drop down for me - based on your description - are you in Visual Flow? You should be in Process Builder – cropredy Dec 7 '16 at 18:37
  • I am definitely in PB - I have followed your instructions but I am getting an error (Error: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow...) Looking at this it seems to be specific to the lead convert process (success.salesforce.com/issues_view?id=a1p30000000T3sCAAS) can you advice? thanks! – TheAdmin Dec 13 '16 at 15:34
  • @user2326637 - see my updated answer – cropredy Dec 13 '16 at 17:16
  • Happy new year! I was away and couldn't test the new solution - I have upvoted for the great details of your answer! Unfortunately I am still not able to replicate this on my system - I have no asset validation rules, triggers or required fields on assets! I currently experimenting with a delayed scheduled action as I want to test if it is something specific when you click the 'convert' button or not - I have added a print screen of my 'ceate asset' PB page (imgur.com/a/nXR1j) --- can you confirm it is correct? Can you show me a print screen of yours please? Thanks! – TheAdmin Jan 3 '17 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.