another blog

Icon

About Microsoft Dynamics GP :-)

VSTools and database triggers.

In SanScript coding we have database triggers, Below is a detail of what database triggers are as explained in dexterity manuals.

Database triggers
Database triggers are activated by successful table operations, such as a record
begin read, saved, or deleted. The procedure that runs in response to a database
trigger has access to the same table buffer contents as the script that performed the
database operation.Database triggers are useful for maintaining referential integrity between records in
your application and related records in the accounting system. When Microsoft
Dynamics GP reads, saves or deletes a record, you can use a database trigger to
perform similar operations for a related table in your application.

 

While working with VSTools, one surely miss equivalent event in VSTools customization. The resources for which we  can register events are such as forms, windows,and fields. While working with custom tables to save additional information related to the any GP window, we need to make sure about the integrity of data, so if records get saved/delete in GP table it’s corresponding record must be save/delete from the custom table.

For a situation like that I register event trigger against  AddRecordDeletedRecord procedure.

 Microsoft.Dexterity.Applications.Dynamics.Procedures.AddRecordDeletedRecord.InvokeAfterOriginal += AddRecordDeletedRecord_InvokeAfterOriginal;

private void AddRecordDeletedRecord_InvokeAfterOriginal(object sender, AddRecordDeletedRecordProcedure.InvokeEventArgs e)
{
if ((e.inParam1 == “GL_TRX_HDR_WORK”) &&
(e.inParam2 == DynamicsModified.Forms.GlTransactionEntry.GlTransactionEntry.JournalEntry.Value.ToString()) &&
(e.inParam3 == 2) &&
(e.inParam4 == 0))
{
//delete record from custom table
}

}

This procedure gets call from many GP windows and on several time, so that’s why I added if condition to check if I am correctly removing the record.

 

Advertisements

Filed under: Dexterity Triggers, Dynamics GP, dynamics-gp, VSTools

Getting the current active window in Dexterity.

Using dexterity there is not a direct way of getting current active window information, but with set of available GP functions and triggers can make this task happen. Below I am sharing a trigger and function which can tell the active window name. Below code needs to be changed according to the needs of developer, I have hard-coded values just to give an idea of how it can be work. There is a good discussion regarding the same topic on below dynamics community link to understand different ways of getting active window information in dex and .net.

https://community.dynamics.com/gp/f/32/t/199211?pi53330=2#responses

 

local long l_result;

l_result = Trigger_RegisterFunctionByName(0,
“Security”, TRIGGER_BEFORE_ORIGINAL, function getResourceID_fun);

getResourceID_fun

function returns integer i;

inout integer dictid;
in integer resourcetype;
in integer resourceid;
optional inout string strValue;
optional in boolean bolValue;

warning Resource_GetResourceName(0, 2, resourceid);

 

 

 

 

Filed under: Dexterity Triggers, Dynamics GP, Uncategorized

Hints and Tips… On going Post

This is on going post and points will be added from time to time. 🙂

.. with Field Level Security we can not restrict document access on Sales transaction entry Window. Means we can not make user to choose only ‘Invoices’ in SOP Type drop down.

.. we can not add custom table in table relationship of GP tables for report writer, while modifying report in dictionary. Because we can not drop/create GP table and update it’s relationship information.

..To access ‘Human Resource Preferences’, go to Tools>>Setup>>System>>Human Resource Preferences

.. To have ‘Mail Recipient (PDF)’ option available, Adobe PDF writer must be install on machine.

.. Triggers can be register against local fields on window.

Filed under: Dynamics GP, dynamics-gp

Reversing the sort order of Receivable Transaction Inquiry – Customer by Document Date

Last few months we got more request on changing sort orders of Inquiry windows and lookups and to cover them all in a one place I have been working on a small project which will provide a simple sorting without much effort. In Dynamics Community there was a post having similar situation, I have already worked on this sort option and so sharing a solution here so if anybody want can use it ( free of any cost). This one window is a part among other windows I have added sorting functionality and it will hopefully be completed very soon with easy to install and remove functionality. Below is a link for downloading chunk file, all we need to do is to copy this chunk file inside a GP folder and then login to GP with user ‘sa’ and on message to add new code press ‘yes’ button and login to GP. The product ‘amSort’ will be added in .set file.

In order to remove the functionality , product can be easily delete from dynamics.set file.

https://www.dropbox.com/s/v4zvknh2o49l6w8/amSort.zip?dl=0

 

 

Filed under: Dynamics GP, dynamics-gp

Getting the current open window in .net GP Add In

There are many ways of getting information of active window in GP, but it changes according to the developing tool we are working on.

1.Dexterity.(the best tool 🙂 <3)

2.VS Tools For Dynamics GP

2.Continuum API (and so adding reference of this API in Custom Visual Studio AddIn.)

1.Dexterity provide various function, with the help of the combination of those functions we can find the active window information. Or we can also use COM objects to do the same.All we need to do is to add a COM Type Library and then use the objects and properties.

