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?
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
The is how we got this working:
Use HTTP GET to retrieve the record by filtering on the Journal Batch Name:
Use Parse JSON with the HTTP Body as input:
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:
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?
@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.
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?
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?
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.
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
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).
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.
I see the journal line in my AUTOMATE batch in Business Central:
Now in business central I can filter the batch and post the journal lines that I want from the batch.