+ Start a Discussion
PedroLoPedroLo 

Creating Both a new Case Record and a related case with a single click

Hello,

 

I'm trying to create two records in one operation. I want to allow the user to create a new case from a related case list (this is a custom object that stores the relationshipt between the two cases). Since we are using record types extensively for cases, using Visualforce pages to replace all the layouts for all our record types is our last option as it would be a lot of work due to the numerous picklist and dependencies we have.

 

I implemented this using a custom field that I prepolulate using a custom button for each record type and an after insert trigger that checks for values on this field. The trigger actually uses the value in the field to create the relationship and then it clears the field.

 

The problem with this approach is that I have to display the field on the page layout so that a value can be stored when passed as a parameter on the custom button. I would like to avoid showing the field as users might alter the value.

 

Is there a way I can accomplish this other than creating a Visualforce page for every record type and handling the picklist values in a controller extension?

 

Thanks,

 

Pedro

sinsiterrulezsinsiterrulez

Hi,

I'm not sure that you need to have the field on layout to pass its value..You can have it in backend.

Also, can you use formula field rather than a text field..what value are you populating in it??

 

 

PedroLoPedroLo

Because I'm using a trigger to create the relationship record, I need to have the value of the related case in the new case record. I don't know of any other way to pass the value in this case since I'm using a regular page layout to create the case and not a Visualforce page.

 

A formula would not be possible since the value I'm storing is the id of the case I want to create the relationship with.

 

I'm sure there might be more ways to do this (and I'm not as experinced with Apex and Visualforce), thanks for taking the time to help.