protected override void OnExecute() { //Atualiza lista de preço na oportunidade this.Trace("Atualizando lista de preço na oportunidade."); Entity op = new Entity("opportunity"); op.Id = Oportunidade.Get <EntityReference>(this.ExecutionContext).Id; op["pricelevelid"] = ListaPreco.Get <EntityReference>(this.ExecutionContext); this.Service.Update(op); this.Trace("Criando registro opportunityproduct."); Entity oOppProduct = new Entity("opportunityproduct"); oOppProduct["opportunityid"] = Oportunidade.Get <EntityReference>(this.ExecutionContext); oOppProduct["productid"] = Produto.Get <EntityReference>(this.ExecutionContext); oOppProduct["quantity"] = new Decimal(1); oOppProduct["uomid"] = this.UnidadePadrao.Get <EntityReference>(this.ExecutionContext); this.Service.Create(oOppProduct); }