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
ElenaCaptaElenaCapta 

Links on Object

Hi all,
 
now i try to create a SControl where the result are a fields of the result object and I whant that this results are a link to the object. Does somebody  know how can i do this? 
 
Thanks, and best regards!
 
Elena
The_FoxThe_Fox
Hello,

Can you make a screen mock up of what you really want to achieve

Regards
ElenaCaptaElenaCapta
The next code is an example that the I want:
 
function setupPage ( ) {
var queryResult = sforceClient.query("Select Id, Name Case", layoutResults);
}

function layoutResults (queryResult) {
if (queryResult.className == "Fault") {
alert("There was an error: " + queryResult.toString());
} else {
if (queryResult.size > 0) {
var output = "";
for ( var i=0; i<queryResult.records.length; i++) {
var dynaBean = queryResult.records[i];
output += dynaBean.get ( "Name" )+" ";
}
 
and when it show the result (Name) I want that the result are a link to the object (in this case "Case")
 
if the Name = LALALA: 
 
LALALA   (and it's a link to a case LALALA)
 
Do you understand me?
 
best regards

Message Edited by ElenaCapta on 07-13-2006 09:01 AM

Message Edited by ElenaCapta on 07-13-2006 09:03 AM

DevAngelDevAngel
Sure, makes sense and is quite common.

Code:
var output = "";
for ( var i=0; i<queryResult.records.length; i++) {
    var id, name;
    id = queryResult.records[i].get("Id");
    name = queryResult.records[i].get("Name");
    //Create an anchor tag to look like this:
    //<a href="/0030000001L45" target="_top">Case Name</a>

    output += "<a href='/" + id + "' target='_top'>" + name + "</a>";
    //Put a line break in to make the items go vertical
    output += <br>";

}
 

 

ElenaCaptaElenaCapta
Thank you very much!
 
But one question.. When I click on link if the ID = 50005500033RSr it should be go to this case but it add any charaters in the beginning and in the end. like this: %2050005500033RSrAAD. And not work...
 
Why does it happen? and do you know what can I do??
 
Thanks!!!

Message Edited by ElenaCapta on 07-14-2006 01:51 AM

AJ yorkshireAJ yorkshire

The %20 is added because you have a space in the URL you have created.

try www.whatever.com/ 2133 in you address bar and see what happens

you will see that the %20 is added before the 2133. (as a url can't contain a space)

To stop this from happening you can either:

1. try removing where the space is coming into your code (just after the /)

2. create the url slightley different. make a variable with the url in first. then add the / to the variable before using it in the hyperlink

var a=;

a= the id

a="/"id

then use (a) as the hyperlink. ##Hope this helps 

ElenaCaptaElenaCapta
THANKS!!! Already it works well!!:smileyvery-happy:
 
Best Regards and thank you very much!
 
Elena