10-03-2013 11:42 AM
If anyone has a fix for this, please share!
Visual Basic .NET code below:
'op is an opportunity object, and I can update all kinds of stuff on it: Name, Product Items, etc... Bu I get an error when I try to set the Record Manager.
Dim oppRecMgr As Act.Framework.Users.User
oppRecMgr = ActFwk.Users.GetUser("John Doe")
The error is:
Operation is not valid due to the current state of the object. at Act.Framework.Opportunities.Opportunity.OpportunityFieldCollection.SetRecordManager(User user)
10-07-2013 06:25 AM
Looks like the code is correct, are you making any changes that are not saved to the opportunity prior to changing the record manager? You may, based on the exception that you're receiving just need to update the opportunity prior to trying to the change.
10-07-2013 06:41 AM
I just tried that and it still gives the same error. I even tried logoff the framework, and then log back in before attempting the routine to set the RecordManager, still same error. Any other suggestion would be much apprechiated!
10-07-2013 07:43 AM
I use: opp.SetManager(user,actfwk)
10-07-2013 07:47 AM
Sorry that was for earlier versions of ACT!
Your code does look fine. It may be that whoever you are logged in as can't change a record manager on an opp. It's also possible that the opp has to exists before you can change the record manager so you might need to create it, update it and then change it.
10-08-2013 09:04 AM
It was just a general statement. You didn't specify that the opportunity that you were attempting to set the record manager on already existed. Are you logging in to the database as an administrator user? Have you verified that "op" exists and that "oppRecMgr" exists after you get the user?
10-08-2013 09:53 AM
10-08-2013 11:55 AM
It's usually the changes made in the UI don't stick if you update an object using the SDK. I haven't done a lot of testing with Opportunities to see if they function differently in those circumstances though and they might. Glad you got it working.