-
ChatterFeed
-
2Best Answers
-
0Likes Received
-
0Likes Given
-
9Questions
-
13Replies
Issue with a basic trigger
So this is my first trigger going into production. I've gone through the workbooks but I have come to a stop as I'm not sure where I'm going wrong. With the trigger I'm trying to populate a lookup field on the opportunity with the current account owner that is associated to the opportunity.
Here is the code:
trigger AccountOwner on Opportunity (after update) { //update opportunity with current account owner List<Opportunity> AccountOwner = [SELECT Account.OwnerId, Acct_Owner__c FROM Opportunity FOR UPDATE]; for (Opportunity o: AccountOwner){ if(o.Acct_Owner__c <> Account.OwnerId){ o.Acct_Owner__c=Account.OwnerId; } } update AccountOwner; }
I'm getting a compile error at line 9 column 9 Illegal assignment from Schema.SObjectField to Id.
Suggestions/ help? It doesn't have to be a look up field, it can be changed to text if that is the issue.
thanks,
-
- JJJenkins
- May 22, 2011
- Like
- 0
- Continue reading or reply
Insert Date Values
How to insert valuse of Date datatype in Database ?
I used all the things 'YYYY-MM-DD' , 'DD-MM-YYYY' , DD-MM-YYYY
General error is :
Illegal conversion from String to Date or Integer to Date...
Please help me by query that How will I insert the values....
-
- sangeeta.marathe@Futurewise.co
- May 21, 2011
- Like
- 0
- Continue reading or reply
Send ID to controller for single row of dataTable
Having some issues figuring this one out. This is what i need:
- Display a table, reach row displaying id, username, and a command button
- When the command button is clicked, take the ID of the record on that row and send it to a method on the controller where it will be output using a system.debug.
Visualforce
<apex:page controller="vftest"> <apex:form > <apex:pageBlock > <apex:dataTable value="{!TestUsers}" var="tu"> <apex:column headerValue="Id"> <apex:inputField value="{!tu.Id}"/> </apex:column> <apex:column headerValue="UserName"> <apex:inputField value="{!tu.UserName}"/> </apex:column> <apex:column> <apex:commandButton action="{!TestParams}" value="TestParam"> <apex:param name="testuser" value="{!tu.UserName}"/> </apex:commandButton> </apex:column> </apex:dataTable> </apex:pageBlock> </apex:form> </apex:page>
Class
public class vftest { string selected_user; public List<User> getTestUsers() { List<User> testuserlist = [select id, username from user where user_type__c = 'Test']; return testuserlist; } public void TestParams() { Id id1 = ApexPages.currentPage().getParameters().get('testuser'); system.debug('-----------------tp-id1-------------------' + id1); Id id2 = System.currentPageReference().getParameters().get('testuser'); system.debug('-----------------tp-id2-------------------' + id2); } }
Any help would be appreciated.
-
- wkuehler
- October 25, 2010
- Like
- 0
- Continue reading or reply
Excel SOQL_Table formula issue
-
- wkuehler
- April 10, 2008
- Like
- 0
- Continue reading or reply
Return after delete
-
- wkuehler
- March 27, 2007
- Like
- 0
- Continue reading or reply
Query deleted by
var queryResult = sforce.connection.queryAll("Select Id, Name, DeletedBy from Lead where IsDeleted = true");
-
- wkuehler
- January 25, 2007
- Like
- 0
- Continue reading or reply
trouble with Dynabean
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script src="http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script> <script language="JavaScript1.2"> function updateaccountinfo() { var updateObjects = new Array(); var accountinfo = new Sforce.Dynabean("account"); accountinfo.set("Id", "{!Account_ID}"); accountinfo.set("Phone", "555555"); updateObjects.push(accountinfo); var update = sforceClient.Update(updateObjects); //window.parent.parent.location.href = '../setup/own/entityowneredit.jsp—retURL=../../home/home.jsp&id={!Account_ID}&p2=Bob Tester&save=1'; } </script> </head> <body onload="updateaccountinfo()"> </body> </html>
Message Edited by wkuehler on 05-30-2006 07:22 PM
Message Edited by wkuehler on 05-31-2006 05:57 AM
-
- wkuehler
- May 30, 2006
- Like
- 0
- Continue reading or reply
User lookup dependant on the user title field
For example, all of our account managers and sales people are Salesforce users. Each account will have an account manager and a sales person assigned. I would like to have the Account Manager lookup display only the users with "Account Manager" as their title, and the Salesperson lookup display only the users with "Salesperson" as their title.
Any ideas?
-
- wkuehler
- May 19, 2006
- Like
- 0
- Continue reading or reply
S-Control to display my accounts
Is an S-control the best approach here? If so, any info to get me started would be appreciated.
Thanks
Wkuehler
-
- wkuehler
- May 10, 2006
- Like
- 0
- Continue reading or reply
SForce excel connector error
describeBox_init: wild_error
-
- wkuehler
- January 30, 2006
- Like
- 0
- Continue reading or reply
Request to delete account
Any ideas?
-
- wkuehler
- December 08, 2005
- Like
- 0
- Continue reading or reply
Issue with a basic trigger
So this is my first trigger going into production. I've gone through the workbooks but I have come to a stop as I'm not sure where I'm going wrong. With the trigger I'm trying to populate a lookup field on the opportunity with the current account owner that is associated to the opportunity.
Here is the code:
trigger AccountOwner on Opportunity (after update) { //update opportunity with current account owner List<Opportunity> AccountOwner = [SELECT Account.OwnerId, Acct_Owner__c FROM Opportunity FOR UPDATE]; for (Opportunity o: AccountOwner){ if(o.Acct_Owner__c <> Account.OwnerId){ o.Acct_Owner__c=Account.OwnerId; } } update AccountOwner; }
I'm getting a compile error at line 9 column 9 Illegal assignment from Schema.SObjectField to Id.
Suggestions/ help? It doesn't have to be a look up field, it can be changed to text if that is the issue.
thanks,
- JJJenkins
- May 22, 2011
- Like
- 0
- Continue reading or reply
Insert Date Values
How to insert valuse of Date datatype in Database ?
I used all the things 'YYYY-MM-DD' , 'DD-MM-YYYY' , DD-MM-YYYY
General error is :
Illegal conversion from String to Date or Integer to Date...
Please help me by query that How will I insert the values....
- sangeeta.marathe@Futurewise.co
- May 21, 2011
- Like
- 0
- Continue reading or reply
Query deleted by
var queryResult = sforce.connection.queryAll("Select Id, Name, DeletedBy from Lead where IsDeleted = true");
- wkuehler
- January 25, 2007
- Like
- 0
- Continue reading or reply
Link for Google Maps S-Control
Can someone post the official location of this s-control? Salesforce, how about putting it on the AppExchange?
Thanks.
- hemm
- June 21, 2006
- Like
- 0
- Continue reading or reply
Counting the number of Events, then populating field on custom object
This is my first post. I have a custom object, and I need to count the number of events attached to the custom object and update the event count on the custom object. Is this possible using an s-control? I have limited programming experience, but can understand code. I appreciate your help in advance.
- Dakin_Lab
- June 12, 2006
- Like
- 0
- Continue reading or reply
trouble with Dynabean
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script src="http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script> <script language="JavaScript1.2"> function updateaccountinfo() { var updateObjects = new Array(); var accountinfo = new Sforce.Dynabean("account"); accountinfo.set("Id", "{!Account_ID}"); accountinfo.set("Phone", "555555"); updateObjects.push(accountinfo); var update = sforceClient.Update(updateObjects); //window.parent.parent.location.href = '../setup/own/entityowneredit.jsp—retURL=../../home/home.jsp&id={!Account_ID}&p2=Bob Tester&save=1'; } </script> </head> <body onload="updateaccountinfo()"> </body> </html>
Message Edited by wkuehler on 05-30-2006 07:22 PM
Message Edited by wkuehler on 05-31-2006 05:57 AM
- wkuehler
- May 30, 2006
- Like
- 0
- Continue reading or reply
S-Control to display my accounts
Is an S-control the best approach here? If so, any info to get me started would be appreciated.
Thanks
Wkuehler
- wkuehler
- May 10, 2006
- Like
- 0
- Continue reading or reply
SForce excel connector error
describeBox_init: wild_error
- wkuehler
- January 30, 2006
- Like
- 0
- Continue reading or reply