Skip to main content

Notifications

Announcements

No record found.

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

"An Activity can only get the location of arguments which it owns."

Posted on by 210

A customer is running CRM 8.1 on-prem with a LOT of workflows. Sometimes these workflows will fail with the error: "An Activity can only get the location of arguments which it owns." This error is not reproducible (i.e. running / triggering the same workflow again will not cause the issue).

Full trace:

Plugin Trace:


[Workflow: Workflow.CalculateClearedFees]
[Workflow (2.0.0.7): Workflow.CalculateClearedFees]
Entered CalculateClearedFees.Execute(), Activity Instance Id: 69, Workflow Instance Id: 3f517f35-4fd1-41b8-8259-010d871a8e23
CalculateClearedFees.Execute(), Correlation Id: 76033beb-d534-4f18-8129-eaf6d4792cb1, Initiating User: ee172285-77e3-e411-b482-005056870a84


Error Message:

Unhandled Exception: System.InvalidOperationException: An Activity can only get the location of arguments which it owns.  Activity 'CustomActivityStep153' is trying to get the location of argument 'ClearedFees' which is owned by activity 'CustomActivityStep143: Calculate online application fees'.
   at System.Activities.RuntimeArgument.GetLocation(ActivityContext context)
   at System.Activities.ActivityContext.SetValueCore[T](LocationReference locationReference, T value)
   at System.Activities.ActivityContext.SetValue[T](OutArgument`1 argument, T value)
   at System.Activities.OutArgument`1.Set(ActivityContext context, T value)
   at Workflow.CalculateClearedFees.Execute(CodeActivityContext executionContext)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

The error is thrown when an OutArgument is being set, which is even stranger. Has anyone seen anything like this?

  • RE: "An Activity can only get the location of arguments which it owns."

    I tend to partially agree. While it doesn't seem to be related with the CRM activities, it seems that is has to due on how the Code Activities are relating with each other.

    Looking to the error on second glance: "Activity 'CustomActivityStep153' is trying to get the location of argument 'ClearedFees' which is owned by activity 'CustomActivityStep143" seems like the segment of one code activity is trying to change the value of ClearedFees, which is owned by another code activity.

    When you are setting values for this argument, are you making copies for internaly variables inside the code activity, or using the argument directly?

    Without an overall look to what is happening, it's hard to suggest, so apologies if this answer doesn't make sense in your context. However, I hope it can help getting a little further to the solution... :)

  • MateuszBender Profile Picture
    MateuszBender 210 on at
    RE: "An Activity can only get the location of arguments which it owns."

    Your answer, sadly, doesn't help at all. I've been googling the issue for a while, and have come across that SO question as well. I don't think it applies AT ALL to CRM activities. CRM activities are started by CRMs internals as part of a workflow and you don't call one activity from another, so this answer has no relevance.

  • RE: "An Activity can only get the location of arguments which it owns."

    Hi Mateus,

    It can be that the workflow is hitting a fork in the code that only hits this error under certain circumstances.

    There is an article that might help: https://stackoverflow.com/questions/14454384/accessing-outargument-value-of-receive-implementation-child-activity-within-cust

    The recommendation seems to be: 

    Use internal variables to pass values between internal activities.

    More documentation around receiving parameters: 

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/workflow/tutorial-create-workflow-extension

    Hope it helps!

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans