I am creating a custom workflow that is - Triggered on the create of a record (Custom Activity).
I need to be able to access the data from the Custom Activity above within my Custom workflow but I am have a hard time finding a reference on how to get the information from the newly created record.
Any advice? Thanks in advanced.
Edit:
public sealed class FeeInvoiceGenerator : CodeActivity
{
[Input("MyFee")]
[ReferenceTarget("fee")]
[RequiredArgument]
public InArgument<EntityReference> SomeFee { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
ITracingService tracingService = executionContext.GetExtension<ITracingService>();
try
{
tracingService.Trace("Creating Invoice for Fee");
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
workFlowHelper.debugMessagesOn = true;
//creates connection info
InvoiceFeeHelper invoiceFeeHelper = new InvoiceFeeHelper();
invoiceFeeHelper.ConnectionInfo(workFlowHelper);
invoiceFeeHelper.CreatingConnection(workFlowHelper, executionContext);
//initialize other classes
FeeMaster feeMaster = new FeeMaster();
InvoiceMaster invoiceMaster = new InvoiceMaster();
InvoiceFeeMaster invoiceFeeMaster = new InvoiceFeeMaster();
EntityReference getFee = this.SomeFee.Get(executionContext);
String feeId = getFee.Id.ToString();
invoiceFeeMaster.CreateInvoiceFromFee(workFlowHelper, invoiceFeeHelper, invoiceMaster, feeMaster, feeId, executionContext);
}
catch (Exception ex)
{
throw new NotImplementedException("error occured" + ex.Message);
}
}
}
However, I am running into an issue where I cannot access the [Set Properties] within the workflow itself to assign the input. (at least this is what I have seen from other examples online and it is blank for me)
I have also tried to use:
IWorkflowContext workFlowContext = workFlowHelper.context.GetExtension<IWorkflowContext>();
Guid _feeRecordID = workFlowContext.PrimaryEntityId;
in order to get the records Id to no avail. The other portions of my custom workflow work, If I pass in a guid from a 'Fee'(the record I need to grab), everything works great.
Am I doing something wrong?
Second Edit: I needed to restart IIS on the CRM server before it would recognize that there were inputs to be used.