web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

CRM Custom workflow - An unexpected error occurred

(0) ShareShare
ReportReport
Posted on by 1,703

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)

I have the same question (0)
  • Pete_N Profile Picture
    1,703 on at

    sorry should have said workflow not plugin

  • Pete_N Profile Picture
    1,703 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans