• DevWannabe
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 19
    Replies
All of the following are custom objects except the Opportunity.  Opportunity, Quote, Quote Line Item, and Equipment.  Quotes are related to Opportunities, i.e. one Opp many Quotes.  Quote Line Item is a connector object between Quote and Equipment, i.e. Quote can have multiple pieces of Equipment and Equipment can be on mulitple Quotes.  Once a Quote is accepted all of the Equipment on the Quote Line Items need to be connected directly to a Quote, i.e. there is a lookup on the Equipment to the Quote that is empty until this time.  Any other Quote on the same Opportunity that has any Equipment connected through the Quote Line Item that was on the accepted Quote needs to be set to Canceled.  I have a flow that this actually works, but running into query limits as there are fast lookups within loops and loops within loops and trying to figure out a way around that.  Any help/guidance would be great.

I need to count records as they are created and base that count on a field in a separate object.  Sales records are used to capture details of each sale.  Sales Tracker records are used to capture the count for a certain sales person who is linked to both records as a contact through a lookup.  So when a Sales record is created it searches for the Sales Tracker record with the same sales person listed in the lookup to the contact object.  I need to be able to add the id of the Sales Tracker record to the Sales record, pull the sales count from the Sales Tracker record, increment it by one, write it to the Sales record and Sales Tracker record.  I don't even know where to start so any help would be greatly appreciated.

I have built a custom object that attaches two accounts together, similar to the Parent Account function, but allows to add details about the relationship.  I set it up as a M-D to Accounts, so there is a Master (Parent) Account on this record and a lookup (Child) to another Account on this record along with other fields that detail the type of relationship between the two Accounts.  What I would like to do is show all the Contacts on the "Child" Accounts that are related to the "Parent" Account on that Accounts detail page.  My thought was to create a VF page and put it in a section on the Account detail page that shows this list/report, but I am having trouble figuring out how to get the necessary data in there.  I would like it in the following format if possible...

 

Relationship Type       Account Name

    Contact name        Contact Phone    Contact Email

 

Buyer      ACME

  John Smith     111-222-3333    johnsmith@acme.com

  Jane Smith     111-222-4444    janesmith@acme.com

Seller     RoadRunner Inc.

  Blue Bird        333-333-4444    bluebird@rrinc.com

  Fast Bird        333-333-9999    fastbid@rrinc.com

 

 

So, effectively you are interating over the custom object on an Account to list all those records and some details from those records and then iterate over the contacts from the accounts on each of those records.  Any guidance would be greatly appreciated...

I have a button that creates a new record using javascript and will bring that new record up in edit mode, but it commits the record to the database prior to bringing it up in edit mode.  Is there a way to do this without committing the record to the database in case the user would like to cancel the creation or make additional manual changes to the record?  I have also been able to do the same function with a URL hack where it doesn't commit the record and brings it up in edit mode like a normal NEW button would.  However, there are some limitations to using the URL that I would like to avoid with the JavaScript button, but can't seem to get it to work without committing the record.

I have a button on the task object that closes the task by clicking the button intead of having to edit the task, change the status to Completed and save the task.  However, I would like to validate who is closing the task based on the current user and owner of the task.  So, does anyone know a way to compare the Current User to the Task.OwnerId?  I know how to structure it based on the result using an IF statement, but can't seem to find the right comparison.

 

I have tried to do...