2.VS Tools , with available dynamics objects and execute sanscript function, it’s far more easier to find active window in VSTools for Dynamics GP project then in standard visual studio application.

3.Standard Visual Studio App, even can give us clue of active window by adding continuum API reference to it. Below is a code I just tried with Visual Studio 2013.

Public Class Form1

Public GPApp As Dynamics.Application
Dim s1, s2, s3, s4 As String

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

GPApp = GetObject(“”, “Dynamics.Application”)
GPApp.GetDexActiveWindow(s1, s2, s3, s4)
MsgBox(s1)
MsgBox(s2)
End Sub
End Class

Details about this of GetDexActiveWindow() method is below.The GetDexActiveWindow() method returns 4 string parameters that tell us the Form technical name,window technical name, dictionary name and window title. Shown below is an example of this code:

Dim result As Boolean
Dim mystr1 As String
Dim mystr2 As String
Dim mystr3 As String
Dim mystr4 As String

result = eEnterpriseApp.GetDexActiveWindow(mystr1, mystr2, mystr3, mystr4)

MsgBox (“Form Name = ” & mystr1)
MsgBox (“Window Technical Name = ” & mystr2)
MsgBox (“Dictionary Name = ” & mystr3)
MsgBox (“Window Title = ” & mystr4)

 

classb

out put

There are other cool ways we can use to find active window name, title. I have used one by using batch file and command prompt commands from within Dexterity to find the active window. Good programmer use windows API to do the same. 😉  And Dexterity experts also trigger the application to provide them what they are looking for. 😀

below is the source and inspiration for this post.

inspiration

Filed under: Dexterity Development, Dynamics GP, dynamics-gp

Not all RW_Function are meant for reports.

There are lots of RW functions available in a report writer Calculated Field Definition window and almost all of them are so handy while working on report writer, but it is a matter of fact that some of them are not actually meant for report writer. Usually RW functions are associated with report writer and dex people sometime ignore a fact that RW function can be created equally as for Form or window access, and may be called by multiple windows and events.

While working with report writer I com across a similar function, which is actually call by dynamics gp window and when I tried to use it on report write it returns nothing. The function I am talking about is rw_ivGetFuncListPrice().

When I called the same function from dexterity window it returns me the correct value. So I log a script of my code calling this function and gets a bunch of activity.

ListPriceLog

On calling function, it creating instance of form ivItemCurr and then setting values, and then calling another function GetListPrice() of form ivItemCurr, These functions may referencing the various information for item objects and GetListPrice() function is actually returning the List price of item, and that’s why when calling from item maintenance window returning a valid value. Calling same function from Sales transaction Entry window with passing same item number returns nothing, just like a report writer.

To get list price, a custom RW_Function is a solution, and if directly using repory writer modifier and VBA can do the work.

 

 

 

 

 

 

 

Filed under: Dynamics GP, dynamics-gp,

Dexterity Can Wait and Respond.

https://evspakistan.wordpress.com/microsoft-dexterity-can-wait-respond/

Filed under: Can i, Dexterity Development, Dynamics GP, dynamics-gp, Uncategorized, , ,

Cross Dictionary Development.

https://evspakistan.wordpress.com/cross-dictionary-development/

 

 

Filed under: Dexterity Development, Dexterity Triggers, Dynamics GP, dynamics-gp, Uncategorized

Calling Sales Document Numbers Lookup

Often developers need to open available lookup on their custom form from dynamics GP.Sales Document Number lookup is a very common and much used lookup and every dynamics technical person needs to call it in once (or more) in their lifetime. 🙂

Dynamics GP SDK provide a prototype of coding on how to open various lookup. Although it has given a much detailed list of parameters, the drawback is that we can not apply filter on the GP traditional lookup.

As with SDK prototype, desired document type can be focused but we can not make a lookup to fill only specific document type.

This leads developers to design 3rd party windows and then calling them.

SDK Prototype:

open form SOP_Document_Lookup return to ‘(L) DummySOPReturn’;
call OPEN of form SOP_Document_Lookup,
‘Sort By’, {initial sort unless overridden by starting seed of below parameters}
l_display, {documents to display}
work_or_history, {initially display WORK or HISTORY documents}
GB_locked, {lock the work/history radio group}
iSOPType, {seed value for SOP Type}
sSOPNumber, {seed value for SOP Number}
sCustomerNumber, {seed value for Customer Number}
sBatchNumber, {seed Number of Batch Number, Work Documents only}
sTRXSource, {seed Audit Trail code, History Documents only}
dDocDate, {seed Document Date}
iMasterNumber; {seed Master Number value}

In this SDK scrip calling example there are two optional parameters not used, but mentioned in parameters description which you can get detail from parameter list.

  • IN12 optional OpenedFromTrx parameter used by the SmartList product
  • IN13 optional RestrictSOPType parameter that will restrict the lookup to a specific SOP Type.

By supplying these two parameters we can filter lookup with desired sales type and can avoid designing of a whole new custom lookup form.Below is a code of calling lookup, I am just giving the idea of passing parameter and so hard-coded the values.

