• Nerv123
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 13
    Replies
Please help with your input....I have created a S-Control which will be hidden(height and width = 0) and put in System Information Section.
Accounts has a custom field called "Company_Number__c". This is an auto-number field
Opportunity has a custom field called "Account_Number__c". This is a text  field.
 
When a new opportunity is opened, either from Lead conversion process, pressing a button on accounts or from Creating a New Opportunity directly,
Account_Number__c should automatically inherit the value Company_Number__c from the related account on the opportunity.
 
My S-Control on Opportunity Page is attached below. Where am I going wrong? No value is being displayed in the Account_Number__c right now.
 
 
 

<script type="text/javascript" src="/soap/ajax/9.0/connection.js" > </script>

<script type="text/javascript" >

 var AccountDetails  = sforce.connection.query("select Company_Number__c from Account where Name = '{!Opportunity.AccountId}'");

 var AccountArray = AccountDetails.getArray("records");

var OpportunityRec =new sforce.SObject("Opportunity");

 OpportunityRec.Id="{!Opportunity.Id}";

 if(AccountDetails.size >0 {

 OpportunityRec.Account_Number__c = AccountArray[0].Company_Number__c;

 if(sforce.connection.update([OpportunityRec])[0].getBoolean("success"))

{

window.parent.location.href="{!URLFOR($Action.Opportunity.View, Opportunity.Id, null,true)}";

 }

else

{

alert("Problem in Updating the Company Number from Account to Opportunity"); }

}

</script>

 

Your help is appreciated!

Hello,
 
I have a situation wherein campaign members need to be generated based on conditions that combine Leads/Contacts with custom objects built, like Sales Orders and other such objects.
Is there a way to do this, or any appexchange product that anyone has used for a similar need?
 
Thanks in advance!

The situation is that an employee can submit time against several projects for a particular month/year.

 

Parent/Master Table: Key Staff Assignment

Fields: Project, Employee

 

Child/Detail Table: Assigning Project Time By Employee

Fields: Year, Month, Number of Days, Monthly Utilization of ALL Projects

 

When the Button “Recalculate Monthly Utilization” on the child Detail Page is clicked, then we have to assign a custom field,

Monthly Utilization of ALL Projects = Sum of All the Project records for that Employee for that month and year (thus, there should be an exact match on employee, month and year)

 

How do I write the Scontrol for this? I took the Scontrol from the cookbook for Rollup Summary fields and am trying to modify it with no success...can anyone take a look and help this newbie, please. This code does look like it is over-engineering a possibly simple solution, but I cant figure out how to work it.

 

<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/10.0/connection.js"></script>
<style>
.data {
 font-family:'Arial','Helvetica','sans-serif';
 font-size:12px;
 padding: 2px 0px;
 background-color: #F0F0F0;
}
</style>
<script type="text/javascript">
/* The getTotal() function contains all of the code that should
execute after the page is rendered. The function's
separation allows the query processing to be performed
asynchronously. */
function getTotal() {

 /* This establishes the state that you need when the callback is called. */
 var state = {
  output : document.getElementById("total"),
  /* This code is part of the standard AJAX toolkit code, but startTime is not used in this example. */
  startTime : new Date().getTime()
 };

 /* This is the callback handler, which tells the function what to do when the response from the query comes back. */
 var callback = {
  //call calculateResult if the request is successful
  onSuccess: calculateResults,
  //call queryFailed if the api request fails
  onFailure: queryFailed,
  source: state
 };

 /* This next call is the key to the function.
  The second argument is the callback handler. Since this code is part of an s-control, there's no need to
  log in to Salesforce before executing this call--the context is already established. Also notice the use of the
  Account.Id merge field, which is populated from the context of the page on which this s-control resides. */


 sforce.connection.query("SELECT Assigning_Project_Time_by_Employee__c.Number_of_Days__c, Name, Id FROM Assigning_Project_Time_by_Employee__c+
          " WHERE
dummyYear = Assigning_Project_Time_by_Employee__c.Year__c AND
dummyMonth = Assigning_Project_Time_by_Employee__c.Month__c AND
//Employee = '{!Assigning_Project_Time_by_Employee__c.ECS_Employee__c}' AND
Assigning_Project_Time_by_Employee__c.Number_of_Days__c <> 0",callback);
}


/* The calculateResults() function processes the results if the
query is successful. The first argument is the response from the
sforce query and the second argument is the handle to the state
variable which includes the section of the page to write to. */
function calculateResults(queryResult, source) {

 //Declare and initialize the variable that holds the total.
 var total = 0;

 //Assign the results of the query to an array.
 records = queryResult.getArray('records');

 //Iterate over the results and sum the total.
 for(var n in records) {
  var opp = records[n];
  //Add the current premium's amount to the running total.
  total += opp.getFloat('{!Assigning_Project_Time_by_Employee__c.Number_of_Days__c}');
//  total += opp.getFloat(Assigning_Project_Time_by_Employee__c.Number_of_Days__c);

 }

 //Get the appropriate currency symbol using the
 //getUserInfoResult utility call
 var guir = sforce.connection.getUserInfo();

 //Assign the value to the output area if there was no error.
 //The formatCurrency() function is called here (see "Formatting a Currency in an S-Control")
 //source.output.innerHTML = guir.currencySymbol + formatCurrency(total);

                     source.output.innerHTML = total;
}


//The queryFailed() function assigns an error message if the
//SOQL query failed.
function queryFailed(error, source) {
 source.output.innerHTML = "ERROR!";
 alert(error);
}
</script>

<!-- This syntax pulls in an s-control snippet that formats the
Javascript number into the appropriate currency display
(commas and 2 decimal places). See "Formatting a Currency in an S-Control" -->
 {!INCLUDE($SControl.Format_Number_as_Currency)}

</head>

<!-- The onLoad event calls the getTotal() function to process the
 calculation -->
<body onLoad="getTotal();">
 <!-- This element is initialized with an informational message which
 is asynchronously updated with the value we want. -->
 <div class="data" id="total">Loading...</div>
</body>
</html>

I need to have Territories assigned to the Opportunity based on the owner of the opportunity.
If the Opportunity Owner is changed using the "Change" option beside the field Owner in Opportunity, then the logic must include automatically changing the territory too, based on the territory assignment of the owner.
Where can I find the standard salesforce logic for "Change"?
If I cannot find it, any ideas on how I can achieve this complete logic with a single click?
 
Thanks So Much!
I have a situation where we need to continue maintaining the previous employment history of contacts under the contacts as and when they change companies/titles. Any ideas on how to do that automatically or otherwise? I suppose I can generate a related list or a button which populates another object, I was wondering if there are any best practices...
 
Your input, please.
I have a situation wherein if a field, X in Leads has a value >= 5, then a message has to be displayed automatically, without clicking on a button or link.
This is a simple message, not an error, nor related to a field update/email.
 
Please help.
 
Thanks!
I need to display an alert message on Save, if a field value in Leads, say X is greater than 5
 
If (Lead.X>5)
{
alert("Say Hi"")
}
 
Any clues for this newbie on how to do this? No emails, no fields to update, just a message...
 
Thanks so much!
Has anyone been able to use a WYSIWYG editor for the custom text area fields so as to maintain the expectancy when eventually the field data is published to their website?
Another newbie head-scratch!
 
Please help!
 
I have four fields in Lead object, TotalScore__c, Sector__c, State and ISR__c
I have three field in a table called ISR, namely, ISRSector__c, ISRState__c and ISRName__c
 
I need to write a Scontrol which has the following logic,
 
If the TotalScore__c > 5, then join the two tables based on the equality of Sector and State. Using the resultant record, set the Lead.ISR__c = ISR.ISRName__c
 
How can I achieve this?
 
Thanks In Advance!
Mike
I need to update Amount in Opportunities automatically with a custom field value "Estimated MRR", with API Name "Estimated_MRR__c". Any pointers on how to do this? I am new to salesforce, and trying to learn.
 
Thanks so much!
I have a SControl which has a return URL type with the following logic:
 
Leads have three fields, Physical State, Sector and ISR
Custom Object, Assignments, has three fields, State, Sector and ISR
 
If the two relevant fields(State and Sector) in both objects are the same value, then ISR in Leads must be made equal to ISR in Assignments
State and Sector are both picklists.
 
How do I do this? Please help
copyAddr('00N50000001NZQN', '00N50000001NZPH', '00N50000001NZQF', '00N50000001NZPz', '00N50000001NZP7', 'acc17street', 'acc17city', 'acc17zip', 'acc17country', 'acc17state', true, true)

I am trying to use the above as a Custom S-Control or a Button, but neither works.

Please help!
Please help with your input....I have created a S-Control which will be hidden(height and width = 0) and put in System Information Section.
Accounts has a custom field called "Company_Number__c". This is an auto-number field
Opportunity has a custom field called "Account_Number__c". This is a text  field.
 
When a new opportunity is opened, either from Lead conversion process, pressing a button on accounts or from Creating a New Opportunity directly,
Account_Number__c should automatically inherit the value Company_Number__c from the related account on the opportunity.
 
My S-Control on Opportunity Page is attached below. Where am I going wrong? No value is being displayed in the Account_Number__c right now.
 
 
 

<script type="text/javascript" src="/soap/ajax/9.0/connection.js" > </script>

<script type="text/javascript" >

 var AccountDetails  = sforce.connection.query("select Company_Number__c from Account where Name = '{!Opportunity.AccountId}'");

 var AccountArray = AccountDetails.getArray("records");

var OpportunityRec =new sforce.SObject("Opportunity");

 OpportunityRec.Id="{!Opportunity.Id}";

 if(AccountDetails.size >0 {

 OpportunityRec.Account_Number__c = AccountArray[0].Company_Number__c;

 if(sforce.connection.update([OpportunityRec])[0].getBoolean("success"))

{

window.parent.location.href="{!URLFOR($Action.Opportunity.View, Opportunity.Id, null,true)}";

 }

else

{

alert("Problem in Updating the Company Number from Account to Opportunity"); }

}

</script>

 

Your help is appreciated!

I have a situation where we need to continue maintaining the previous employment history of contacts under the contacts as and when they change companies/titles. Any ideas on how to do that automatically or otherwise? I suppose I can generate a related list or a button which populates another object, I was wondering if there are any best practices...
 
Your input, please.
I have a situation wherein if a field, X in Leads has a value >= 5, then a message has to be displayed automatically, without clicking on a button or link.
This is a simple message, not an error, nor related to a field update/email.
 
Please help.
 
Thanks!
Has anyone been able to use a WYSIWYG editor for the custom text area fields so as to maintain the expectancy when eventually the field data is published to their website?
Another newbie head-scratch!
 
Please help!
 
I have four fields in Lead object, TotalScore__c, Sector__c, State and ISR__c
I have three field in a table called ISR, namely, ISRSector__c, ISRState__c and ISRName__c
 
I need to write a Scontrol which has the following logic,
 
If the TotalScore__c > 5, then join the two tables based on the equality of Sector and State. Using the resultant record, set the Lead.ISR__c = ISR.ISRName__c
 
How can I achieve this?
 
Thanks In Advance!
Mike
I need to update Amount in Opportunities automatically with a custom field value "Estimated MRR", with API Name "Estimated_MRR__c". Any pointers on how to do this? I am new to salesforce, and trying to learn.
 
Thanks so much!
I have a SControl which has a return URL type with the following logic:
 
Leads have three fields, Physical State, Sector and ISR
Custom Object, Assignments, has three fields, State, Sector and ISR
 
If the two relevant fields(State and Sector) in both objects are the same value, then ISR in Leads must be made equal to ISR in Assignments
State and Sector are both picklists.
 
How do I do this? Please help
copyAddr('00N50000001NZQN', '00N50000001NZPH', '00N50000001NZQF', '00N50000001NZPz', '00N50000001NZP7', 'acc17street', 'acc17city', 'acc17zip', 'acc17country', 'acc17state', true, true)

I am trying to use the above as a Custom S-Control or a Button, but neither works.

Please help!
I am trying to add Opportunity Sales Team through Apex. Trigger works fine except "OpportunityAccessLevel" field.

Here is the error : Field is not writeable: OpportunityAccessLevel

If I insert the record without specifying the OpportunityAccessLevel = 'Read/Write'  , default values is getting assigned as OpportunityAccessLevel = 'Read Only'.  I need to assign value OpportunityAccessLevel = 'Read/Write' while adding sales team member.

Any workaround ?

Thanks

Pramod

  • March 24, 2008
  • Like
  • 0