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
kMans2kkMans2k 

Create New Object

Hello All,

I hope this is the correct forum.

I relatively new to Apex and needing some help achieving this particular task.

I have two custom objects. Call these ObjA and ObjB. ObjB is related to ObjA, and has a look-up field to reference the related ObjA. It has another picklist, say "country". ObjA also has the "country" picklist.

Now when the user chooses to create the related ObjB from the ObjA details page, salesforce automatically populates the reference to ObjA in the ObjB data entry form. Is it possible for me auto-select the "country" picklist in ObjB data entry form based on the related value in ObjA?

Secondly, there's a third custom object, ObjC. I'd like the users to be taken to the data entry form to create new ObjC, if they select "US" in the picklist in ObjB and save ObjB. It'll have to be in the trigger condition, but I unsure as to how to initiate "create new object" screen.

Hope this is not as confusing as it seems to me :) I look forward to your responses and if I do manage to get it solved, I'll post the solution for future ref.

Thanks

hudini3hudini3
hi there,
for this part
Now when the user chooses to create the related ObjB from the ObjA details page, salesforce automatically populates the reference to ObjA in the ObjB data entry form. Is it possible for me auto-select the "country" picklist in ObjB data entry form based on the related value in ObjA?
if they are always creating objB from objA then you could create a custom button and pull that data through very easily.

on that same button link s-control - have the user brought to a new url (the create new record for objC)
kMans2kkMans2k
I guess I am OK with creating custom button/link.
 
Is it then possible to hide the existing "new" button in the Related Lists section?
kMans2kkMans2k
I am taking the path of creating a s-force script and a button to create the related object.
 
I am OK with normal text input entries. However, the objects also have a picklist (items in pickslist are common) and a look-up field to the standard "Account" object.
 
How could I auto-fill the picklist and the look-up field?