08-06-2012 05:45 AM - edited 08-10-2012 01:29 AM
HI,
I am facing an issue with the Current Company value not having the correct value. As an example I have two companies currently- Company A and Company B.
I am trying to get value of fields based on the current company name. This works for the first time the company detailed view is loaded and I get the name as Company A using the code ActApplication.Instance.ApplicationState.CurrentCompany.ToString(); .
However, when I click on Company B the ActApplication.Instance.ApplicationState.CurrentCompany.ToString(); still returns the name of the previous company - Company A. I have tried to refresh the view, etc but nothing works.
Now if I switch back to Company A, ActApplication.Instance.ApplicationState.CurrentCompany.ToString(); gives me the value as Company B.
Can someone let me know what the issue is here and what would be the solution.
Thanks
Satyajit
08-08-2012 06:44 AM - edited 08-09-2012 01:13 AM
Hi,
My application fetches and populates dropdown boxes on basis of certain fields. To capture record changing events I am using currency manager and positionchanged and itemchanged events.
I use ActApp.ApplicationState.CurrentCompany to get the current company record data. However there is an issue with ActApp.ApplicationState.CurrentCompany not updating values when I click on another company within detailed company view (by clicking on another company on the left hand tree).
Another new issue is that If I am on a company record currently and then I click on New button to add a new company and then cancel the add and return back to the company record that I was on previously on, in this case ActApp.instance.ApplicationState.CurrentCompany.Name will have a null value.
Any suggestions how to overcome this problem.
08-06-2012 07:38 AM
Hello Satyajit,
I could not reproduce this. I used some extremely basic code:
Company myComp = ActApp.ApplicationState.CurrentCompany; MessageBox.Show(myComp.Name);
This code would fire when I clicked on a menu item that I've created. Are you doing this in the company detail view? This will not return the selected company in the list view.
08-07-2012 02:59 AM
Hi Matthew,
Yes I am doing in this in the company Detail view. For reason unkown it does pick up the company name in the Item changed event however on clicking or moving to the other company it does not refresh the company name (still shoes the new company name).
Currently I have overcome this by doing a refresh of the instance.
However I have used the code below (as you have suggested) in another project and it works.
Many Thanks
Satyajit
08-08-2012 06:44 AM - edited 08-09-2012 01:13 AM
Hi,
My application fetches and populates dropdown boxes on basis of certain fields. To capture record changing events I am using currency manager and positionchanged and itemchanged events.
I use ActApp.ApplicationState.CurrentCompany to get the current company record data. However there is an issue with ActApp.ApplicationState.CurrentCompany not updating values when I click on another company within detailed company view (by clicking on another company on the left hand tree).
Another new issue is that If I am on a company record currently and then I click on New button to add a new company and then cancel the add and return back to the company record that I was on previously on, in this case ActApp.instance.ApplicationState.CurrentCompany.Name will have a null value.
Any suggestions how to overcome this problem.