cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jamz
Frequent Visitor

Create record in Business Central Journal Lines

The Power Automate action Create Record in Business Central journal lines, doesn't have the fields/object to fill in journal batch ID or journal ID. But when tested, the error says "You must specify a journal batch ID or a journal ID to get a journal line."

Has anyone successfully used Power Automate to create records in BC journal lines? If so, what's the work around this limitation?

 

Thanks.

14 REPLIES 14
ryguyt
New Member

Initially it contains the fields to specify organization and table name, once the table name is selected (journalLines), I wait a few second and new fields appear below including the journalId. Although I'm entering the journal batch into the journalId field, I'm getting the same error as @Jamz 

Jamz
Frequent Visitor

We found a workaround using HTTP Post Method to load SQL rows to BC journal line.

Care to elaborate?

achilles1988
New Member

Did you ever figure this out? Seems absurd to me that they have a pre-built connector, but somehow you need fields that aren't available.

RobF
Advocate I
Advocate I

The is how we got this working:

 

Use HTTP GET to retrieve the record by filtering on the Journal Batch Name:

RobF_0-1648579392612.png

 

Use Parse JSON with the HTTP Body as input:

RobF_1-1648579442071.png

 

The Parse JSON will output all the journal table fields including the GUID, which we assign to a variable and then use as input for the standard BC actions:

RobF_2-1648579530862.png

 

RobF_3-1648579657546.png

 

Thanks for the reply. I think I saw your other post on this method as well (after some extensive Googling). However, isn't the journal batch ID a static value? I traced between the Journal Batches view, which it's called SystemID in and then at journal line level it's called the JournalBatchID. So could we not just force the static value in Power Automate if we know the Journal BatchID? You would need some logic in your flows to set different IDs then based on what type of batch you wanted to use then (if you're using multiple batches). Do you think this would work? 

 

Also, how are you using that BatchID when creating the journalLines in Power Automate?

 

RobF
Advocate I
Advocate I

@achilles1988 Yes I think you are correct, the journal batch GUID is static and you could use that instead of the journal batch name in the workflow steps if you know the GUID value in advance.  In our case the data in our SQL table already has the batch name assigned.  We also found for troubleshooting Power Automate errors that it is easier to see the journal batch name instead of the GUID in the output.

 

For loading the journal lines, we are using HTTP POST, only because the standard journalLines API v2.0 doesn't have fields for inputting the Dimensions, which we require, and so we published our own Web Service page for it.

 

RobF_0-1648581036025.png

 

achilles1988
New Member

Ah. I hadn't even got that far to notice. I would also require dimensions. Pretty severe limitation of the Power Automate connector for BC.

 

May I ask what tables did you need to expose to web services to get that to work?

RobF
Advocate I
Advocate I

Hi, we published page 39 General Journal to load the journal lines.

HI, thanks for this info, I am facing the same issue since the dimensions are not exposed via the business central connector. Can you expand on your authentication method for your API call? I am seeing using token, azure api, but I was wondering if there was something simpler that I am missing?

ice1234
Frequent Visitor

Has anyone found a solution to this? I have the journalbatchID and I'm using that in the JournalID column and I get this error message. It works in another flow but not this one and I can't figure out why. 

ryguyt
New Member

@ice1234 I was only able to get this working using @Jamz solution, which was detailed by @RobF above

Do-the-flow
New Member

Ok, perhaps this will help people, I was struggling with this error initially with Business Central / Power Automate.

 

First I created a G/L batch named "AUTOMATE" in business central.

Finance > General Journals > + New > Name=AUTOMATE, Description=Power Automate Journal Batch

Dotheflow_0-1668453362124.png

 

Next I'm going to use the Find Records to locate the AUTOMATE code

The key is to filter the search using ODATA startswith(code,"AUTOMATE") and set the Top Count to 1 (only want the 1 record, however it will still be an array of records, even if it's 1).

Dotheflow_3-1668453769858.png

 

And then I just used the "id" from the Find Records, because it's an "array of 1", it wraps "Apply to each" around it.

I tried using the select and compose/parse json to avoid the apply to each but wasn't having quick success and didn't want to play around with it, if anyone knows how to eliminate the apply to each would be perfect.

Dotheflow_4-1668454240698.png

I see the journal line in my AUTOMATE batch in Business Central:

Dotheflow_5-1668454994688.png

 

Now in business central I can filter the batch and post the journal lines that I want from the batch.

Great work, but can you add dimenions?

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,349)