Hi,
I have created a workflow where I want to retrieve the newly created id from the account entity.
I was trying to avoid doing this with a plugin and instead wanted to create a really simply workflow that takes the id of record that was just created or updated and adds a record to another entity.
So... account is created, the id is captured and sent be second entity.
However, I don't seem to be able to find the "id" field anywhere in the list... I have tried a few of the other options and have found none that provide the value I want.
Is this not possible with workflows?
Thanks - Greg
Thanks Guido - this is where I was heading - thanks for the confirmation.
you need a custom workflow activity for that, but it's very simple
here a tutorial for starting msdn.microsoft.com/.../gg334455.aspx
you will need an inputparameter as entityreference
an output parameter as string
and inside the execute method you just need to read the id property of the entityreference and set to the output parameter
something like
public sealed class GetRecordId : CodeActivity { [Required] [Input("Account")] [ReferenceTarget("account")] public InArgument<EntityReference> Account { get; set; } [Output("Account Id")] public OutArgument<string> AccountId { get; set; } protected override void Execute(CodeActivityContext executionContext) { EntityReference accountRef = Account.Get<EntityReference>(executionContext); AccountId.Set(executionContext, accountRef.Id.ToString()); } }
Hi Guido - yes, I just want the Id as string (guid format).
Is this possible or do I need to go down the path of creating a custom workflow activity.
Hi Greg,
I suppose you will need the Id as a string? because if you need to set as a lookup you can assign it in the process designer to a field that accept the contact lookup
if you need the id as string an alternative you can create a custom workflow activity
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156