Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

GP AddIns using Visual Studio - Fields values

(0) ShareShare
ReportReport
Posted on by

I am creating Dexterity AddIn using Visual studio. I want to fetch value of some fields and not codes. E.g 

Location, Department, Supervisor and Job Title. I am using below code when any changes made to Employees. 

public void Initialize()
{
EmpMaintenanceForm.UprEmployeeMnt.SaveRecord.ValidateAfterOriginal += new EventHandler(RegisterEmployee);
}
void RegisterEmployee(object sender, EventArgs e)
{

UprEmployeeMntForm.UprEmployeeMntWindow EmpMaintWindow;
EmpMaintWindow = Dynamics.Forms.UprEmployeeMnt.UprEmployeeMnt;

MessageBox.Show(EmpMaintWindow.JobTitle.Value.ToString()) ---> MGR 

MessageBox.Show(EmpMaintWindow.Department.Value.ToString()) ---> HR

MessageBox.Show(EmpMaintWindow.LocalSupervisorName.Value.ToString()) ---> AP

MessageBox.Show(EmpMaintWindow.LocalLocationName.Value.ToString()) ---> NY

}

So I am getting short forms(codes) like MGR,HR, AP and NY. 

My question is how can I get full names ? like Manager, Human Resources, Alex Paul and New York ? 

PS : I am following this link for addin developement : www.gpug.com/.../getting-started-with-gp-addins-using-visual-studio

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: GP AddIns using Visual Studio - Fields values

    Dear Mariano,

    Thanks a lot. You answer helped me a lot and I am able to find 3 out of 4 fields. That's great indeed.

    So now I am having one last field. I need Employee's detail from Supervisor's code.

    MessageBox.Show(EmpMaintWindow.LocalSupervisorName.Value.ToString()) ---> AP

    As you know supervisor is employee and in supervisor window we can see EmployeeID and Name. So how can I find relationship in terms of coding ? i.e Dynamics.Tables.[?] to find employee detail from supervisorcode.

    Also, can you share some documentation links where I can find all these relationship and references of coding.

  • Suggested answer
    Mariano Gomez Profile Picture
    26,225 on at
    RE: GP AddIns using Visual Studio - Fields values

    As you noted, only the codes are stored at the employee level. To obtain the actual description of these codes, you need to read the corresponding tables.

    void RegisterEmployee(object sender, EventArgs e)
    { UprEmployeeMntForm.UprEmployeeMntWindow EmpMaintWindow;
      EmpMaintWindow = Dynamics.Forms.UprEmployeeMnt.UprEmployeeMnt;
    
      // Variable for any table operation error
      TableError err;
    
      // Create a reference to the table
      UprDept UprSetpDepartment;
      UprDept = Dynamics.Tables.UprSetpDepartment;
    
      UprDept.Department.Value = EmpMaintWindow.LocalLocationName.Value.ToString();
      err = UprDept.Get();
    
      if (err == TableError.NoError)
      {
        MessageBox.Show(UprDept.Description.Value);
      }
      else
      {
        // Display the error that occurred
        MessageBox.Show(err.ToString());
      }
      // Close the table
      UprDept.Close();
    }


    Now, since you need to do this for all other pieces of info, you will need to target the right table.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans