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
RajpalRajpal 

Populate new case record thru scontrol

We have to create case templates for the cases. User when trying to create the new cases can select one template and that populates fields accordingly.

To achieve this we have created a list button on cases which calls the scontrol based on JavaScript. We have created two custom objects

1) Templates

2) Template details.

Template contains the names of the templates that are displayed to the user and user can select any one of those.

Template detail contains the field names and the value that needs to be populated.

On the button click, scontrol displays the templates to the user, user selects the template and then scontrol grabs all the fields and values for the selected template.

As of now we are creating a url based on the filed names and the values(example)

/500/e?cas4=GRAJPAL&cas8=High&cas16=Test@Please-Ignore&cas15=Test%203&00N50000001TEpf=test%20for%20test%20field

Fileds are getting populated.

The issue is that our case view keeps on changing frequently and new fields are added on a regular basis. In our scontrol we are hard coding these case ids like cas4, cas8. We got these id's after doing a "View Source".

1.) Is there a way we can grab these ids on the fly based on field name or the column name so that whenever a new field is added we do not have to add that to our scontrol?

2.) Can there be any other approach that we can use to populate the new case? Like when user selects a Template, we have all the filed names and values in array and thru code we can take the user to new case view (till here we are good) -- at this point how can we populate the fields on the new case view thru code without using the URL?Is there any API that we can use to populate fileds on the new screen? As it is a new case so does not have ID for which we can set fields for.

Please advice,

Thanks,

Gaurav

GregoryGregory

Gaurav, Unfortunately I'm not able to answer your questions about dynamically finding new fields.   However, I am interested in what you've done .  I'm trying to do the same thing on our salesforce application.  Would be willing to share the source code as an example?   You can post here or send directly to me at gdarmohray@ptiglobal.com.

Thanks,
Gregory