Community
Showing results for 
Search instead for 
Do you mean 
Reply

Set Record Manager

Avid Listener
Posts: 12
Country: United States

Set Record Manager

Can someone give me an example of setting the record manager for an opportunity? I am injecting a bunch of opps for sales guys automatically, but need to have the recoed manager be different for each sales person. I have attempted to set the record manager thru the setrecordmanager method, but it is causing me issues.

 

Thanks

 

Chris

Employee
Posts: 1,163
Country: USA

Re: Set Record Manager

If you're logged in as the administrator then this should set the record mgr of the current opp to you.

 

Opportunity o = ActApp.ApplicationState.CurrentOpportunity;
o.SetRecordManager(ActApp.ActFramework.Users.GetUser(ActApp.ActFramework.Contacts.GetMyRecord()));

Matthew Wood
Act! SDK Support
Community Moderator
Avid Listener
Posts: 12
Country: United States

Re: Set Record Manager

I assume I can pass a user to the getmyrecord, as I will be needing to assign some of the oppotunities to different people as far as the record manager is concerned? I will need to change the record manager on some of them. Is this possible?

 

 

 

Chris

Employee
Posts: 1,163
Country: USA

Re: Set Record Manager

Yes, I just did the example this way for simplicity.

 

Users[] theUsers = ActApp.ActFramework.Users.GetUsers();

 

^ Will get you all the uers for the db.

Matthew Wood
Act! SDK Support
Community Moderator
Highlighted
New Member
Posts: 6
Country: United_Kingdom

Re: Set Record Manager

[ Edited ]

Is there some magic to getting this to work that I am missing?

 

I am getting 

 

'actContact.SetRecordManager(user)' threw an exception of type 'System.InvalidOperationException'
    Data: {System.Collections.ListDictionaryInternal}
    HResult: -2146233079
    HelpLink: null
    InnerException: null
    Message: "Operation is not valid due to the current state of the object."
    Source: "Act.Framework"
    StackTrace: "   at Act.Framework.Contacts.Contact.ContactFieldCollection.SetRecordManager(User user)\r\n   at Act.Framework.MutableEntities.MutableEntity.SetRecordManager(User user)"
    TargetSite: {Void SetRecordManager(Act.Framework.Users.User)}