Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Issue with Submitting Purchase Requisition Workflow

Posted on by 130

Hello everyone,

I'm encountering an error while trying to submit a purchase requisition workflow in Microsoft Dynamics AX 2012 R3. When I click on the submit button, I receive the following error message:

Microsoft Dynamics AX Debugger

StackTrace: The company SysTransactionScopeCache does not exist.

StackTrace
(S)\Classes\SourceDocumentLineProcessor\submitSourceDocumentLineServer - line 66
(S)\Classes\SourceDocumentLineProcessor\submitSourceDocumentLine - line 51
(S)\Classes\SourceDocumentProcessor\submitSourceDocumentLinesForHeader - line 71
(S)\Classes\SourceDocumentProcessorFacade\submitSourceDocumentLinesForHeader - line 53
(S)\Classes\PurchReqWorkflow\validateAccountingDistributions - line 21
(C)\Classes\PurchReqWorkflow\canSubmit - line 36
(C)\Classes\PurchReqWorkflow\main - line 20
(C)\Classes\FormFunctionButtonControl\Clicked

Upon investigation, it seems that the [PurchReqLine table contains 4 rows, while the [SourceDcoumentLine table contains 5 rows. I suspect that the unlinked entry in the [SourceDcoumentLine table might be causing this issue. Can anyone provide guidance on how to remove the unlinked entry from the [SourceDcoumentLine table?

Here's the code block where the error occurs, specifically in line 68:

private static server void submitSourceDocumentLineServer(
    SourceDocumentLine                      _sourceDocumentLine,
    boolean                                 _updateImplementation,
    SourceDocumentLineAccountingStatus      _targetSourceDocumentLineAccountingStatus,
    SourceDocumentProcessorCaller           _caller,
    UserId                                  _user,
    AccountingDistributionAllocationMethod  _accountingDistributionAllocationMethod,
    SourceDocumentLineItem                  _sourceDocumentLineItem = null,
    AccountingPolicy                        _sourceDocumentLineAccountingPolicy = null,
    boolean                                 _isProcessForDocument = false,
    RecordInsertList                        _accountingDistributionInsertList = null,
    systemSequence                          _systemSequence = null,
    boolean                                 _doTransitionToCompletedStateAccountFullyQualifiedValidation = true,
    RecordInsertList                        _sourceDocumentLineTmpInsertList = null
    )
{
    SourceDocumentLineProcessor             sourceDocumentLineProcessor;
    SourceDocumentLineTargetStateProvider   sourceDocumentLineTargetStateProvider;
    SourceDocumentLineItem                  sourceDocumentLineItem;

    // Flush cache for source document line item
    SysTransactionScopeCache::remove(classStr(SourceDocumentLineItem), [_sourceDocumentLine.RecId, _sourceDocumentLine.RecVersion]);

    if (_sourceDocumentLineItem)
    {
        sourceDocumentLineItem = _sourceDocumentLineItem;
    }
    else
    {
        sourceDocumentLineItem = SourceDocumentLineItem::newFromSourceDocumentLine(_sourceDocumentLine);
    }

    sourceDocumentLineItem.parmCaller(_caller);

    sourceDocumentLineTargetStateProvider = SourceDocumentLineTargetStateProvider::newTargetStateProvider(
        _sourceDocumentLine,
        _targetSourceDocumentLineAccountingStatus,
        false,
        _caller,
        _user,
        false
        );

    sourceDocumentLineProcessor = SourceDocumentLineProcessor::newFromSourceDocumentLineImplementation(
        sourceDocumentLineItem.parmSourceDocumentLineImplementation(),
        _updateImplementation,
        sourceDocumentLineTargetStateProvider,
        _caller,
        _user,
        false,
        _accountingDistributionAllocationMethod,
        _sourceDocumentLine,
        sourceDocumentLineItem,
        _sourceDocumentLineAccountingPolicy);

    sourceDocumentLineProcessor.parmDoTransToCompletedStateAccountCheck(_doTransitionToCompletedStateAccountFullyQualifiedValidation);
    sourceDocumentLineProcessor.parmIsProcessForDocument(_isProcessForDocument);

    if (SourceDocumentLineProcessor::doSetBasedOperationOptimization(sourceDocumentLineItem))
    {
        sourceDocumentLineProcessor.parmAccountingDistributionInsertList(_accountingDistributionInsertList);
        sourceDocumentLineProcessor.parmAccountingDistributionSystemSequence(_systemSequence);
        sourceDocumentLineProcessor.parmSourceDocumentLineTmpInsertList(_sourceDocumentLineTmpInsertList);
    }

    changecompany(CompanyInfo::getDataArea(sourceDocumentLineItem.parmLegalEntityRecId()))
    {
        sourceDocumentLineProcessor.submit(); <-------------- Error
    }
}

I have taken the following steps to troubleshoot the issue, but unfortunately, they did not resolve the problem:

  1. Compilation
  2. Full CIL
  3. Synchronization

I would greatly appreciate any assistance or suggestions to resolve this problem.

Thank you in advance for your help!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans