Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

CRM Custom workflow - An unexpected error occurred

(0) ShareShare
ReportReport
Posted on by 1,695

CRM2016 On premises

I have created a plugin to drag in records from a SQL server, however I am getting an unexpected error occurred.

I'm at a total loss as to how to track down what is causing this error.

Does CRM have any workflow logs when looking in the workflow Process sessions there are no records.

Dim NewTransaction As New Entity("new_transactions")

                    Dim rtn_TransactionValue As Decimal = SQLReader.GetDecimal(TransValue)

                    NewTransaction("new_transactionsetid") = context.PrimaryEntityId

                    NewTransaction("new_createdon") = CDate(SQLReader.GetValue(CreatedDate))

                    NewTransaction("new_createdby") = CreatedByID

                    NewTransaction("new_sortcode") = SQLReader.GetString(DestSortCode)

                    NewTransaction("new_accountnumber") = SQLReader.GetString(DestAccountNumber)

                    NewTransaction("new_daccountname") = SQLReader.GetString(DestAccountName)

                    NewTransaction("new_reference") = SQLReader.GetString(DestBankRef)

                    NewTransaction("new_value") = rtn_TransactionValue

                    NewTransaction.Attributes.Add("new_transactioncode", New OptionSetValue(SQLReader.GetValue(TransCode)))

                    NewTransaction.Attributes.Add("new_transactiontype", New OptionSetValue(SQLReader.GetValue(TransType)))

                    NewTransaction("new_rti") = SQLReader.GetString(RTICode)

                    service.Create(NewTransaction)

  • Pete_N Profile Picture
    Pete_N 1,695 on at
    RE: CRM Custom workflow - An unexpected error occurred

    Update,  I have tracked the error down

    The entity that is calling the workflow is new_transactionsets. The workflow creates a record in new_transactions

    new_transactionsets has a 1 : N relationship to new_transactions ( field in new transactions  new_transactionsetid )

    NewTransaction("new_transactionsetid") = context.PrimaryEntityId is the line that is causing the issue and I am getting an error ,

      <Message>There is no active transaction. This error is usually caused by custom plug-ins that ignore errors from service calls and continue processing.</Message>

    If I manually create a record in new_transactions and then look at the raw SQL table, I can see that the value in new_transactionsetid is the same as context.PrimaryEntityId

    Currently I am running the workflow as an On-Demand

    Help

  • Pete_N Profile Picture
    Pete_N 1,695 on at
    RE: CRM Custom workflow - An unexpected error occurred

    sorry should have said workflow not plugin

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans