Community
Showing results for 
Search instead for 
Do you mean 
Reply

Group Field Not Saving

Nickel Super Contributor
Posts: 352
Country: Canada

Group Field Not Saving

I've got a really odd thing happening with some code that writes to a group field and an opportunity.

 

First I write a value to a group field using the descriptor's SetValue method.  Then, in a subroutine that value gets read using the GetValue method for the descriptor and writes the value to an opportunity field.

 

Here's the bizarre part: the value gets written to the opportunity field no problem, yet the group field doesn't get set.  It's a URL field, for what it's worth.  I'm using the Update() method so that's not missing.  The code works fine on my machine, which has a slightly earlier version of the DB and I'm running v12.0 and the machines I'm deploying it to run v12.1

 

Any theories?

 

Thanks,

Len 

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training
Employee
Posts: 1,163
Country: USA

Re: Group Field Not Saving

[ Edited ]

I guess the question would be if we do getvalue(), but never apply that value to the opportunity field, does the value of the group field still change?

 

Are you able to reproduce with any other fields.


 

Edit: Did a few quick tests with this and wasn't able to reproduce. Here are the two methods I used to set the group field and then retrieve it and set the value of the opp field using it.

 

 

 

private void SetFieldValue(string str)

{

GroupList gl = ActApp.ActFramework.Groups.GetGroups(null);

DBFieldDescriptor gfd = ActApp.ActFramework.Groups.GetGroupFieldDescriptor("TBL_GROUP.DESCRIPTION");

try { gfd.SetValue(gl[0], "`Test!!!Test"); }

catch (Exception x) { MessageBox.Show(x.ToString()); }

gl[0].Update();

}

 

private void GetValueWriteToOpp(string str)

{

GroupList gl = ActApp.ActFramework.Groups.GetGroups(null);

DBFieldDescriptor fd = ActApp.ActFramework.Groups.GetGroupFieldDescriptor("TBL_GROUP.DESCRIPTION");

Group g = gl[0];

 

OpportunityList ol = ActApp.ActFramework.Opportunities.GetOpportunities(null);

DBFieldDescriptor odfd = ActApp.ActFramework.Opportunities.GetMutableEntityFieldDescriptor("NAME");

Opportunity o = ol[0];

try { odfd.SetValue(o, fd.GetValue(g)); }

catch (Exception x) { MessageBox.Show(x.ToString()); }

ol[0].Update();

}

 

 

Message Edited by mwood on 05-17-2010 08:29 AM
Matthew Wood
Act! SDK Support
Community Moderator