0

I have this situation where I want to create a record on the ACCOUNT object and only when my custom field in ACCOUNT called 'Account status' is changed from 'new' to 'prospect', then it should auto-create a record on a CUSTOM OBJECT linked to the ACCOUNT record using process builder.

The problem arises when I need to have required fields in the page layout of the custom object - so it fails whenever I change my "Account status" field to 'prospect'.

Is there anyway I can auto-create a record on a CUSTOM OBJECT linked to the ACCOUNT record bypassing the required fields for the first time? I plan to make it like this so users can enter that custom object record later and update all the mandatory fields in that record.

Please if you can not to suggest using a visualforce page unless that is the only option.

1

First of all: if field is required ONLY on page layout it shouldnt be required for any other action than creating the record manually by the user. Secondly: you can use Apex trigger for that. Third option: you can create some artificial field on custom object that will indicate that the record is created automatically or not and add it to validation rule.

And probably a lot more options

  • 1st option) I want to auto create the custom object and while doing that will auto populate the type from Account to the custom object type but there will be so many other mandatory fields to populate in the custom object - so I don't understand what you mean by 'if field is only required only on page layout'. 2nd option) apex trigger means i need apex test =/. 3rd option) I like the sound of it - does that involve having another page layout & record type? – compski Sep 22 '18 at 9:46
  • 3rd : no just dont place this field on the layout. User wont See it but you can create logic around it. 1st you described in your post that you need to have required fields on page layout: and that means they are only required ON THE RECORD PAGE so not during any other automatic actions like troggers Pb wf rules – user1974566 Sep 22 '18 at 10:16
0

If the field is universally required at field configuration, then it will be displayed as mandatory in the page layout.

So approach will be during auto creation of custom object record from account, populate those fields with default values. So, during record creation there will be no errors.

If you have existing validation rules which stops you creating the record that that's need to be changed to incorporate this functionality.

Also, if necessary put a validation rule on custom object so that user will have to change the values to the expected values which must be validated during Edit/Save.

0

The best option would be to set up the fields on the custom object as "not required." Then, on the object's page layout(s), go to the field properties and set them as "required" there -- at the page level. Check out the "...on the page layout" section here:

https://help.salesforce.com/articleView?id=000003107&type=1

Then, when your Process Builder flow runs, you won't have any problems creating the custom object records. (No need for a trigger as user1974566 suggested. That doesn't get you around the problem.)

0

I just realized there is a very easy solution to this partly thanks user1974566 (If he'd explained it easier I'd have immediately gotten it.)

All I needed to do was make sure all the custom fields I built do NOT have the 'Required' checkbox created like :

Field level

Instead to make them 'Required' on the page layouts like :

Page layout level

Then I can auto-create a record there even when it is required.

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.