open form SOP_Document_Lookup return to ‘(L) FromDocNumb’;
call OPEN of form SOP_Document_Lookup,
4,
0,
WORK,
1,
2,
“”,
“”,
“”,
“”,
l_date,
0,
true,
soptype;

The last  parameter is telling that you are about to filter the lookup with the selected type on custom form. This will work find if your alternate smartlist lookup is marked, but if traditional GP lookup is marked, it will not filter the document types.

 

SOPLOOKUPFIlter

The hard thing for many developers is that they can not test the code in debug mode\test mode, as the lookup mark is in another dictionary and gives a message “Cannot access this form because the dictionary containing it is not loaded.”, so to test code functionality, developer have to create a chunk and then add a code in GP.

 

Filed under: Dexterity Development, Dynamics GP, Dynamics GP Lookups, dynamics-gp, ,

This datatype name is already in use.

Few days back I got a small task of increasing length of field Dependent SSN of window Employee Dependents.User could only enter 9 characters on this field although the storage size of this field is 16 characters.After checking field properties I just realized that the format assigned to the field is actually not allowing it to enter 15 characters. I just opened the window in modifier and tried to change the format to new one so could allow max of 15 characters, but got the error “This datatype name is already in use”.ddn1

So I checked the dictionary from which this window originates and found it in Human Resources. So I checked the field which is using this data type.

dssn

And then check other fields in Employee Maintenance window, there I found social security number and check that in modifier. and check the field definition. So it has the same data type which the other field from HR module is using.

ssn

ssn1

So I went back to Dynamics GP, and instead of going to modifier by selecting the option ‘Modify current window’, I go to modifier by Tools>>Customize>>Modifier and  then selected the product ‘Microsoft Dynamics’.

Then from Resources selected the Data Type and then open ‘STR15_Social_Security_Number. And change the format of datatype, this time it’s allow me to save the change without any warning. 🙂

final

Filed under: Dynamics GP, dynamics-gp, Modifier, , , ,

Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Enter your email address to follow this blog and receive notifications of new posts by email.

almas

Error: Please make sure the Twitter account is public.

Blog Stats

  • 8,647 hits

RSS dynamics-gp

  • VSTools and database triggers.
    In SanScript coding we have database triggers, Below is a detail of what database triggers are as explained in dexterity manuals. Database triggers Database triggers are activated by successful table operations, such as a record begin read, saved, or deleted. The procedure that runs in response to a database trigger has access to the same […]
    Almas
  • Getting the current active window in Dexterity.
    Using dexterity there is not a direct way of getting current active window information, but with set of available GP functions and triggers can make this task happen. Below I am sharing a trigger and function which can tell the active window name. Below code needs to be changed according to the needs of developer, […]
    Almas
  • Hints and Tips… On going Post
    This is on going post and points will be added from time to time. 🙂 .. with Field Level Security we can not restrict document access on Sales transaction entry Window. Means we can not make user to choose only ‘Invoices’ in SOP Type drop down. .. we can not add custom table in table […]
    Almas
  • Reversing the sort order of Receivable Transaction Inquiry – Customer by Document Date
    Last few months we got more request on changing sort orders of Inquiry windows and lookups and to cover them all in a one place I have been working on a small project which will provide a simple sorting without much effort. In Dynamics Community there was a post having similar situation, I have already […]
    Almas
  • Getting the current open window in .net GP Add In
    There are many ways of getting information of active window in GP, but it changes according to the developing tool we are working on. 1.Dexterity.(the best tool 🙂
    Almas
  • Not all RW_Function are meant for reports.
    There are lots of RW functions available in a report writer Calculated Field Definition window and almost all of them are so handy while working on report writer, but it is a matter of fact that some of them are not actually meant for report writer. Usually RW functions are associated with report writer and […]
    Almas
  • Dexterity Can Wait and Respond.
    https://evspakistan.wordpress.com/microsoft-dexterity-can-wait-respond/Filed under: Can i, Dexterity Development, Dynamics GP, dynamics-gp, Uncategorized Tagged: Delay, dexterity, Wait
    Almas
  • Cross Dictionary Development.
    https://evspakistan.wordpress.com/cross-dictionary-development/    Filed under: Dexterity Development, Dexterity Triggers, Dynamics GP, dynamics-gp, Uncategorized
    Almas
  • Calling Sales Document Numbers Lookup
    Often developers need to open available lookup on their custom form from dynamics GP.Sales Document Number lookup is a very common and much used lookup and every dynamics technical person needs to call it in once (or more) in their lifetime. 🙂 Dynamics GP SDK provide a prototype of coding on how to open various […]
    Almas
  • This datatype name is already in use.
    This datatype name is already in use.
    Almas
Coding Notes

Code, News, Tech & Stuff

Dynamics GP Builders & Reporting

How to use MS Dynamics SmartList Builder, Excel Report Builder and other Reporting tools to get the data and analysis you need.

%d bloggers like this: