locked
can I add to InputParameter["Target"] and will I also need parentcustomeridtype? RRS feed

  • Question

  • I assume either of the last two statements will work:

    EntityReference acct = getAccount(incoming.GetAttributeValue<string>("new_companyname"), service);
    if (null == acct) return;
    
    // finding such a company, add its EntityReference to the InputParameters
    ((Entity)context.InputParameters["Target"])["parentcustomerid"] = acct;
    ((Entity)context.InputParameters["Target"]).Attributes.Add("parentcustomerid", acct);
    

    But does the EntityReference take care of the parentcustomeridtype -- since it's a customer and not a lookup -- or will that attribute be needed as well?

    PS- this is pre-operation phase plugin

    Wednesday, June 25, 2014 8:35 PM

Answers

  • Thanks, but there are no OutputParameters in the Pre-Operation phase (20) of the Event execution pipeline.

    With late binding I wouldn't have "new Customer".  Instead I have EntityReference acct = new EntityReference("account", service.Create(newAcct)); or some found GUID.


    • Edited by mardukes Thursday, June 26, 2014 3:26 PM not contact
    • Marked as answer by mardukes Thursday, July 3, 2014 3:18 PM
    Thursday, June 26, 2014 3:26 PM

All replies

  • Yeah, it works as is.
    Wednesday, June 25, 2014 9:46 PM
  • try this

    if (context.OutputParameters.Properties.Contains("id")) { contactobj.parentcustomerid = new Customer(); contactobj.parentcustomerid.type = EntityName.account.ToString(); contactobj.parentcustomerid.Value = new Guid(context.OutputParameters.Properties["id"].ToString()); }


    ramzi


    Thursday, June 26, 2014 9:22 AM
  • Thanks, but there are no OutputParameters in the Pre-Operation phase (20) of the Event execution pipeline.

    With late binding I wouldn't have "new Customer".  Instead I have EntityReference acct = new EntityReference("account", service.Create(newAcct)); or some found GUID.


    • Edited by mardukes Thursday, June 26, 2014 3:26 PM not contact
    • Marked as answer by mardukes Thursday, July 3, 2014 3:18 PM
    Thursday, June 26, 2014 3:26 PM