• bo
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 6
    Replies

I have a requirement to integrate a non-salesforce.com screen with the salesforce.com search. From the search results, I want to redirect back to my non-salesforce.com screen with some Client data (Name for example).  Can this be done?

 

What if I wanted to do the same scenario with a Create?  After the Person is created, I want to redirect back to a non-saleforce.com screen and maybe pass back the ID. 

 

Any thoughts or direction on this would be greatly appreciated.

 

-Doug

 

HI there,

 

my problem is to update or insert an account team member record on the account related to the opportunity where this trigger is. So, basically, after updating an opporunity, the Owner of the opportunity (if a certain type criteria is matched ) needs to be part of the account team, if not already, of the accont related to the opportunity. 

 

If the opportunity owner is already an account team member of the account, update the TEammemberrole to "Account manager".

If the opportunity owner is NOT an account team member of the account related, insert a new account team member record with the teammemberrole 'Account manager'.

 

I'm getting an error when updating the opportunity:  first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]: Trigger.AMforopptTEAMmember: line 30, column 1

 

Here is the trigger:

 

trigger AMforopptTEAMmember on Opportunity (after update) {
  Set<Id> recordIds = new Set<Id>();
  Set<Id> acctIds = new Set<Id>();
  Set<Id> userIds = new Set<Id>();
  Map<Id,Id> ownerIds = new Map<Id,Id>();

  for(opportunity S:Trigger.new)
    if(S.type == 'Renewal' && S.stagename<>'Closed Won' && S.stagename<>'Closed Lost' ){
     recordIds.add(S.id);
      acctIds.add(S.accountid);
    userIds.add(S.ownerid);
    ownerIds.put(s.accountid,s.ownerid);
}

List < opportunity> usersOK = new List < opportunity >{[select id, ownerid, accountid from opportunity where id in :recordIds]};
 
List < Accountteammember> membersToUpdate = new List < Accountteammember >{[select id, userid, TeamMemberRole from accountteammember where accountid in :acctIds and Userid in :userIds]};

 {
    IF(memberstoupdate.size() > 0)
        memberstoupdate[0].TeamMemberRole = 'Account Manager';
}
        update memberstoupdate;


List < Accountteammember> membersToinsert = new List < Accountteammember >{[select id, userid, TeamMemberRole from accountteammember where accountid in :acctIds and Userid in :userIds]};

    IF(membersToinsert.size()== 0)
        Accountteammember newmember= new Accountteammember( accountid=usersOK[0].accountid, teammemberrole = 'Account Manager', Userid=usersOK[0].ownerid);
        insert memberstoinsert; 
}

 Thanks!

B


what is the diff b/w sObject and Object

 

what is sControl

 

currently i am learning to write code for triggers, classes , and test classes. Planning to learn about visualforce pages what is the next concept that i need to learn for improving my code development skills

 

I will be very glad for your time and help

HI Everyone,

 

I want to remove queries from for loop and want to bulkify my apex class, so that it wont hit governor limits.

 

While Lexiloader almost replaces the need to boot up Windows for each DataLoader session, I haven't found a decent CSV editor for Mac.

Microsoft Excel is just such a bloated piece of junk on the Mac and almost all smaller tools (that I know of) fail to deliver.

 

What's your tool of choice to prepare data for Lexiloader?

 

(for now I stick with Parallels / WinXP / Excel2003 and/or Access 2003)

 

- Andreas