• Crmzepher
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 12
    Replies

Hello,

 

I have a simple VF page that passes the Lead phone number to our VoIP server but I need to strip the numbers of special characters that are sometimes present.

 

for instance;
user entered (508) 457-5100
I need to change it to 5084575100
or they could of done it any number of ways. Like 508-457-5100 or 508 457 5100 or 1800+656+6555 etc. 
 

I know that that I have to create a loop that goes character by character to check to see if each character is a an integer or not  . .  . something like . . . onblur="this.value=this.value.replace(/[^\d]/g,'');" />

 

Would it be better to use the Apex code in the Controller for the VF page and then call on it or can I place it directly in the <script> that passes the phone number, ext, username?

 

Thanks for your help.

 

crmzepher

 

 

Hello,
 
Professional version with API
 
We have a custom button with exec javascript that validates a series of fields based on the user´s role before they can submit the Opp for approval by their Sales Mananger. All the standard validation works great and has been easy to access and program however I cannot figure out how to access the Opportunity Contact Role object from the native options within Salesforce to validate that a Role has been chosen, the Primary has been set, etc . . .
 
Futhermore there is no way create any valildation rules on the Opportunity Contact Role field directly or indirectly. For example if I wanted to create a validation rule on the Stage field that checks to see that the "Primary" contact has been chosen from all the contacts on the Opportunity Contact Role object when the Stage has been set to "Sold" there is no way to query the checkbox value on the "Primary" field.
 
What we want to accomplish is that no Sales Order goes forward without the "roles" of all the Opportunity Contact Roles being define and without a "Primary" chosen from all the contacts.
 
Does anyone have any ideas how this can be done?
 
thanks, crmzepher

Hi,

 

I'm still working my way through the documentation, but what I'd like to do is use navigateToUrl() to pop up a browser window with a SalesForce contact based on name, phone number, address, or whatever information I have available in my Ajax app.  Is that possible?

 

Thanks.

 

I have a custom object called Enrollment__c which has email field called notificationemail.I am triggering an email Alert through notificationemail field  on Enrollment__c all works fine but I want the triggered email should be some how tracked and record the activity on Enrollment__c object simalar to the HTML email Status on Accounts,I s there is a way that I can use the HTML Email status to keep track of notification emails

Hi all,

 

