0
votes

Am newbie to CRM. Trying to automate a process using custom workflow. Is there any way to return the particular field values of the record in an entity.

For Example: Using custom workflow change the status of the record and return the Account name of that record. Is it possible to do in CRM?

1
You cannot return a value in a workflow so to speak, no. (I guess that's your answer), but what are you trying to return the account name to? What's calling this workflow? (Or is it actually a custom workflow activity, i.e. a piece of C# code, you are calling from a workflow?)Conor Gallagher
its a custom workflow activity scheduled on daily basis, after it sets the status of a record, I want the record account name to be returned so that i can use that value to do some post operation in my automation process.Shoby
It sounds like you need to rework the process flow. Remember, in CRM it's all asynchronous so you don't "return" anything as such. There's nothing to return it to apart from the async service (success / fail / etc) When you set the status of the record, why not just trigger another workflow off that status change? That way you have the entire account record and you can do whatever you want.Conor Gallagher

1 Answers

2
votes

Yes this is possible in a Custom Workflow Activity using Output Parameters. This blog post is useful.

In your C# code, outside of the Execute() function, define an Output Parameter like this:

[Output("Account Name")]
public OutArgument<string> AccountName { get; set; }

Then in your code (that executes within the Execute() function, set the value of your Output Parameter (in this case AccountName) like this:

AccountName.Set(executionContext, "account name"); Replace the "account name" string as appropriate.

Then in your workflow, every step after the step where you have called your custom step will have access to AccountName.