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
Bmin7Bmin7 

Custom S-Controls and PE

Can anyone give me a basic rundown on things I can do with Custom S-Controls in PE?  Most of the stuff I can find to read gets into functionality that is only available in EE or UE. 
 
Maybe this is too broad of a question...
 
I am looking to create an s-control to create a new Case from an Opportuntiy related list, and pass the Opp name to the new record.
 
I have watched part of the S-controls for Dummies video, and am combing the PDF for help. I thought I would post here and see what I might get.
 
Thanks!
 
-Brandy
DevAngelDevAngel
In PE you are limited to html/javascript and don't have the ability to leverage the API through the ajax toolkit.  There is no supported way to do what you want to do, which is to construct urls from your scontrol to control the application.


Cheers
Bmin7Bmin7

Is there an unsupported way to construct URL's through an S-control? :smileytongue:  I was also considering finding a consultant who could write the Java Script for me, since I am in-experienced at doing this.  Do you think this would work?

Thanks!

 

TCAdminTCAdmin

Bmin7,


You can use a combination of JavaScript and custom links to build a custom sControl that would create an object.  You can do a search in the Help & Training to find out more about the custom links.  If you know JavaScript then this shouldn’t be any problem.  I’ve even used it to create an object and then return to the existing page with a refresh.  One of the helpful links to Help & Training is: https://na1.salesforce.com/_ui/training/help/pub/UserEdSolution?id=501300000001dKy&retURL=https%3A%2F%2Fna1.salesforce.com%2F_ui%2Ftraining%2Fhelp%2FLocalSfdcSolutionSearchPage%3Fstr%3Dcustom%2Blink&ps=1&orgId=00D000000000062.

 

If you need any assistance with this then please let me know and I can try and help.

Bmin7Bmin7

Thanks Chris!

I had not found that in Help & Training.  It looks very similar to what Chris Sommers demonstrates in the S-Controls for Dummies Dreamforce Video.  I have been tinkering with it a bit, but I have not been able to make it work yet.  I copied the example directly from the Dreamforce PDF:

Code:

<script language="Javascript">
function redirect() {
parent.frames.location.replace('/500/e—retURL=%2F{!Contact_ID}
&def_contact_id={!Contact_ID}&cas14=Password%20Reset
&cas11=Phone&save=1');
}
redirect();
</script>


 
But I get an error within Salesforce saying Cross Site Scripting. 

Any Ideas?

Thanks!

TCAdminTCAdmin

Bmin7,

The reason is that you are using the API names for the fields.  You will need to go to the page within SF that has the fields in the edit mode.  You can then view the source of the page and then see what the ID of the field is.  It should be a 15 digit number.  Use that in place of the __c value you already have.

If you use Firefox then there is a add on called Firebug that works really well for this.  It will prevent you having to view the source and trying to find the field that way.

Bmin7Bmin7

Ok, I tried Firebug, but couldn't find what I am looking for.  I have another tool on Firefox - can't remember the name at the moment, but it allows me to view form information, and I can see the 15 digit numbers for the fields I am trying to use.  The fields that are custom fields have a 15 digit number, and the fields that are standard fields have a number like cas15, or cas16.  I am sorry to be so dumb, but I am not quite sure where I am using the API names in this script, as I did not actually write it, but just copied it out of the Dreamforce Power Point.  Is it the merge fields that are within the curly braces? ie. {contact_id} or is it where it says def_contact_id?

I have bee trying relacing them with the 15 digit id number I found in the Form View on Firefox, but I am still getting that cross site scripting error.:smileysad:

-B

 

Bmin7Bmin7

P.S. In case you didn't realize - I pretty much know nothing about javascript. :smileytongue:

Cool jeep, by the way. :smileywink:

-B

TCAdminTCAdmin
Thanks,
 
When you create the case, do you want to be left on the Contact or the Case once you hit the button?
TCAdminTCAdmin
This should solve the issue for you :)

If you want to be left on the Case then you would want to create a custom button or link that will open in the same window without header or sidebar.  The code that you would use is HTML and it would be

/500/e?{!Contact.Id}&cas11=Password Reset&save=1

If you would want to open the case but be returned to the Contact then can create an sControl that would open in a new window and would use an sControl with the following code:

Code:
<script language="Javascript">
function redirect() {
window.location.href = "/500/e?{!Contact.Id}&cas11=Password Reset&save=1";
opener.location.reload();
window.close();
}
redirect();
</script>
If you want the window to remain open then place two forward slashes // before the opener line and the window.close line.

I'm not the best on JavaScript either so there may be other opinions on how to do the script above but I know this works.
 

Bmin7Bmin7

Well you know more than I do - which is nothing!  Ha ha! 

Actually - what I really want to do is something totally different.  I was just trying to use the stuff in the Dreamforce example - verbatim and see if I could get that to work, and then try to tweak it to make it do what I really want.

 

What I REALLY want to do is create a 'New' button on the Case related list in Opportunities - because it doesnt already come with one (imagine that), and then when I click that button, I would like to open a new case, pass some field values through (most of them custom fields) and then leave the case open for the rep to edit and then save.  Think you can figure that one out?

I will try out what you've got here in the meantime.

Thanks!:smileyhappy:

Bmin7Bmin7

Ok, the HTML thing you gave me worked!  BUT.... it did not associate the new record with the contact.

the javascript example you gave me still gave me the Cross-Site Scripting error.  :smileyindifferent:

i think I might be able to use the HTML thing - and tweak it to do what I want - but any ideas on why its not associateing with the contact?  I wuold definetely need to solve that issue.

 

Thanks!

TCAdminTCAdmin

Ryan,

The problem is that there isn't any relationship from the Case to the Opportunity.  You would probably be better off creating a lookup field on the Cases to the Opportunity and then hiding the original Cases related list on the Opportunity.  You would then want to put the ID of the new field in the html link and put the opportunity name in it as a value.  You can then add the button to the related list.

Bmin7Bmin7
Yep - I was able to add the name as the value and realte ti to the Opportunity.  All up and working!
 
Thanks so much for your time and help!
 
-Brandy