0% found this document useful (0 votes)
146 views6 pages

2-Epicor BPM Custom Code Examples - Create Journals - GingerHelp

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views6 pages

2-Epicor BPM Custom Code Examples - Create Journals - GingerHelp

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

5/16/24, 3:26 PM Epicor BPM Custom Code Examples - Create Journals — GingerHelp

[email protected]

C R E AT I N G AU TO M AT I C
JOURNAL ENTRIES VIA
BPM
ADAM ELLIS · JULY 16, 2020

EPICOR BPM CUSTOM CODE EXAMPLES • FOR


EPICOR KINETIC, V10, V9

I covered this similar territory in my other article on Using Transaction


Scopes In BPMs, but I figured there might be folks searching just for the
example used within that article so here you go! Creating journal entries
from BPMs is easy and fun! Ok, maybe not fun. You are going to need to
reference this article to understand the details of adding assembly
references to your DLL - we need to get GLJrnGrp and GLJournalEntry
added in. After that, your code will just need to look like this - I’ve got
annotations in here that are hopefully sufficient:

// Custom Code
//////////////////////////////////////////////////////////
var jrnGrp = ServiceRenderer.GetService<Erp.Contracts.GLJr
var jrn = ServiceRenderer.GetService<Erp.Contracts.GLJourn

Erp.Tablesets.GLJrnGrpTableset jrnGrpTs = new Erp.Tableset


Erp.Tablesets.GLJournalEntryTableset jrnTs = new Erp.Table

string groupId = "MYGROUP";

https://www.gingerhelp.com/knowledgebase-epicor-erp/creating-automatic-journal-entries-via-bpm 1/6
5/16/24, 3:26 PM Epicor BPM Custom Code Examples - Create Journals — GingerHelp

using (var txscope = IceDataContext.CreateDefaultTransacti


{
// Create the journal group
jrnGrp.GetNewGLJrnGrp(ref jrnGrpTs);
jrnGrpTs.GLJrnGrp[0].GroupID = groupId;
jrnGrp.Update(ref jrnGrpTs);

// Add a new journal to the group


jrn.GetNewGlJrnHedTran(ref jrnTs, groupId);
bool requiresUserInput;
jrnTs.GLJrnHed[0].Description = "My Cool Journal Entry";
jrn.PreUpdate(ref jrnTs, out requiresUserInput);
jrn.Update(ref jrnTs);
int journalNum = jrnTs.GLJrnHed[0].JournalNum;

// Add the credit (GL account and amount hard coded for
jrn.GetNewGLJrnDtlMnl(ref jrnTs, "MAIN", DateTime.Now.Ye
bool currCodeChanged;
jrnTs.GLJrnDtlMnl[0].GLAccount = "12345|AA|123|0";
jrn.ChangeGlAcct1(1, ref jrnTs, out currCodeChanged);
jrnTs.GLJrnDtlMnl[0].TotCredit = (decimal)100.00;
jrn.Update(ref jrnTs);

// Add the debit


jrn.GetNewGLJrnDtlMnl(ref jrnTs, "MAIN", DateTime.Now.Ye
jrnTs.GLJrnDtlMnl[1].GLAccount = "12345|BB|123|0";
jrn.ChangeGlAcct1(2, ref jrnTs, out currCodeChanged);
jrnTs.GLJrnDtlMnl[1].TotDebit = (decimal)100.00;
jrn.Update(ref jrnTs);

// Post it
string notAllPosted;
jrnGrp.CheckBeforePost(groupId);
https://www.gingerhelp.com/knowledgebase-epicor-erp/creating-automatic-journal-entries-via-bpm 2/6
5/16/24, 3:26 PM Epicor BPM Custom Code Examples - Create Journals — GingerHelp

jrnGrp.PostGroupJournals(groupId, out notAllPosted);


jrnGrp.UnlockGroup(groupId);

Db.Validate();
txscope.Complete();
}
//////////////////////////////////////////////////////////

LET'S CHAT ABOUT YOUR EPICOR ERP


CUSTOMIZATION PROJECT

AUTHOR: Adam Ellis


Adam Ellis is the owner of
GingerHelp. Adam is a lifelong
entrepreneur and has extensive ERP
and mobile software knowledge
through his consulting and
management experience. He has a
passion for exploring innovative ideas
and how they can change the status
quo. Connect with Adam on LinkedIn
to learn more about his involvement
in the ERP space.

FACEBOOK TWI TTER PINTEREST 0 LIKES

COMMENTS (1) Newest First

https://www.gingerhelp.com/knowledgebase-epicor-erp/creating-automatic-journal-entries-via-bpm 3/6
5/16/24, 3:26 PM Epicor BPM Custom Code Examples - Create Journals — GingerHelp

Preview POST COMMENT…

Usuario 3 years ago · 0 Likes

Hi, I want to create a new PO from a BPM but I don´t know how to call the Method and
send parameters. Can you help me?

PREVIOUS

USE OTRANS.SESSION TO DETERMINE EPICOR SESSION


VARIABLES
EPICOR CUSTOMIZATION, EPICOR ERP

NEXT

USING EPICOR TRANSACTION SCOPES IN BPMS


EPICOR ERP, EPICOR BPM, EPICOR CUSTOMIZATION

LET’S CHAT!

CONTACT US

https://www.gingerhelp.com/knowledgebase-epicor-erp/creating-automatic-journal-entries-via-bpm 4/6
5/16/24, 3:26 PM Epicor BPM Custom Code Examples - Create Journals — GingerHelp

GINGERHELP, SERVIC PRODU KNOWLEDGE


LLC ES CTS BASE

8685 Fox Epicor ERP Epicor ERP Epicor ERP Articles


Lake Road Consulting Extensions Infor VISUAL Articles
Sterling, OH P21 ERP Infor Dynamics 365
44276 USA Consulting VISUAL ERP Articles
Infor Extensions Crystal Reports
 VISUAL ERP Articles
[email protected] Consulting SSRS Articles
Dynamics Bezlio for Mobile
365 ERP Articles
Consulting
SSRS
Developer
Services
Crystal
Reports
Consulting

GingerHelp is an
independent consulting
practice with no direct
© 2019 - 2023 GingerHelp,
affiliation with Epicor® or
LLC
Infor®.

Terms & Conditions |


Epicor®, Vantage®, and Privacy Policy
Prophet 21™ are registered
trademarks of Epicor
Software Corporation®.

https://www.gingerhelp.com/knowledgebase-epicor-erp/creating-automatic-journal-entries-via-bpm 5/6
5/16/24, 3:26 PM Epicor BPM Custom Code Examples - Create Journals — GingerHelp

Infor® and VIUSAL® are


registered trademarks of
Infor®.
Crystal Reports® is a
registered trademark of SAP
AG.

https://www.gingerhelp.com/knowledgebase-epicor-erp/creating-automatic-journal-entries-via-bpm 6/6

You might also like