Community
Showing results for 
Search instead for 
Do you mean 
Reply

Set Opportunity access level in ACT! 2011

Accepted Solution Solved
Tuned Listener
Posts: 10
Country: Brazil
Accepted Solution

Set Opportunity access level in ACT! 2011

Hi All,

 

I'm having a hard time trying to do this.

My plugin needs to create a new opportunity and set it's access level to "Limited Access"

 

I know that the only way to do that is to set the Opportunity accessors list do a specific user (or users).

 

From the SDK I found the Opportunities.SetAccessors function

 

 

SetAccessors (ByVal mutableEntity As Act.Framework.MutableEntities.MutableEntity, ByVal accessors() As Act.Framework.MutableEntities.Accessor)

 

 

OK, I already have the MutableEntities.Accessor list (I have used this list to set the contact's access level), but have no idea on how to get the mutableEntity for the opportunity i'm creating (actualy the opportunity is already created).

 

Does anyone have any idea on how to do that ?

 

thanks in advance

 

Flavio Frate

ACT!Brasil

 

 


Accepted Solutions
Solution
Accepted by topic author ffrate
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Set Opportunity access level in ACT! 2011

Hello Flavio,

 

Not sure if I've posted this elsewhere in this subforum, but I have an example of setting the access level of the current opportunity for a particular team. Hope this helps:

 

Opportunity o = _ActApp.ApplicationState.CurrentOpportunity;
                if (o.CanChangeAccessType)
                {
                    OpportunityManager oppman = new OpportunityManager(_ActApp.ActFramework);                    
                    Accessor[] AccessList = new Accessor[1];
                    Accessor AdminTeam = oppman.GetAccessorAdminTeam();
                    Accessor Team2 = oppman.GetCurrentUserAccessor();
                    AccessList[0] = AdminTeam;
                    oppman.SetAccessors(o, AccessList);
                }
Matthew Wood
Act! SDK Support
Community Moderator

View solution in original post


All Replies
Solution
Accepted by topic author ffrate
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Set Opportunity access level in ACT! 2011

Hello Flavio,

 

Not sure if I've posted this elsewhere in this subforum, but I have an example of setting the access level of the current opportunity for a particular team. Hope this helps:

 

Opportunity o = _ActApp.ApplicationState.CurrentOpportunity;
                if (o.CanChangeAccessType)
                {
                    OpportunityManager oppman = new OpportunityManager(_ActApp.ActFramework);                    
                    Accessor[] AccessList = new Accessor[1];
                    Accessor AdminTeam = oppman.GetAccessorAdminTeam();
                    Accessor Team2 = oppman.GetCurrentUserAccessor();
                    AccessList[0] = AdminTeam;
                    oppman.SetAccessors(o, AccessList);
                }
Matthew Wood
Act! SDK Support
Community Moderator
Tuned Listener
Posts: 10
Country: Brazil

Re: Set Opportunity access level in ACT! 2011

Hello Matthew,

 

Thanks for your answer.

 

Unfortunatelly the code does not run, it returns an exception without further information. See bellow:

 

 

System.ApplicationException was caught
  Message="error"
  Source="Act.Framework"
  StackTrace:
       at Act.Framework.MutableEntities.MutableAccessorDB`1.SetAccessors(T t, Accessor[] accessors)
       at Act.Framework.Opportunities.OpportunityManager.SetAccessors(MutableEntity mutableEntity, Accessor[] accessors)
       at AtivaCliente.clsAtivaContato.CriaOportunidade(Contact ct) in C:\Arquivos de Clientes\Advis\AtivaCliente\clsAtivaContato.vb:line 436

 

System.ApplicationException was caught  Message="error"  Source="Act.Framework"  StackTrace:       at Act.Framework.MutableEntities.MutableAccessorDB`1.SetAccessors(T t, Accessor[] accessors)       at Act.Framework.Opportunities.OpportunityManager.SetAccessors(MutableEntity mutableEntity, Accessor[] accessors)       at AtivaCliente.clsAtivaContato.CriaOportunidade(Contact ct) in C:\Arquivos de Clientes\Advis\AtivaCliente\clsAtivaContato.vb:line 436

 

 

Do you think I may be missing somenthing else ?

 

 

Flavio

ACT!Brasil

Tuned Listener
Posts: 10
Country: Brazil

Re: Set Opportunity access level in ACT! 2011

I forgot to mention in my last post:

 

I'm using ACT!2011...

 

 

Flavio Frate

ACT!Brasil

 

 

Tuned Listener
Posts: 10
Country: Brazil

Re: Set Opportunity access level in ACT! 2011

Hi Matthew,

 

I got it !

 

The problem was not your code, it works like a charm.

 

Actually the opportunity was created but not updated !

 

My code was creating the opportunity, filling all pertinent fields, trying to set thee access level and then updating then opportunity.

 

The trick was the exception messsage error without explanation. Looking better, I found that at the SetAccessors time, the opportunity did not have Creat Date nor Edit date.

 

So the update solved the problem.

 

Thanks again for your help.

 

 

Flavio Frate

ACT!Brasil