Page 1 of 1
Error in PrefC.GetString(PrefName prefName) function
Posted: Wed Jul 06, 2016 2:58 am
by mopensoft
I got this error from time to time (not all the time). The plugin pass one PrefName but when it runs in OpenDentBusiness.PrefC code, it changes to different PrefName. It's very unpredictable the behavior of this function. Please see example below:
I call
PrefC.GetString(PrefName.BirthdayPostcardMsg) and when it runs the function code, it turns
PrefName.BirthdayPostcardMsg into
PrefName.BillingUseBillingCycleDay.
I got this error with my other plugin when try to get the
ConfirmTextMessage but it is changed into
ConfirmStatusTextMessaged
Is there anyway to make it works correctly?
Thanks
M
Re: Error in PrefC.GetString(PrefName prefName) function
Posted: Wed Jul 06, 2016 3:06 am
by mopensoft
even this code
Code: Select all
string greeting2 = PrefC.GetRaw(PrefName.BirthdayPostcardMsg.ToString());
PrefName.BirthdayPostcardMsg.ToString() become "BillingUseBillingCycleDay" instead of "BirthdayPostcardMsg".
It's strange.
Re: Error in PrefC.GetString(PrefName prefName) function
Posted: Wed Jul 06, 2016 11:51 am
by tgriswold
Because PrefName is an enum (really just passed as an int position in the enumeration) it almost seems like the call is using a different version of the enum then the GetString() function. Might check to see that your OpenDentBuisness reference isn't pointing to an older version? Or try cleaning the solution and recompiling (sometimes Visual Studios does some weird stuff and a clean usually fixes most "this is weird" errors)
Re: Error in PrefC.GetString(PrefName prefName) function
Posted: Wed Jul 06, 2016 5:16 pm
by mopensoft
GetString refers to the latest version of OpenDentBusiness, how can it call a different version of enum? integer value of BirthdayPostcardMsg is 91 but when pass to GetString, it become 88 which is BillingUseBillingCycleDay.
UPDATE:
- After multiple update and clean up, it finally works as expected. I would go with GetRaw(string prefName) for the time being. Hope the name of the Pref will not change.
Thanks for your advice
M
Re: Error in PrefC.GetString(PrefName prefName) function
Posted: Wed Jul 06, 2016 5:42 pm
by jwhitney
Are you giving your Enum a default value? I have seen it mess up like this if you did something to this when making your Enum:
public enum PrefNames {
....
BirthdayPostcardMsg=88,
....
}
Other than that, I can't think of any other reason why the OpenDentBusiness that you compiled with your enum in it wouldn't know about the Enum you made.
Re: Error in PrefC.GetString(PrefName prefName) function
Posted: Wed Jul 06, 2016 6:20 pm
by mopensoft
No, I would not touch OD code except adding hooks. I get the value by converting PrefName enum to INT.
I think the reason could be like tgriswold mentioned. I have to open OD 16.2.26 solution file, clean up and recompile. At first the problem still but after I upgrade to 16.2.28, clean up and recompile, OD solution. After than, go to my plugin project, remove and add reference to OD and ODBusiness again. It all works now. I guess that the referencing issue.