Community
Showing results for 
Search instead for 
Do you mean 
Reply

Opportunity.SetRecordManager Not Working

New Member
Posts: 4
Country: USA

Opportunity.SetRecordManager Not Working

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")
op.SetRecordManager(oppRecMgr)

 

The error is:

Operation is not valid due to the current state of the object. at Act.Framework.Opportunities.Opportunity.OpportunityFieldCollection.SetRecordManager(User user)

Employee
Posts: 1,163
Country: USA

Re: Opportunity.SetRecordManager Not Working

Hello Max,

 

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.

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 4
Country: USA

Re: Opportunity.SetRecordManager Not Working

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!

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Opportunity.SetRecordManager Not Working

I use:  opp.SetManager(user,actfwk)

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Silver Super Contributor
Posts: 2,328
Country: USA

Re: Opportunity.SetRecordManager Not Working

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.


Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
New Member
Posts: 4
Country: USA

Re: Opportunity.SetRecordManager Not Working

How can I create the opportunity if it already exists? Am I reading your suggestion incorrectly?
Silver Super Contributor
Posts: 2,328
Country: USA

Re: Opportunity.SetRecordManager Not Working

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?


Stasn


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
New Member
Posts: 4
Country: USA

Re: Opportunity.SetRecordManager Not Working

Ah ha! I think the admin user was the key. That and it also appears that if I'm looking at the Opportunity in the UI the API change doesn't stick or is refreshed. I found it is now successful if I do NOT have that Opportunity open and I make the API call as an admin. Thank you!
Silver Super Contributor
Posts: 2,328
Country: USA

Re: Opportunity.SetRecordManager Not Working

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.

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!