If(Task.OwnerId <> "{!User.Id}"){
 alert("You have insufficient privileges to change this task.")
 }
 else
 {
 perform function...

 I have tried different permutations of the "not equal" and still can't get past this point.

I need to be able to create a pdf attachment on a contact record that will merge fields from that contact record and then attach it to an email to send to that contact and record that email in the activity history on that contact.  Ideally this would be done by pressing a button on the contact record.

 

Any suggestions????

I have written a trigger on Contacts that sends an email to that contact and references an email template that has a Visualforce page redered as a pdf as an attachment.  I am trying to pass values from the contact into the VF page that is being attached, but when I try it none of the fields get put in there.  Here is my trigger...

trigger MCR on Contact (after update) {

List<id> clist=New List<id>();
id crecord=trigger.new[0].id;

for(contact c:trigger.new){

 if(c.M_C_R__c==true)
   clist.add(c.id);
 }
 
 List<contact> c=[Select id, accountid From contact Where ID IN: clist];
 
  for ( contact csend:c){
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    mail.setTargetObjectId(csend.id);
    mail.setTemplateId('00Xd0000000PA6n');
    mail.setWhatId(csend.accountid);
    mail.saveAsActivity = true;
    Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
  }
}

 The email goes out with the attachment and it gets put in the Contact Record's Activity History related list, but when I open the attachment in the email none of the fields from that Contact Record are inserted.  If it's not in the code, then it might be how I am referencing the fields in the VF page.  I am using {!Contact.Name} to try and pull in the name of the contact among other things, but that gives you an idea.

 

Any help is greatly appreciated...

Is it possible to create a task in Google from within SFDC?  Like when a Projected effective date is set on an opportunity it does the following...

  • Creates a task in Google with the "Opp Name - Projected Effective Date" as the task name
  • Puts the Projected Effective Date in as the Task Due Date
  • Anytime that PED field is updated it updates the task in google accordignly
  • When the Opportunity is closed it closes the task

At a minimum I would like to be able to do the first two.  The last two would be nice to have, but not necessary to accomplish what I am looking for.

All of the following are custom objects except the Opportunity.  Opportunity, Quote, Quote Line Item, and Equipment.  Quotes are related to Opportunities, i.e. one Opp many Quotes.  Quote Line Item is a connector object between Quote and Equipment, i.e. Quote can have multiple pieces of Equipment and Equipment can be on mulitple Quotes.  Once a Quote is accepted all of the Equipment on the Quote Line Items need to be connected directly to a Quote, i.e. there is a lookup on the Equipment to the Quote that is empty until this time.  Any other Quote on the same Opportunity that has any Equipment connected through the Quote Line Item that was on the accepted Quote needs to be set to Canceled.  I have a flow that this actually works, but running into query limits as there are fast lookups within loops and loops within loops and trying to figure out a way around that.  Any help/guidance would be great.
I have performed a fast lookup and retrieved a list of objects. I need to make a decision based on the number of records returned - can I do this with a formula instead of having to use a loop to count the records?
Hello,

I understand there isn't a standard function in SF to update a child record type based on the parent object record type. Does anyone have any example I can use to do this with a trigger? What I would like to do is, if the parent record type is changed, then the child Task record type changes as well. Any help would be appriecated! Thanks.

I need to count records as they are created and base that count on a field in a separate object.  Sales records are used to capture details of each sale.  Sales Tracker records are used to capture the count for a certain sales person who is linked to both records as a contact through a lookup.  So when a Sales record is created it searches for the Sales Tracker record with the same sales person listed in the lookup to the contact object.  I need to be able to add the id of the Sales Tracker record to the Sales record, pull the sales count from the Sales Tracker record, increment it by one, write it to the Sales record and Sales Tracker record.  I don't even know where to start so any help would be greatly appreciated.

I have a button that creates a new record using javascript and will bring that new record up in edit mode, but it commits the record to the database prior to bringing it up in edit mode.  Is there a way to do this without committing the record to the database in case the user would like to cancel the creation or make additional manual changes to the record?  I have also been able to do the same function with a URL hack where it doesn't commit the record and brings it up in edit mode like a normal NEW button would.  However, there are some limitations to using the URL that I would like to avoid with the JavaScript button, but can't seem to get it to work without committing the record.

Hi there!

 

We currently use Salesforce Enterprise. I have my contacts and one of the fields I'm trying to add is a "Nominated By" field.

 

In a perfect world I would love for us to be able to add a new record, lookup a contact in the "Nominated By" field, select a name and then have it load into the Relationship section in each person's (the new record of the nominee and nominator's) record. 

 

