Object reference not set to an instance of an object while executing SetTransactionStatus.xaml


I am getting below error when trying to execute my workflow. It is failing in Set Transaction Status activity in SetTransactionStatus.xaml. Can someone please help what could be the reason?

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)



1). Before if loop , put log message and see what value you are receiving in “in_transactionfield1”.
2). Put log message like - “in_transactionfield1” + in_transactionfield1
3) Just check and confirm what u r get there !!

I got it fixed. In the if condition, I replaced in_TransactionField1 with in_TransactionItem. It worked fine. But in Orchestrator the status is showing as in-progress and not completed though the transaction is successful.