Developing for Dynamics GP

by David Musgrave (Perth, WA, Australia) and the Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

How to modify a field value in a line when generating the EFT file?

How to modify a field value in a line when generating the EFT file?

  • Comments 4

Viswanathan Neelakantan - Click for blog homepageI am a motivated and detail conscious graduate who is a certified Microsoft Dynamics GP consultant. I display considerable strength across a wide range of technical as well as functional skills in particular development, customization together with problem solving. I enjoy working within a team environment together with the challenge of carrying through individual tasks which has been experienced throughout my professional career in Dynamics GP, which spans six years. This is my first article in this blog and I am proud to be able to blog with the Dynamics GP gurus.

In this post we will discuss how we can use Dexterity to customize the EFT file generation process to modify a field value in the EFT file. There would be cases where we might need to perform a calculation and show it in the EFT file. If the calculation can’t be mapped to any of the existing fields in the EFT Format Setup window, the only option left is to customize the EFT file generation process.

The field values in the EFT line can be modified by writing a trigger on the function "GenerateEFT_Line_GetFieldString" on the form cmEFTFormatSetup. In the trigger processing function, the value returned by the original function can be modified to the calculated value and returned to the calling script.

Trigger Registration Code Example

{Name: Startup}
{
This script is used to register the trigger on function GenerateEFT_Line_GetFieldString of form cmEFTFormatSetup.

Revision History
No. User   Date  Description
------------------------------------------------------------------
}

local long l_result;

l_result = Trigger_RegisterFunction(function GenerateEFT_Line_GetFieldString of form cmEFTFormatSetup,TRIGGER_AFTER_ORIGINAL,function Modify_EFT_Line_Field_Value);

if l_result <> SY_NOERR then
 warning “Trigger Registration failed for Modify_EFT_Line_Field_Value" + str(l_result);
end if;


Custom function to update field value in EFT File

{Name:  Modify_EFT_Line_Field_Value}

{This script is used to modify the value of the EFT field passed in.

Revision History
No. User   Date  Description
------------------------------------------------------------------
}


function returns string sFieldString;
in integer inLineType;
in integer iNationalBankSeq;
in boolean fIsCredit;
in boolean fIsPrenote;
in boolean iOpen;  
in date  dSettlementDate;
in date  dSystemDate;
in time  tSystemTime;
in string sPad;
in integer iJustify;
inout string   sXMLOpen[10];
inout string   sXMLClose[10];
inout text   sXMLText[10];
inout boolean   isData[10];
inout EFTCalculations  EFTCalculations;
inout integer   ioFileNumber;
inout integer   ioBankFileNumber;
inout table AddressEFT,    
       CM_Checkbook_MSTR,  
       cmCheckbookEFT,   
       cmEFTFormatHdr,   
       cmEFTFormatDtl,   
       cmTransactionEFT,  
       PM_Apply_To_OPEN_OPEN, 
       PM_Apply_To_HIST,   
       PM_Address_MSTR,  
       PM_Vendor_MSTR,   
       RM_Customer_MSTR,  
       RM_Customer_MSTR_ADDR,
       SY_Location_MSTR;  
   
if inLineType = <xxxx > then
 if 'EFT Format ID' of table cmEFTFormatDtl = <yyyy> then
  if Description of table cmEFTFormatDtl = <zzzz> then
   sFieldString = <calculation> 
  end if;  
 end if; 
end if;


xxxx - The integer value representing the Line Type where the field whose value need to be modified exists. For e.g. 1 for Header Label 1, 2 for Header Label 2 so on.
yyyy - EFT Format ID value which needs to be customized.
zzzz - Description of the field on the Line type whose value need to be modified.

For example: There is a requirement to show a field named Payment Date in the format YYYY-MM-DD. The Payment Date field in the Detail Line Type is mapped to Document Date field in the PM Paid Transaction History File having the date format as YYYYMMDD. When the EFT file is generated the Payment Date field value can be modified to the format YYYY-MM-DD by customizing the EFT file generation process. The screen shot below shows the Payment Date field in the EFT Format ID named TEST

 

Example: Custom function to modify the field value

if inLineType = 5 then {Line Type Detail}
 if 'EFT Format ID' of table cmEFTFormatDtl = "TEST" then {EFT Format ID}
  if Description of table cmEFTFormatDtl = "Payment Date" then {Field Description}
   l_date = mkdate(   integer  (substring(sFieldString,5,2))
                     ,integer  (substring(sFieldString,7,2))
                     ,integer  (substring(sFieldString,1,4)));
   l_modified_date = string(year(l_date)) + "-"
                   + string(month(l_date)) + "-"
                   + string(day(l_date)); 
   sFieldString = string (l_modified_date);
  end if;  
 end if; 
end if;

 

In the screen shot below the modified Payment Date field is highlighted

That's all for now.

Viswa

  • Posting from Mark Polino at DynamicAccounting.net

    msdynamicsgp.blogspot.com/.../how-to-modify-field-value-in-line-when.html

  • Viswa -

    I take it this can only be done through Modifier correct?

    Thanks,

    Sean

  • Sean,

    This was done via Dexterity - nothing to do with Modifier or VBA.

    But I think perhaps that you might be able to use GP Visual Studio Tools for GP 2010 for this as well.

  • awesome post..But when i am using the trigger my trigger in startup is not registering.

    I am getting SY_INVALID_SCRIPT . same exact script i used. any solutions.

Page 1 of 1 (4 items)
Comments Information

PLEASE READ BEFORE POSTING

Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 6 and 2 and type the answer here:
  • Post