Does anyone know how to do this? I've tried adding a new field under "LookUp." When I select contacts, it loads the nominee into the nominator's contacts. When I select Relationship, the search function only allows you to see the relation ship numbers (R-#####). 

 

Any advice would be greatly appreciated!

 

Thank you,

Jillian

 

I have a button on the task object that closes the task by clicking the button intead of having to edit the task, change the status to Completed and save the task.  However, I would like to validate who is closing the task based on the current user and owner of the task.  So, does anyone know a way to compare the Current User to the Task.OwnerId?  I know how to structure it based on the result using an IF statement, but can't seem to find the right comparison.

 

I have tried to do...

If(Task.OwnerId <> "{!User.Id}"){
 alert("You have insufficient privileges to change this task.")
 }
 else
 {
 perform function...

 I have tried different permutations of the "not equal" and still can't get past this point.

I am struggling creating a web to lead form through salesforce that both works and looks good.  I am using the coding generated through salesforce's web to lead and then adding code to make it look better but three fields are not syncing properly.  The three fields that are not syncing are date of session, cost of session and birthday #4.  Below is the coding.  Could you please help me locate the error in this so I can get my database going?  Thanks!

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Julie Marwood | Web Leads</title>
    <meta name="author"	content="Turton Consulting Inc." />
    <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
    <script language="JavaScript" src="js/calendar_us.js" type="text/javascript"></script>
    <link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="css/calendar.css" />
    <script src="js/prototype.js" type="text/javascript"></script>
    <script src="js/scriptaculous.js" type="text/javascript"></script>
    <script src="js/webleads.js" type="text/javascript"></script>
</head>
<body onload="$(office_information).hide();">
<center>
<form name="frmWebLeads" id="frmWebLeads" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
<input type="hidden" name="oid" value="00Dd0000000dJa7" />
<input type="hidden" name="retURL" value="http://juliemarwood.com/" />
<input type="hidden" name="toggleval" id="toggleval" value="0" />
<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--<input type="hidden" name="debug" value="1" />-->
<!--<input type="hidden" name="debugEmail" value="jmpmarwood@gmail.com" /> -->
<!--<input type="hidden" name="debugEmail" value="guy.turton@gmail.com" /> -->
<!--  ----------------------------------------------------------------------  -->
<table cellpadding="5px" cellspacing="0" border="0" class="contactForm" style="text-align:left;width:620px;">
<tr>
<td colspan="4" class="webLeadsTitle">Client Information:</td>
</tr>
<tr>
<td id="tdFirstName">First Name:</td>
<td><input id="first_name" maxlength="40" name="first_name" size="20" type="text" class="webLeadsCapitals" /> <span class="error">*</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td id="tdLastName">Last Name:</td>
<td><input id="last_name" maxlength="80" name="last_name" size="20" type="text" class="webLeadsCapitals" /> <span class="error">*</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td id="tdSpouceName">Spouse&#39;s Name:</td>
<td><input id="spoucename" maxlength="30" name="00Nd0000003dwh0" size="20" type="text" class="webLeadsCapitals" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td id="tdEmail">Email:</td>
<td><input id="email" maxlength="80" name="email" size="20" type="text" /> <span class="error">*</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td id="tdHomePhone">Home Phone:</td>
<td><input id="00Nd0000003dzCb" maxlength="40" name="00Nd0000003dzCb" size="20" type="text" onkeydown="javascript&colon;backspacerDOWN(this,event);" onkeyup="javascript&colon;backspacerUP(this,event);" /> <span class="error">*</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Cell Phone:</td>
<td><input id="00Nd0000003dzgY" maxlength="40" name="00Nd0000003dzgY" size="20" type="text" onkeydown="javascript&colon;backspacerDOWN(this,event);" onkeyup="javascript&colon;backspacerUP(this,event);" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Work Phone:</td>
<td><input id="00Nd0000003dzQC" maxlength="40" name="00Nd0000003dzQC" size="20" type="text" onkeydown="javascript&colon;backspacerDOWN(this,event);" onkeyup="javascript&colon;backspacerUP(this,event);" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td id="tdAddress" style="vertical-align:top;">Address:</td>
<td colspan="3" style="vertical-align:top;"><textarea id="street" name="street" rows="3" cols="20" class="webLeadsCapitals"></textarea> <span class="error">*</span></td>
</tr>
<tr>
<td id="tdCity">City:</td>
<td><input id="city" maxlength="40" name="city" size="20" type="text" class="webLeadsCapitals" /> <span class="error">*</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td id="tdProvince">Province:</td>
<td><input id="state" maxlength="20" name="state" size="20" type="text" class="webLeadsCapitals" /> <span class="error">*</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td id="tdPostalCode">Postal Code:</td>
<td><input  id="zip" maxlength="7" name="zip" size="20" type="text" class="webLeadsAllCaps" /> <span class="error">*</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1. Child&#39;s Name:</td>
<td><input id="00Nd0000003dwmi" maxlength="30" name="00Nd0000003dwmi" size="20" type="text" class="webLeadsCapitals" /></td>
<td>Date of Birth:</td>
<td style="white-space:nowrap;">
<input id="00Nd0000003dwms" name="00Nd0000003dwms" size="12" type="text" />
<script language="JavaScript" type="text/javascript">
new tcal({
'formname': 'frmWebLeads',
'controlname': '00Nd0000003dwms'
});
</script>
</td>
</tr>
<tr>
<td>2. Child&#39;s Name:</td>
<td><input id="00Nd0000003dwjz" maxlength="30" name="00Nd0000003dwjz" size="20" type="text" class="webLeadsCapitals" /></td>
<td>Date of Birth:</td>
<td style="white-space:nowrap;">
<input id="00Nd0000003dwl7" name="00Nd0000003dwl7" size="12" type="text" />
<script language="JavaScript" type="text/javascript">
new tcal({
'formname': 'frmWebLeads',
'controlname': '00Nd0000003dwl7'
});
</script>
</td>
</tr>
<tr>
</tr>
<tr>
<td>3. Child&#39;s Name:</td>
<td><input id="00Nd0000003dwlv" name="00Nd0000003dwlv" size="30" type="text" class="webLeadsCapitals" /></td>
<td>Date of Birth:</td>
<td style="white-space:nowrap;">
<input id="00Nd0000003dwmx" name="00Nd0000003dwmx" size="12" type="text" />
<script language="JavaScript" type="text/javascript">
new tcal({
'formname': 'frmWebLeads',
'controlname': '00Nd0000003dwmx'
});
</script>
</td>
</tr>
<tr>
<td>4. Child&#39;s Name:</td>
<td><input id="00Nd0000003dwk4" name="00Nd0000003dwk4" size="30" type="text" class="webLeadsCapitals" /></td>
<td>Date of Birth:</td>
<td style="white-space:nowrap;">
<input id="00Nd0000003dwn2" name="00Nd0000003dwn2" size="12" type="text" />
<script language="JavaScript" type="text/javascript">
new tcal({
'formname': 'frmWebLeads',
'controlname': '00Nd0000003dwn2'
});
</script>
</td>
</tr>
<tr>
<td style="vertical-align:top;" id="tdHowDidYouHear">How did you hear about me?</td>
<td colspan="3" style="vertical-align:top;">
<select id="00Nd0000003dzM5" multiple="multiple" name="00Nd0000003dzM5" title="How did you hear about me?"><option value="Internet">Internet</option>
<option value="Synergea">Synergea</option>
<option value="From Here Through Maternity Book">From Here Through Maternity Book</option>
<option value="Facebook">Facebook</option>
<option value="The Birthing Magazine">The Birthing Magazine</option>
<option value="Friend">Friend</option>
<option value="Other">Other</option>
</select>
<span class="error">*</span>
</td>
</tr>
<tr>
<td id="tdReferredBy">Referred by:</td>
<td><input id="00Nd0000003dzRJ" maxlength="30" name="00Nd0000003dzRJ" size="20" type="text" class="webLeadsCapitals" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td style="vertical-align:top;">Permission for Use:</td>
<td colspan="3">
<input id="00Nd0000003dzQg" name="00Nd0000003dzQg" type="checkbox" value="1" checked="checked" /><br />
Thank you for choosing me as your photographer.<br />
I would like to ask your permission to use these images for portfolio and/or marketing purposes<br />
for business affiliated with Julie Marwood Photography.
</td>
</tr>
<tr>
<td>Interested in Custom Framing:</td>
<td><input  id="00Nd0000003eiaC" name="00Nd0000003eiaC" type="checkbox" value="1" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="4"><br /></td>
</tr>
<tr>
<td colspan="4" class="webLeadsTitle"><a href="#" title="Up" onclick="Toggle();">Office Information:</a></td>
</tr>
</table>
<div id="office_information">
<div>
<table cellpadding="5px" cellspacing="0" border="0" class="contactForm" style="text-align:left;width:620px;">
<tr>
<td>Date of Photo Session:</td>
<td style="white-space:nowrap;">
<input id="00Nd0000003dwnl" name="00Nd0000003dwnl" size="12" type="text" />
<script language="JavaScript" type="text/javascript">
new tcal({
'formname': 'frmWebLeads',
'controlname': '00Nd0000003dwnl'
});
</script>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Reference Number:</td>
<td><input id="00Nd0000003dzLq" maxlength="10" name="00Nd0000003dzLq" size="20" type="text" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Prenatal Due Date:</td>
<td style="white-space:nowrap;">
<input id="00Nd0000003dwnW" name="00Nd0000003dwnW" size="12" type="text" />
<script language="JavaScript" type="text/javascript">
new tcal({
'formname': 'frmWebLeads',
'controlname': '00Nd0000003dwnW'
});
</script>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Cost of Session:</td>
<td>
<input id="00Nd0000003dzgE" name="00Nd0000003dzgE" type="text" />
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Type of Session:</td>
<td>
<select id="00Nd0000003dzgO" name="00Nd0000003dzgO" title="Type of Session"><option value="">--None--</option><option value="Newborn">Newborn</option>
<option value="Prenatal">Prenatal</option>
<option value="Baby">Baby</option>
<option value="Family">Family</option>
<option value="Corporate">Corporate</option>
</select>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Payment Schedule:</td>
<td><input  id="00Nd0000003eigG" maxlength="50" name="00Nd0000003eigG" size="20" type="text" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td style="vertical-align:top;">Final Order:</td>
<td colspan="3" style="vertical-align:top;">
<textarea  id="00Nd0000003dzg4" name="00Nd0000003dzg4" cols="30" rows="4"></textarea>
</td>
</tr>
<tr>
<td style="vertical-align:top;">Additional Information About Client:</td>
<td colspan="3" style="vertical-align:top;"><textarea id="00Nd0000003e5QB" name="00Nd0000003e5QB" rows="5" cols="30"></textarea></td>
</tr>
<tr>
<td colspan="4" style="text-align:center;">
<input type="button" name="btnSubmit" title="Submit" value="submit" onclick="JavaScript&colon;ValidateAndSubmit();return false;" />
</td>
</tr>
</table>
</div>
</div>
</form>
</center>
</body>
</html>

I need to be able to create a pdf attachment on a contact record that will merge fields from that contact record and then attach it to an email to send to that contact and record that email in the activity history on that contact.  Ideally this would be done by pressing a button on the contact record.

 

Any suggestions????

I have written a trigger on Contacts that sends an email to that contact and references an email template that has a Visualforce page redered as a pdf as an attachment.  I am trying to pass values from the contact into the VF page that is being attached, but when I try it none of the fields get put in there.  Here is my trigger...

trigger MCR on Contact (after update) {

List<id> clist=New List<id>();
id crecord=trigger.new[0].id;

for(contact c:trigger.new){

 if(c.M_C_R__c==true)
   clist.add(c.id);
 }
 
 List<contact> c=[Select id, accountid From contact Where ID IN: clist];
 
  for ( contact csend:c){
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    mail.setTargetObjectId(csend.id);
    mail.setTemplateId('00Xd0000000PA6n');
    mail.setWhatId(csend.accountid);
    mail.saveAsActivity = true;
    Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
  }
}

 The email goes out with the attachment and it gets put in the Contact Record's Activity History related list, but when I open the attachment in the email none of the fields from that Contact Record are inserted.  If it's not in the code, then it might be how I am referencing the fields in the VF page.  I am using {!Contact.Name} to try and pull in the name of the contact among other things, but that gives you an idea.

 

Any help is greatly appreciated...

I've been round-and-round with this one.  All I'm trying to do is create an AccountTeamMember object and then use sforceService.create() to add it.   I can do it if I don't set AccountAccessLevel = "Edit".  If I don't, AccountAccessLevel is set by default to "Read". The problem is, I want AccountAccessLevel to be "Edit".  If I set AccountAccessLevel = "Edit", then when I execute the create() method the following exception is thrown:

 

Unable to create/update fields: AccountAccessLevel. Please check the security settings of this field and verify that it is read/write for your profile.

 

I've tried everything to remedy this situation, including setting the API user to the top role of the company (CEO), making the API user the owner of the account, checking every capability in the API user's profile, and creating account sharing rules.  Nothing makes a difference.  In fact, I can log in as the API user and create AccountTeamMembers with "Edit" access at Salesforce.com-- just not with the API. 

 

Has anyone been able to do this?  Please help.

  • September 29, 2011
  • Like
  • 0

Hello:

 

I am creating a list button to mass create new opportuies based on records from a custom object.  I am in a bind to get this into production early next week and would appreciate the communities help...

 

We have a policy sales record (PSR) custom object  and need to create renewal opportunities from selected records in a policy sales record  list view.  I have very little Javascript knowledge but using several postings from the boards & blogs I came up with the following code that throws the following error after selecting the policies in the view and clicking on the button to execute.  

 

When clicking onthe button we want to create new opportunities of a specific record type and prepopulate sevaral key records from the values on the policy sales record.

 

 

Error message in a windows  dialog box:
A problem with the OnClick JavaScript for this button or link was encountered:
unterminated string literal
I have reviewed the code and cannot find where these error seems to be coming from as the code in my limited knowledge seem properly formed.
Also, I am not sure if the insert portion is the correct syntax for Javascript to push the insert of the new records.

 

 

Here is the code for my button:

 

 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}    //adds the proper code for inclusion of AJAX toolkit
var url = parent.location.href;    //string for the URL of the current page
var records = {!GETRECORDIDS($ObjectType.Policy_Sales_Record__c)};    //grabs the Policy Sales Records records that the user is requesting to update
var CreateNewRecords = [];    //array for holding records that this code will ultimately update

if (records[0] == null) { //if the button was clicked but there was no record selected
	alert("Please select at least one record to update.");    //alert the user that they didn't make a selection 
} else {   //otherwise, there was a record selection
	for (var a=0; a<records.length; a++) {    //for all records
		var create_new_opportunity = new sforce.SObject("opportunity");    //create a new sObject for storing updated record details
		create_new_opportunity.RecordTypeId = "012A0000000R4UX";    //set the record type to Renewal Opportunities
		create_new_opportunity.AccountId = "{!Policy_Sales_Record__c.Account__c}";    //set the account ID value from PSR 
		create_new_opportunity.Closedate = "{!Policy_Sales_Record__c.Policy_Renewal_Date__c}";     //set the value for renewal date from policy data
		create_new_opportunity.OwnerId = "{!Policy_Sales_Record__c.Account_Owner__c}";    //set the value for account owner
		create_new_opportunity.Primary_Producer__c = "{!Policy_Sales_Record__c.Producer__c}";    //set the value for the producer
		create_new_opportunity.Renewal_Base_Premium__c = "{!Policy_Sales_Record__c.Renewal_Base_Premium__c}"
		create_new_opportunity.Renewal_Base_No_of_Contracts__c = {!Policy_Sales_Record__c.Renewal_Base_No_of_Contracts__c}";

		CreateNewRecords.push(create_new_opportunity);   //add the updated record to our array
	}
	result = sforce.connection.insert(CreateNewRecords);    //insert new records into to Salesforce
	parent.location.href = url; //refresh the page
}

 

 

Regards and thanks in advance

 

Quique

 

Hi,

 

I'm unable to update the Status(PIMS__Status__c) field of a custom Incentive object (PIMS__Incentive__c) with the value "Complete"

 

i am able to retrieve the record IDs for the Incentive Object sucessfully but am unable to retrieve the value of the Status field for the record id in the loop. 

how do i get the value for a field besides the id on a custom object? am i supposed to use a select statement or the get method.  i don't seem to be using the get method correctly.

 

 

--------------------------

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}

var userList = {!GETRECORDIDS($ObjectType.PIMS__Incentive__c )}
var updatedList = [];

if (userList[0] == null) {
         alert("Please select at least one record.") }
else {
          var answer = confirm("Are you sure?");          
          if (answer==true) {
                  
                  for (var n=0; n<userList.length; n++) {
                          var i = new sforce.SObject("PIMS__Incentive__c");                                              
                          i.id = userList[n];

                           var cs = i.get("PIMS__Status__c");
                          alert("ID =  " + i.id + i.PIMS__Status__C + cs );    
                      
                        
//                        only update records where current status is Pending Payment
                          if (i.PIMS__Status__c == "Pending Payment") {
                                alert("You have selected " + userList.length + " records");
                                 i.PIMS__Status__c = "Complete";
                                 updatedList.push(i);                    
                          }
                  }               
                 result = sforce.connection.update(updatedList);
                 window.location.reload();
                 alert("Status set to Complete for all records with current status Pending Payment")
          }
}

  • September 15, 2010
  • Like
  • 0