0

I'm creating a journal entry via Suitetalk but this journal entries gets created in a "Pending Approval" status, I need it to be approved.

I'm sending the fields approved and approvedSpecified as true but the journal entry doesn't get approved this way.

Anyone knows how I can achieve this?

Thank you.

1 Answers1

0

Setting approved = true and approvedSpecified = true are enough to create an approved journal entry via SuiteTalk. In testing this, I did have to disable an existing workflow that forced new JE's to go into a Pending Approval state. Perhaps you have some other customization that is preventing the creation of a JE in an approved state.

The following code worked for me.

var journal = new JournalEntry
{
    tranDate = DateTime.Now,
    approved = true,
    approvedSpecified = true,
    subsidiary = 2.ToRecordRef(),
    memo = "test",
    lineList = new JournalEntryLineList
    {
        line = new List<JournalEntryLine>
        {
            new JournalEntryLine
            {
                account = 122.ToRecordRef(),
                credit = 100F,
                creditSpecified = true
            },
            new JournalEntryLine
            {
                account = 122.ToRecordRef(),
                debit = 100F,
                debitSpecified = true
            }
        }.ToArray()
    },
};

var response = ns.add(journal);
Mike Robbins
  • 3,184
  • 15
  • 20
  • There is any way to know if there is any workflow affecting my Journal Entry creation? I'm looking into Customization>Workflows but it seems that anyone is related to Journal Entries. – Daniel Forero Aug 07 '17 at 20:23
  • Go to `Customization -> Scripting -> Scripted Record -> Journal Entry`. This will list all scripts and workflows that are working against journal entry records. You'll need to check each one to see if it's affecting the approval status. – Mike Robbins Aug 07 '17 at 20:36
  • Thank you for for help, there are some scripts from bundles but neither of them is affecting the approval status field, I was looking information about this and seems that my Approval Status field is different than the default field, I have a select called Approval Status with three options: [Pending Approval, Approved, Rejected] but in all places I looking for there is a check box called Approved.. I guess this is my problem, but I'm unable to find where to update this field, isn't a custom transaction field either. – Daniel Forero Aug 08 '17 at 12:58
  • According to the Schema Browser, there isn't a built-in field like that on Journal Entries. It only shows the Approved field as a boolean. If you turn on "Show Internal IDs" (Home -> Set Preferences -> Show Internal IDs) and click the field name on the form, it should show the script id of the field at the bottom of the popup. What's field name is displayed there? – Mike Robbins Aug 08 '17 at 15:21
  • According to the Records Browser, that field can only be returned in the result of a search. It's probably just a text representation of the actual approval status field. I don't immediately see a way to access the value of that field via SuiteTalk or SuiteScript except through a search. – Mike Robbins Aug 08 '17 at 15:55