+ Start a Discussion
CRMUser23CRMUser23 

New Case S-Control

I am trying to create new case with couple of pre-populated fields.  I tried custom link that works only as a detail button on  a Case.
 
I would like to create a list button that overrides NEW button on Case Home Page.
 
Could  somebody share s-control that will help me or give me some pointers to accomplish this.
 
Thankyou very much.
Michael SnowMichael Snow
Overriding NEW case button overrides the functionality everywhere (including the tab list).  If I have misunderstood your question, please let me know.

Here is an sControl that overrides new case and populates some fields:
Code:
<html>
<head>
<script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script>
<script>
function init()
{
  window.parent.location.href="{!URLFOR($Action.Case.NewCase, null, ["def_contact_id"= Contact.Id ,"def_account_id"= Account.Id, "retURL"=URLFOR($Request.retURL, null,null,true), "cancelURL"=URLFOR($Request.retURL, null,null,true) ], true)}";
}
</script>
</head>
<body onload="init();">
</body>
</html>

 

Greg HGreg H

Another rather simple example.Code:

<html>
<head>
 <title>New Case Override</title>
<script language="JavaScript" type="text/javascript">
<!--
//initiates the page
function pInit() {
 var url = parent.location.href; //URL accessing sControl
 url += "&cas14=This%20Is%20A%20Subject"; //add subject text parameter to the URL
 url += "&cas11=Email"; //add origin selection parameter to the URL
 url += "&cas15=Description%20Text"; //add descrition text parameter to the URL
 url += "&nooverride=1"; //pass nooverride parameter to prevent infinite reloading of new case page
 parent.location.href = url; //pass full URL to page (refresh)
}
//-->
</script>
</head>
<body onload="pInit()">
</body>
</html>


This code essentially pulls the URL from the browser, appends some parameters and then redirects the browser.

-greg

CRMUser23CRMUser23

Michael & Greg,

Thankyou both.  I could use either.   It was great help!!:smileyhappy:

 

 

arasuarasu
Hi Greg,
I need to display a default value for a dependant picklist on the case obejct based on the parent picklist object. Does the S-control support this? If so how can I get this implemented?
 
Please let me know your thoughts.
Thanks and regards
Greg HGreg H
You can still pass picklist values in the manner identified earlier in this post even if your picklist is dependent. In the example I wrote earlier I was passing values to standard fields but since your picklist is dependent I presume that the field is custom? Simply use the id for the custom field and then pass the value after the equal (=) sign.
 
For example - If the custom dependent picklist field has an Id of "00N30000001uJCu" then you could pass the value as:
Code:
&00N30000001uJCu=Value

Let me know if you have additional questions,
-greg
pmozz01pmozz01
Would using a custom button be a good way to create a new custom object that can then be created from either a contact or a lead so that when the button is used the code passes whether the values to be pulled are from a contact or lead based on some identifier?  How would I go about doing this?

These are the requirements/issues I am trying to resolve:
I have created a custom object for Sales Aid & Sample Requests.  The purpose of this object is to enable the user to put in a request from either the Lead or the Contact for various sales aids or samples.  Once the request is completed, it will be emailed to the appropriate fulfillment person and copied to additional internal people.

Since a Sales Aid or Sample can be requested for either a Lead or a Contact, I would like to use the same object on both of these objects (Lead/Contact).  I have a Lookup field for Contact as well as a Lookup field for Lead.  My problems start when I want to use a formula field to bring in the Lead Address or Contact Address, depending upon whether the request is generated from a Lead or a Contact.  There are a few other fields that I would also like to use a formula to populate, but of course, these field names differ between the two.  Of course, I can create a "Lead Address field" and a "Contact Address field", etc., but this looks messy so I was looking for a way to (1) identify whether the request is being generated from a Lead or Contact (2) Pass by formula the correct values and (3) still be able to pull all of the fields into an email template, so even our personnel without Salesforce.com licenses can see that the sample/sales aid was requested.  I will also need to be able to pull together a single report of all of the sales aids/samples fulfilled. 

Does anyone have any suggestions or knowledge of how to identify what object the request was generated from, and then have the remaining formula fields reference and return the correct values?

Thanks for any insight as I've been mulling on this one for some time.