Community
Showing results for 
Search instead for 
Do you mean 
Reply

Newbie trying to update a Contact field

Highlighted
Copper Super Contributor
Posts: 485
Country: Australia

Re: Newbie trying to update a Contact field

            //Get Annuity Type Checkboxes
            ContactFieldDescriptor AnnuityProdFD = null;
            AnnuityProdFD = Act.UI.ActApplication.Instance.ActFramework.Contacts.GetContactFieldDescriptor("CUST_ContactTable1_090144.CUST_ProdAnn_071358635", true);
            string AnnuityProdVal = AnnuityProdFD.GetValue(c).ToString();


'''''' I have a ForEach Activity creator here that uses the above code correctly


            c.Update();

            Act.UI.ActApplication.Instance.RefreshLoadedViews();

            AnnuityProdFD.SetValue(c, false);

 

Mathew

 

I have successfully used the method to obtain the current status of a check box but trying to set it does not apear to work at all

 

ITs the same as your code but i cant get it to work

 

 


Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Highlighted
Nickel Contributor
Posts: 175
Country: USA

Re: Newbie trying to update a Contact field

Jason,

 

Your SetValue line needs to go before the c.Update call, like so...

 

AnnuityProdFD.SetValue(c, false); 

c.Update();

//Update view after all changes have been made and saved (i.e. after any loops)
Act.UI.ActApplication.Instance.RefreshLoadedViews(​);

 

Highlighted
Copper Super Contributor
Posts: 485
Country: Australia

Re: Newbie trying to update a Contact field

once you do the c.Update() does that zero out the variables the code is holding?? Hence why it does nothing??

 

Would a             Act.UI.ActApplication.Instance.RefreshLoadedViews(); be a safer choice??


Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Highlighted
Nickel Contributor
Posts: 175
Country: USA

Re: Newbie trying to update a Contact field

[ Edited ]

I'm speaking for the typical .NET data setup (Data.Datatable, Data.Dataset, etc.), and based on the previous posts in this thread, it looks like ACT works the same way.

That is, when working with a contact in code, you are dealing with an in-memory copy. Any changes you make, won't be saved unless you do an update. Updating in straight .NET does accept the changes (a.k.a. saves them). I can't say for certain if ACT works the same way (I'm not familiar enough with the inner workings of ACT). The RefreshLoadedViews call is probably just telling ACT to update the UI with the most recent information from the database. It shouldn't have anything to do with actually saving the changes. Hopefully someone else with more experience/knowledge can correct and/or verify what I've stated.

Basically, you have 3 steps you want to do:
1) Make changes to the data (SetValue)
2) Save changes (Update)
3) Update UI to reflect those saved changes (RefreshLoadedViews)

These steps are pretty common across a lot of database driven applications.

 

 

Edit: Completed thoughts

Highlighted
Copper Super Contributor
Posts: 485
Country: Australia

Re: Newbie trying to update a Contact field

Thanks for that all very understandable process

but for my code it still not working, i have tried it with just the last update() at the bottom of the code

I have even tried it right at the front of the code after i have ripped the field discriptor and got the value, and that did not work

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Highlighted
Copper Super Contributor
Posts: 485
Country: Australia

Re: Newbie trying to update a Contact field

wait i stand corrected the one after the field descriptor rip has worked

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Highlighted
Copper Super Contributor
Posts: 485
Country: Australia

Re: Newbie trying to update a Contact field

when i first clicked the button it did not work, but now it does

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Highlighted
Copper Super Contributor
Posts: 485
Country: Australia

Re: Newbie trying to update a Contact field

Thanks for the help knif, they should employ you here

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6