c# - CRM 2011 Custom Workflow accessing data from a created record trigger -
i creating custom workflow - triggered on create of record (custom activity).
i need able access data custom activity above within custom workflow have hard time finding reference on how information newly created record.
any advice? 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 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, running issue cannot access [set properties] within workflow assign input. (at least have seen other examples online , blank me)
i have tried use:
iworkflowcontext workflowcontext = workflowhelper.context.getextension<iworkflowcontext>(); guid _feerecordid = workflowcontext.primaryentityid;
in order records id no avail. other portions of custom workflow work, if pass in guid 'fee'(the record need grab), works great.
am doing wrong?
second edit: needed restart iis on crm server before recognize there inputs used.
couple of ways this:
- use input parameter pass data need.
- use input parameter pass id of record, , use iorganizationservice retrieve rest of data.
please see custom workflow activities (workflow assemblies) microsoft dynamics crm examples , further detail.
Comments
Post a Comment