• Lukdan
  • NEWBIE
  • 5 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 8
    Replies
I'm totally new to scontrols and java. I'm trying to insert this code right into the opportunity so it runs on page load and only once.
To stop the loop, I need an if statement placed inside comparing the 2 fields involved, but having no success...any suggestions on how or where to insert? Thanks in advance...

IF Code:
string Projecttext = "{!Opportunity.Project_Text__c}";
string Project = "{!Opportunity.Project__c}";

if ( Projecttext != Project )
{ 

 
Main Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js"
type="text/javascript"></script>
<script language="javascript">
<!--
function init()
{
sforceClient.registerInitCallback(doit);
sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
var ir = sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", true);
}


function goBack(Id)
{
var r = "{!Scontrol.URL}".split(/salesforce.com/);
var whichId = "";
if (Id != null) whichId = Id;
var returnUrl = r[0] + "salesforce.com/"+whichId;
window.parent.parent.location.href = returnUrl;
}

function doit()
{
var myCase = new Sforce.Dynabean("Opportunity");
myCase.set("Id", "{!Opportunity.Id}");
myCase.set("Project_Text__c", "{!Opportunity.Project__c}");

var saveResults = sforceClient.Update(myCase)[0];

if (Sforce.Util.dltypeof(saveResults) != "SaveResult" ||
saveResults.success == false ) {
alert("Error updating Case " + saveResults);
}

goBack("{!Opportunity.Id}");
}

</script>
</head>
<body onLoad="init();">
Updating Project Text....
</body>
</html>

 

  • April 04, 2007
  • Like
  • 0
I'm looking for a way to capture the text value of a lookup field in my opportunity page. The lookup field reads as a text value (acme auto), but is really a link. (the actual value of it is the ID of the custom object it points to) I want to use a validation rule against the text name of the lookup field..."Released" must be part of the name. Any ideas how to code this?

Ex.
AND(Construction_Appointment_Request__c<>NULL,
NOT(CONTAINS( Construction_Appointment_Request__c , "Released")))
The actual value of Construction_Appointment_Request__c is https://ssl.salesforce.com/a0100000000DPZH, so rule does not work.
Thanks in advance!


  • March 20, 2007
  • Like
  • 0
Hello!

I have an opportunity field ("Project") that is a lookup to a custom object ("Construction Appointment Request"). I want to use a validation rule for it. The problem is that the lookup field is actually a hyperlink and not text. The code below will not work:

AND(
Construction_Appointment_Request__c<>NULL,NOT(CONTAINS( Construction_Appointment_Request__c , "Released"))
)

The idea is to only allow the user to choose a record from the lookup that has "Released" as part of the name. Is there any slick way to get the hyperlink label and use that inside the validation rule?

If not, does anyone have any ideas how to restrict lookup field choices?

Thanks in advance!

Todd
  • March 16, 2007
  • Like
  • 0
Help...I need aging for picklist choices in a custom object. Any ideas how I can achieve this? Or does anyone have sample code for a basic S-Control to stamp a date when a particular picklist choice is selected in a custom object? I appreciate any feedback!
  • March 08, 2007
  • Like
  • 0
I'm totally new to scontrols and java. I'm trying to insert this code right into the opportunity so it runs on page load and only once.
To stop the loop, I need an if statement placed inside comparing the 2 fields involved, but having no success...any suggestions on how or where to insert? Thanks in advance...

IF Code:
string Projecttext = "{!Opportunity.Project_Text__c}";
string Project = "{!Opportunity.Project__c}";

if ( Projecttext != Project )
{ 

 
Main Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js"
type="text/javascript"></script>
<script language="javascript">
<!--
function init()
{
sforceClient.registerInitCallback(doit);
sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
var ir = sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", true);
}


function goBack(Id)
{
var r = "{!Scontrol.URL}".split(/salesforce.com/);
var whichId = "";
if (Id != null) whichId = Id;
var returnUrl = r[0] + "salesforce.com/"+whichId;
window.parent.parent.location.href = returnUrl;
}

function doit()
{
var myCase = new Sforce.Dynabean("Opportunity");
myCase.set("Id", "{!Opportunity.Id}");
myCase.set("Project_Text__c", "{!Opportunity.Project__c}");

var saveResults = sforceClient.Update(myCase)[0];

if (Sforce.Util.dltypeof(saveResults) != "SaveResult" ||
saveResults.success == false ) {
alert("Error updating Case " + saveResults);
}

goBack("{!Opportunity.Id}");
}

</script>
</head>
<body onLoad="init();">
Updating Project Text....
</body>
</html>

 

  • April 04, 2007
  • Like
  • 0

When a custom lookup relationship is created is the Id of the record chosen in the lookup available for use in an scontrol? For example, on our custom object Quote I have a lookup relationship called System Administrator which does a lookup to Contact. I wanted to use a S-Control to pull in additional information about the Contact chosen in this field but I do not seem to be able to access the Id so that I can retrieve more info. Any ideas how I could do this? in the case of my example The System_Administrator__c lookup field just contains that name of the Contact not the ID.

thanks for your help!

  I believe I need to "mirror" a look-up field in another field for reporting purposes and I can't figure out the right way to do it.

I have created a custom object that tracks enrollments in courses.  in this object I have several look-up fields to simplify things for users - essentially ensuring they not have to enter address info/contact info another time.  The look-up fields I have are for class participant (contact), class supervisor (contact), opportunity, and class (custom object). 

When I go to report on these objects, I can't get a report that gives me info from all the relationships.  However, I was thinking that if I could create a formula field that simply creates a mirror of the text in the look-up box, I could hide that and then get all the reporting I need.

Has anyone had success with something like this?

Thanks.
psf.
  • March 14, 2007
  • Like
  • 1
It's probably something stupid, simple validation rule that states only users with system admin profile can edit the field.  It doesn't work though and can't see what i'm doing wrong
 
Code:
AND(
   ISCHANGED( Basic_Price__c ),
      $Profile.Name <> "System Administrator"
)

 
Any suggestions would be greatly Appreciated
Help...I need aging for picklist choices in a custom object. Any ideas how I can achieve this? Or does anyone have sample code for a basic S-Control to stamp a date when a particular picklist choice is selected in a custom object? I appreciate any feedback!
  • March 08, 2007
  • Like
  • 0