Community
Showing results for 
Search instead for 
Do you mean 
Reply

how do i get current username and password and current pad file ?

Avid Listener
Posts: 83
Country: Malaysia

how do i get current username and password and current pad file ?

hi all,

 

i found out that i need to declare act framework to getfielddescriptors. but it always need user log on, password and pad file.

do anyone have idea how to declare it globally ?

 

thanks,

jeff.

Nickel Super Contributor
Posts: 441
Country: UK

Re: how do i get current username and password and current pad file ?

If you are working within the application then your should already have a reference to the act application.  In all the samples in the sdk it is referenced as ActApp.  Once you have a ref to the act application you can access the currently logged on framework by using the actframework property.  If you are outsdie of the application you will always have to log on seperately.

 

Eg.

 

ActApp.ActFramework.Contacts.GetContactFieldDescriptors()

 

Tom

Avid Listener
Posts: 83
Country: Malaysia

Re: how do i get current username and password and current pad file ?

Hi Tdavis,

 

Actually this is my problem.

 

i need to declare  ContactList cList;

 

and because of this i need to log on to ACT and this is under different method.

 

 

 

 

Nickel Super Contributor
Posts: 441
Country: UK

Re: how do i get current username and password and current pad file ?

Are you using an application ouside of ACT! then?  If so why not just collect the logon info at the start of your app, log on and then hold the actframework in a global variable to be accessed from the rest of your application.

 

Tom

Avid Listener
Posts: 83
Country: Malaysia

Re: how do i get current username and password and current pad file ?

Hi Tdavis,

 

I`m developed plugins - dll files using c#. Then i will create new tab and inside the tab got datagridview.

So may i know how to get current pad, login user name and password ?

i hope you understanding my problems and help me as my custom menu prompt user to keyed-in pad file, username and password.

but this new tab exist at contact layout and before user select my custom menu.

 

thanks,

Jeff.

Nickel Super Contributor
Posts: 441
Country: UK

Re: how do i get current username and password and current pad file ?

So you are inside the act application then?  in which case you will have a reference to the act application so just use the actframework  property as in my first post.

 

Tom

Avid Listener
Posts: 83
Country: Malaysia

Re: how do i get current username and password and current pad file ?

HI Tdavis,

 

i`m had changed my code as belows. But i`m encountered errors.  Error 12 Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?) .

 

Do you know what i had missing ?

 

 Contact cContact = this.actApplication.ApplicationState.CurrentContact;

            string ID = cContact.ID.ToString();
            string fName = string.Empty;
            string Customer_id = string.Empty;
            string oValue = string.Empty ;

         
            DBFieldDescriptor[] fRay = this.actApplication.ActFramework.Contacts.GetFieldDescriptors();

            foreach (DBFieldDescriptor fd in fRay)
            {
                if (fd.DisplayName == "Cust_id")
                {
                    fName = fd.Name;
                }

            }
            ContactFieldDescriptor cField = this.actApplication.ActFramework.Contacts.GetContactFieldDescriptor(fName) ;
            oValue = cField.GetValue(cContact);

            try
            {
                Customer_id = oValue.ToString();
            }
            catch
            {
                Customer_id = "";
            }

Nickel Super Contributor
Posts: 441
Country: UK

Re: how do i get current username and password and current pad file ?

What is your field type defined as.  I tend to use the code below, either should work but its worth a try...

 

instead of this 

 

oValue = cField.GetValue(cContact);

 

try this:

 

oVale = cstr(cContact.Fields(fName,true))

 

Tom

 

 

Avid Listener
Posts: 83
Country: Malaysia

Re: how do i get current username and password and current pad file ?

Hi Tdavis,

 

May i know what is cSTR use for ?

As i cant find this function and it return this error.

 oValue = cContact.Fields(fName, true);

 

Error 12 Non-invocable member 'Act.Framework.MutableEntities.MutableEntity.Fields' cannot be used like a method. 

 

Thanks,

Jeff.

Nickel Super Contributor
Posts: 441
Country: UK

Re: how do i get current username and password and current pad file ?

Hi Jeff,

That converts the value to string, I normally use vb .net though.  Try the code below, I've changed the bits in bold

 

 Contact cContact = this.actApplication.ApplicationState.CurrentContact;

            string fName = string.Empty;
            string Customer_id = string.Empty;
            string oValue = string.Empty ;

         
            Act.Framework.Contacts.ContactFieldDescriptor[] fRay = this.actApplication.ActFramework.Contacts.GetContactFieldDescriptors();

            foreach (Act.Framework.Contacts.ContactFieldDescriptor fd in fRay)
            {
                if (fd.DisplayName == "Cust_id")
                {
                   oValue = cContact.Fields(fName,True);
                }

            }
                      

            try
            {
                Customer_id = oValue;
            }
            catch
            {
                Customer_id = "";
            }

 

 

Tom