Multiple Assign: Can not assign 'in_TransactionItem.SpecificContent("First Name").ToString' to 'FirstName'

Multiple Assign: Can not assign ‘in_TransactionItem.SpecificContent(“First Name”).ToString’ to ‘FirstName’.

error>> {
“message”: “This is System Exception Geting the Details from the QueueSystem.InvalidOperationException: Can not assign ‘in_TransactionItem.SpecificContent("First Name").ToString’ to ‘FirstName’.\r\n —> System.NullReferenceException: Object reference not set to an instance of an object.\r\n at Namespace_eb3a.Process_Expressions.Process_Expressions_TypedDataContext2_ForReadOnly.__Expr1Get()\r\n at Namespace_eb3a.Process_Expressions.Process_Expressions_TypedDataContext2_ForReadOnly.ValueType___Expr1Get()\r\n at Namespace_eb3a.Process_Expressions.InvokeExpression(Int32 expressionId, IList1 locations, ActivityContext activityContext)\r\n at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)\r\n at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity)\r\n at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)\r\n at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate)\r\n at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)\r\n at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)\r\n — End of inner exception stack trace —\r\n at System.Activities.Statements.Throw.Execute(CodeActivityContext context)\r\n at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)\r\n at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)”,
“level”: “Error”,
“logType”: “User”,
“timeStamp”: “20:38:34”,
“fileName”: “Process”,
“jobId”: “18a925c8-67ac-4d72-9288-12fbe218ce0a”,
“robotName”: “mulani.mohasin123@gmail.com-attended”,
“machineId”: 5100623,
“userKey”: “be0cffbd-4f0f-427b-8989-bdb42f5b10bc”,
“processVersion”: “1.0.0”,
“organizationUnitId”: 6865198,
“businessOperationId”: “1699c4fa83074e1c97e6e95e3a506d08-04cded798724440f91c27d1a2367567e”
}

1 Like

Hi @Mohasin_Abasaheb_Mulani

Make sure the key present in the transaction item and the key you gave are same.

Please share the screenshot of the transaction item details.

Hope it helps!!

@Mohasin_Abasaheb_Mulani

when this error happens inmulti assign the it means the right side expression is failing..please check the key and locals panel for correct values

cheers

Hi @Mohasin_Abasaheb_Mulani

Please check if you are passing in transaction item variable to your in argument.

Also verify the key name you are using is same as the one you added in queue.

You can verify it from your add queue item activity.

Or you can verify it from your queue in orchestrator.

Regards
Sonali

Hi @Mohasin_Abasaheb_Mulani
Check if the Queue Item contains “First Name”

Ensure the queue item being processed actually contains a value for "First Name" in its SpecificContent.

  • Go to Orchestrator → Queues → View Transactions
  • Find the relevant queue and transaction
  • Check if the item has the "First Name" key and that it has a value

pleae share a snapshot of your queue item

@Mohasin_Abasaheb_Mulani,

Most probably the in_TransactionItem is null or nothing.

Check the value in locals panel while debugging to identify the issue.

@Mohasin_Abasaheb_Mulani

Could you please also check if value transaction item is being passed from process state to inside workflow as an in argument and it’s not null?

Do it in a normal assign and you’ll see a much clearer error message showing the issue. Multi assign is nice for housekeeping, but doesnt do the best job at showing the error as you need to look deeper into the errors inner exception if I recall.

Why are you doing this? There’s no reason to assign transaction values to local variables. It creates added complexity and overhead. You should just use the in_TransactionItem.SpecificContent values anywhere you need them.

Readability, UiPath UI boxes are small. It’s to know what variable is being used inside code, instead of “in_TransactionItem.Sp..” , you can actually see what variable you are using.

For example, here I can see that I’m using the specific content “Customer”, rather than having to open up the assign to see what I’m using.

I’d propose what I think is a better solution that follows some coding best practices.

Make a coded source file that contains all these properties, so in your case Customer and ‘doStuff’, and at the start of your process load all your specific content to that, I do it via a constructor that takes the queue item so its a simple one liner in the process.xaml

From there you can use it nicely, without a cluttered variables pane as you group them together, aswell as the added benefits of readability, strong data typing and making sure up front that all your values in the specific content are populated and validated.

All you have to do is edit the name of the activity with the Key you’re using. Notice that you can’t actually see in any of the Assigns what’s on the right side. So now when someone encounters the Customer or doStuff variable in the process, they have to go find where you assigned that value to figure out what it contains.

@postwick Its useful for strong data typing and making sure all the data is valid as you start. Better when you add it to a full class, but you are making an issue out of nothing here, there is nothing wrong with doing this.

Fair idea, may have to try it out that way on my next process!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.