I read [url=http://community.salesforce.com/sforce/board/message?board.id=practices&thread.id=7994]this topic[/url] but I still dind't find any solution.

I need documentation to connect Saleforce.com to SAP R/3. I have a case open, they called me back, but I still cannot find any support.

 

Can you give me any links to get documentation I need?

 

Thanks a lot!

Can a record be assigned to another user as a task. As in the case of the Lead Assignments
Hi Everyone,

We imported all our data but accidentially mis-set the close date on our Closed Won opportunities.  Does anyone know if you can delete the stage history for Opportunities?  I've tried through the PHP API but receive "entity type cannot be deleted" when I try to delete the item.

Can we manually delete / massage our stage history or do we have to delete the entire Opportunity and re-add it.  That seems to be overkill just to purge the stage history and start fresh.

Thanks
-Dave
Hi,
 
I have been trying to solve this problem for a while, wondering if anyone can help me with this?
 
I have to put in a field in the opportunity screen that reflects the number of days since any activity was done for the opportunity.
Any activity done meaning the last modified date of the last activity associated to the opportunity. This can either be a task or an event. The idea is to check how long ago the activity was updated or created for this opportunity.
 
The tricky bit is that this is for the Group Edition and therefore no Apex or Ajax I believe?
 
I'm a newbie and have been trying this out but no luck?
 
Any help is greatly appreciated!
 
Many Thanks!
 
KC
  • April 28, 2008
  • Like
  • 0
I had a bit of fun building an S-Control using AJAX that shows Contacts with similar email addresses.

I've posted the code on the wiki if anyone is interested. Feedback/suggestions welcome.

John Rotenstein
Sydney, Australia
Hey all,
 
We've got a custom button on our Tasks and Events called 'Mark Complete' that executes the code below.  Is there a way to also remove or disable the reminder for the task at the same time?
 
Thanks!
Matt
 
Code:
{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")} 

var newRecords = []; 

var c = new sforce.SObject("Task"); 

c.id ="{!Task.Id}"; 
c.Status= "Complete"; 

// Reminder added by matt... 
//c.Reminder = 0; 

newRecords.push(c); 

result = sforce.connection.update(newRecords); 

window.location.reload();

 
 
Greetings All,

I am trying to update accounts using the WWW::Salesforce module in Perl, but I am not having any success.  I am able to query successfully and get results.  I can execute update commands without seeing errors, but the records never update.  For example:

-----------------------------
use WWW::Salesforce::Simple;
use SOAP::Lite;

print "Connecting to salesforce...\n";
my $sf = WWW::Salesforce->login( username => 'XX', password => 'XX' );
print "  Done.\n";

$sf::Constants::TYPES{Account}->{Account_Export__c} = 'xsd:boolean';

my $query = "SELECT id,Name,account_export__c, business_id__c, billingstate FROM Account WHERE id = '0014000000GNmKmAAL'" ;

print "Running query...\n";
my $result = $sf->query('query' => $query);
print "Loop results\n";

foreach my $elem ($result->valueof('//queryResponse/result/records'))
{
    @idstring = map{$_}(@{$elem->{id}});
     my ($id1, $id2) = splice(@{$elem->{Id}},0,2);
    print "QUERY RESULT: $elem->{id} $id1 : $elem->{Name} :  $elem->{BillingState}  : $elem->{Business_ID__c} : $elem->{Account_Export__c}\n";
   
    $uphash{type} = "Account";
    $uphash{id} = $id1;
    $uphash->{Name} = "WLV - Parasol Bar";
    $uphash->{"Account_Export__c"} = false;
   
    $upres = $sf->update(%uphash);
    print "UPDATE RESULT: $upres \n";
   
}

print "    Done.\n";


------

Here is the script output:
Connecting to salesforce...
  Done.
Running query...
Loop results
QUERY RESULT: ARRAY(0x1cd4ec8) 0014000000GNmKmAAL : Parasol Bar :  NV : a1234 : true
UPDATE RESULT: 1
    Done.

-------

So the update command returns 1, but the record does not actually get updated.  I have also tried hardcoding the id just for testing like this:
$uphash{id} = "0014000000GNmKmAAL";

because a number of posts I saw revolved around bad Ids, but it still does not work.  I am connecting as a Salesforce Administrator user and I checked all my rights so that should not be an issue.

Any assitance would be greatly appreciated.

Thanks,
Bob


Hi All!  I have the need to update the AMOUNT field in an Opportunity with a calculated field.  The Amount field is not natively a calculated field.  I searched for assistance in help and found a solution on the site (listed below).  This solution also had a word document attached that had the HTML required for this S-Control.  I did the following:
 
1.  I already had the calculated field called "Total Opportunity" created and it is working fine.
2.  I created the S-Control and pasted in the HTML from the solution I found.  I changed the field name in the HTML to my field name for Total Opportunity. (total_opportunity_value_c) in the code.
3.  I changed the page layout to embed the S-Control (and then tried a button, and then a customer link).
 
Unfortunately in all situations I did get a window saying "Updating Amount Field" (that's driven from the HTML) but it just hangs there and doesn't do anything.  My assumption is that it's an error in the HTML but, as me not being a coder, I can't debug.  Anyone out there able to quickly eyeball and see where there may be an issue? 
 
Also - is there a way for me to send the "fix", if I get one, back to SF.com so that this solution on their site is actually correct????
 
Thanks to all in advance!!!!!!
 
Here is the "solution" found on sf.com:
*********************************************************************************************
The definition behind the native Opportunity Amount field does not allow for the creation of a formula field. As a result, the amount field on opportunities cannot be a calculated value based upon other fields on the Opportunity record.

The Solution is as follows:

1. Create a custom field on the Opportunity to perform the requested calculation.
2. Create an S-Control that edits the Opportunity, placing the custom field's value (the one created in step 1) into the Amount field on the Opportunity.
3. Create a custom link or formula field (see below) that will invoke the S-Control when clicked.

- Sample code has been provided for the S-Control in Step 2 in the "Attachments" section of this record. (NOTE: Replace the merge field {!Opportunity_Requested_Price} in the provided code with the calculated field in your Opportunity configuration (step 1)).

- Additionally, the following is an example of a formula field that will invoke a given scontrol:

HYPERLINK("/servlet/servlet.Integration?lid=01N30000000D0vg&eid="&{!Id}, "Update" )
(NOTE: The record ID in the above should be replace the record ID of your S-Control, created in step 2).
**********************************************************************************************************************************
Here is the HTML (I did replace my calculated field name): 
 

Solution: Update Opportunity Amount Field With a Calculated Value

Owner: Chris Morgan

 
Process to create the S-Control discussed in Step 2 of this solution:
 <HTML> 
<HEAD>
<TITLE>Status...</TITLE>
</HEAD>
<center>
<table width="100%">
<tr>
<td align=center>
<span class="moduleTitle"><h4>Updating ''Amount'' field<Br>Please wait...</span>
</h4></td>
</tr>
<tr>
<td align=center>
<img src="/img/waiting_dots.gif" border="0" width=156 height=34>
</td>
</tr>
</table>
</center>

<script language="JavaScript">
setTimeout("",5000);
window.parent.opener.location="/{!Opportunity.Id}/e?retURL=%2F{!Opportunity.Id}&opp7={!Opportunity.total_opportunity_value__c}&save=1";
setTimeout("window.close();", 5000);
</script>
</HTML>
Hello Guys & Gals,
 
I thought I'd throw this out to the community as something that others might find useful.
 
I've had to implement this a number of times now - as no doubt some of you have already seen - there is no related list to show the opportunity contact roles for a 'contact'
 
This S-Control provides pretty much the same functionality.
 
Any suggestions to improve this are welcome... let me know if you find this useful.
 
Ben :)
 
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
<link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv"  rel="stylesheet" >
<link href="/dCSS/Theme2/default/custom.css" type="text/css" media="handheld,print,projection,screen,tty,tv"  rel="stylesheet" >

<html>
<head>
<script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/functions.js"></script>
<script>
function Init() {

   //////////////////////////////////////////////////////////////////////////////////////////////////
   //                                                
   //             Developed March 2008   
   //               by Ben Ingram                    
   //           beningram@hotmail.com              
   //  May be re-used or altered so long as the credit remains :)                                              
   //                                                
   //                                                
   //  This s-Control for salesforce.com provides  
   //  visibility of all oportunities for which a  
   //  contact is listed as an Opportunity Contact 
   //                                                
   //  To Implement this s-Control:
   //    1. Add a new s-Control of type HTML
   //    2. Insert this code (all) into the HTML Body of the new Control
   //    3. Name the control something appropriate such as 'Contact_Opportunity_Roles'
   //    4. Edit the appropriate page layout for 'Contacts'
   //    5. Create a 'new section' to contain this inline s-control
   //       I recommend immediately preceding the related list area
   //    6. Drag the s-control from the list on the right into your new section
   //    7. Set the properties of this s-control to set the height = 100
   //    8. Enjoy :)
   //    
   //////////////////////////////////////////////////////////////////////////////////////////////////

  try{

    // Query the SOQL to return the related OpportunityContact records, along with the parent Opportunity details as required
    var SearchString="Select Id, ContactId, Role, IsPrimary, OpportunityId, Opportunity.Name, Opportunity.StageName From OpportunityContactRole Where ContactId = '{!Contact.Id}' ";
    var queryResults = sforce.connection.query(SearchString);
    var queryRecords = queryResults.getArray('records');
    var txtOutput = ""

    if (queryRecords.length > 0){
 
      // Rows returned, so first setup the column headers (hard coded - potentially revise this)
      var txtOutput = "<table class='list' width='100%' border='0' cellspacing='0' cellpadding='0'>";
      txtOutput = txtOutput + "<tr class='headerRow' height=20>";
      txtOutput = txtOutput + "<th nowrap>Opportunity</th>";
      txtOutput = txtOutput + "<th nowrap>Stage</th>";
      txtOutput = txtOutput + "<th nowrap>Role</th>";
      txtOutput = txtOutput + "<th nowrap>Is Primary</th></tr>";

      // Next Loop through the result array (row by row)
      for (var i = 0; i < queryRecords.length; i++) {

        // queryRecord = the Current row within the array
        var queryRecord = queryRecords[i];

        // OppRecord = the sub array row containing the linked Opportunity details
        var OppRecord = queryRecord.get("Opportunity");

 // Now build the results output row by row 
        txtOutput = txtOutput + "<tr class='dataRow' onmouseover=hiOn(this) onmouseout=hiOff(this)>";
        txtOutput = txtOutput + "<td class='datacell'><a href='/"+ queryRecord.get("OpportunityId") +"' target=_parent>" + OppRecord.get("Name") + "</a></td>";
        txtOutput = txtOutput + "<td> "+ OppRecord.get("StageName") + "</td>";
        txtOutput = txtOutput + "<td> "+ queryRecord.get("Role") + "</td>";

 // Display the standard grid checkbox image (checked or unchecked as appropriate)
        if(queryRecord.get("IsPrimary")=="true"){
          txtOutput = txtOutput + "<td><img src='/img/checkbox_checked.gif' alt='Checked' width='21' height='16' class='checkImg' title='Checked' /></td></tr>";} else {
          txtOutput = txtOutput + "<td><img src='/img/checkbox_unchecked.gif' alt='Not Checked' width='21' height='16' class='checkImg' title='Not Checked' /></td></tr>";
        } // end if (queryRecord.get("IsPrimary")=="true")
      } //end of array loop

     // Get rid of ugly white box by filling the gap with empty space 
     if (queryRecords.length == 1){
 txtOutput = txtOutput + "</table>&nbsp;<br> &nbsp;<br> &nbsp;";
 }
     if (queryRecords.length == 2){
 txtOutput = txtOutput + "</table>&nbsp;<br> &nbsp;";
 }
     if (queryRecords.length > 2){
 txtOutput = txtOutput + "</table>"; 
 }
    } else { 
      // there were no rows returnd from the SOQL query - so build a message to inform the user that this contact is not related to any opportunities
      txtOutput=txtOutput + "<font face = 'Verdana' size = '2'>This Contact has no specified Opportunity Contact Roles</font><br> &nbsp;<br> &nbsp;<br> &nbsp;<br> &nbsp;<br> &nbsp;<br>";
    }
 
  // Substitute the div mainBody contents for the generated HTML content
  document.getElementById("mainBody").innerHTML = txtOutput;

  }
  catch (error)
    {
      alert(error.faultstring);
    }
 
  }

</script>
</head>

<body class='account' onload="Init();" >
  <div class="bPageBlock secondaryPalette" style="border-top:0px; border-bottom:0px; margin-bottom:0px; padding-bottom:0px">
    <div id="mainBody"  class=pbBody style="margin-right:0px">
    </div>
  </div>
</body>
</html>

 
Is there a way to prevent users from adding same product to the opportunity? We have a situation where users adding same product to the opportunity twice and want to avoid this.
 
Thank you in advance
  • March 03, 2008
  • Like
  • 0