• wkuehler
  • NEWBIE
  • 49 Points
  • Member since 2005

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

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,

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....

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.

 

 

Not sure why this is happening.  When I save an excel spreadsheet that contains sforce connector formulas, the formulas are changed after the document is opened.
 
For example,
 
=IF(C16="","", soql_table("User","UserName = '" & C16 & "'"))
 
is changed to
 
=IF(C16="","", 'C:\Documents and Settings\username\My Documents\Programs\sforce_connect.xla'!soql_table("User","UserName = '" & C16 & "'"))
 
and the sheet no longer works.
 
Any ideas?
This should be an easy one...
 
When you delete an account from the console, you are 'returned' to the console.  When you delete an account from a list view on the account tab, you are 'returned' to the list view.  I have created an Scontrol that overrides the account delete button.  How can I mimic this functionality so that the user is 'returned' to the page that they clicked delete on?
 
Non-working example:  window.history.go(-2) then refresh()
 
Any ideas???
Does anyone know of a way to query on the deleted by field?  An example of what I am looking for is:

var queryResult = sforce.connection.queryAll("Select Id, Name, DeletedBy from Lead where IsDeleted = true");
Any ideas?
 
This S-Control is being called from a link on the account page.  All I want it to do is update the phone number to be "5555555".  Any help would be appreciated.

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

I would like to have a user lookup on the account tab.  When you would click on the lookup icon, the only users that would be available would be users with "Some title" as their title.

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?
I would like to create a tab that would display the equivalent of an account report with Account Name, Account Site, and Account Phone as the columns. It should display all accounts owned by the logged in user.

Is an S-control the best approach here? If so, any info to get me started would be appreciated.

Thanks

Wkuehler
Anyone have any idea what this meesage is about?

describeBox_init: wild_error
There is a button to 'Request Update' from a contact record. I would like to have a similar button, 'Request Delete' in my account records that, when pressed, would send a message to the next higher role in the role hierarchy stating that User X has requested to have Account Y deleted.

Any ideas?

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,

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....

Does anyone know of a way to query on the deleted by field?  An example of what I am looking for is:

var queryResult = sforce.connection.queryAll("Select Id, Name, DeletedBy from Lead where IsDeleted = true");
Any ideas?
 
There used to be a place on crmsuccess.com that had an s-control to link Salesforce to Google Maps.  I have scoured crmsuccess.com, the appexchange and these forums to find the link to the code, but it's not anywhere to be found.  I came across a few links, but they were all dead ones.

Can someone post the official location of this s-control?  Salesforce, how about putting it on the AppExchange?

Thanks.
  • June 21, 2006
  • Like
  • 0
Hello,

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.

This S-Control is being called from a link on the account page.  All I want it to do is update the phone number to be "5555555".  Any help would be appreciated.

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

I would like to create a tab that would display the equivalent of an account report with Account Name, Account Site, and Account Phone as the columns. It should display all accounts owned by the logged in user.

Is an S-control the best approach here? If so, any info to get me started would be appreciated.

Thanks

Wkuehler
Anyone have any idea what this meesage is about?

describeBox_init: wild_error