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
Again AgainAgain Again 

s-control to look up contact and account and prepopulate Case with this data

Hi,
 
I've started writing an s-control that will be launched as a url link from a custom object. It takes the custom object ID, and looks up a contact ID (contact ID is stored with the custom object).
 
I have this part working - I now need to take this contactID, and make the s-control redirect to a new case page, and insert the relevant contact.  Two questions:
 
1. How do I achieve the redirect? I only know how to make an s-control display or update data - not look up and then open another form in its own window.
 
2. If my contactID xxxxxxx is for John Smith - and there are multiple John Smith's in the system, how do I give this to the Case page? I can put "John Smith" into the contact field on the case, but then it will ask the user to select the correct John Smith. If I put a contact ID in there, SF doesn't recognize it. What would the correct thing be to do?
 
Thanks!
Again AgainAgain Again

Ok, I've resolved part of this

The link looks like this:

https://na4.salesforce.com/500/e?retURL=%2F0033000000I40Lt&def_contact_id=0033000000I40LtAAJ&RecordType=01260000000DJI9
&00N60000001HzE2=0013000000CfzYuAAJ

def_contact_id provides the correct contact.

window.location = redirectstring; --> this does the redirect to a new window.

Now I only have one question left: how can I create a URLstring to an s-control? In other words, I don't want to create a "custom link" where I choose type "s-control" - I want to construct my own URL that will point to the s-control. This URL string I put in an ordinary text field, so that I add the URL string to a related list display - cuts out one more click for my users. Thanks ...

Again AgainAgain Again
Have resolved this one also - the following worked. the {!d} is not part of the dropdowns it provides when you're creating the link, but it does take it.

HYPERLINK("https://na4.salesforce.com/servlet/servlet.Integration?lid=01N600000008nOM&eid="&{!Id}&"&enc=UTF-8", "Create Case.")